| 1 |
#Boa:MDIParent:fraggleViewport |
4#Boa:MDIParent:fraggleViewport |
| 2 |
|
|
| 3 |
import os |
import os |
| 4 |
from wxPython.wx import * |
from wxPython.wx import * |
| 5 |
|
|
| 6 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
| 7 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
| 8 |
|
from fraggleDialogs import * |
| 9 |
|
|
| 10 |
def create(parent): |
def create(parent): |
| 11 |
return fraggleViewport(parent) |
return fraggleMainWin(parent) |
| 12 |
|
|
| 13 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
| 14 |
|
|
| 15 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
| 16 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
| 17 |
|
|
| 18 |
|
[wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
| 19 |
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
| 20 |
|
|
| 21 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
| 22 |
def _init_coll_menu1_Items(self, parent): |
def _init_coll_menu1_Items(self, parent): |
| 23 |
# generated method, don't edit |
# generated method, don't edit |
| 24 |
|
|
| 25 |
|
parent.Append(helpString='Configure Netfraggle', |
| 26 |
|
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
| 27 |
|
kind=wxITEM_NORMAL) |
| 28 |
|
parent.Append(helpString='Exit Netfraggle', |
| 29 |
|
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
| 30 |
|
kind=wxITEM_NORMAL) |
| 31 |
|
|
|
if os.name == "posix": |
|
|
parent.Append(helpString='Configure Netfraggle', |
|
|
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
|
|
kind=wxITEM_NORMAL) |
|
|
parent.Append(helpString='Exit Netfraggle', |
|
|
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
|
|
kind=wxITEM_NORMAL) |
|
|
elif os.name == "nt": |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL) |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Exit Netfraggle', "", wxITEM_NORMAL) |
|
|
|
|
| 32 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
| 33 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
| 34 |
|
|
| 35 |
|
def _init_coll_menu2_Items(self, parent): |
| 36 |
|
# generated method, don't edit |
| 37 |
|
|
| 38 |
|
parent.Append(helpString='Documentation', |
| 39 |
|
id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents', |
| 40 |
|
kind=wxITEM_NORMAL) |
| 41 |
|
parent.Append(helpString='About Netfraggle', |
| 42 |
|
id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About', |
| 43 |
|
kind=wxITEM_NORMAL) |
| 44 |
|
|
| 45 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
| 46 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
| 47 |
|
|
| 48 |
def _init_coll_menuBar1_Menus(self, parent): |
def _init_coll_menuBar1_Menus(self, parent): |
| 49 |
# generated method, don't edit |
# generated method, don't edit |
| 50 |
|
|
| 51 |
parent.Append(menu=self.menu1, title='File') |
parent.Append(menu=self.menu1, title='File') |
| 52 |
|
parent.Append(menu=self.menu2, title='Help') |
| 53 |
|
|
| 54 |
def _init_utils(self): |
def _init_utils(self): |
| 55 |
# generated method, don't edit |
# generated method, don't edit |
| 59 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
| 60 |
self._init_coll_menu1_Items(self.menu1) |
self._init_coll_menu1_Items(self.menu1) |
| 61 |
|
|
| 62 |
|
self.menu2 = wxMenu(title='') |
| 63 |
|
self._init_coll_menu2_Items(self.menu2) |
| 64 |
|
|
| 65 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
| 66 |
|
|
| 67 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
| 78 |
def __init_preferences__(self): |
def __init_preferences__(self): |
| 79 |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
| 80 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
| 81 |
|
self.dialogPrefs.loadConfig() |
| 82 |
|
self.dialogPrefs.updateConfig() |
| 83 |
|
|
| 84 |
def __init__(self, parent): |
def __init__(self, parent): |
| 85 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 86 |
self.__init_preferences__() |
self.__init_preferences__() |
|
|
|
| 87 |
|
|
| 88 |
def OnMenu1items0Menu(self, event): |
def showPrefs(self, event): |
| 89 |
|
"""Show preferences screen""" |
| 90 |
try: |
try: |
| 91 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
| 92 |
finally: |
finally: |
| 93 |
self.dialogPrefs.Destroy() |
self.dialogPrefs.Destroy() |
| 94 |
event.Skip() |
#event.Skip() |
| 95 |
|
|
| 96 |
|
def showHelp(self): |
| 97 |
|
"""Show help""" |
| 98 |
|
try: |
| 99 |
|
import webbrowser |
| 100 |
|
webbrowser.open("file://"+os.path.join(PEARSLOCATION, "docs/index.html"), 1) |
| 101 |
|
except: |
| 102 |
|
dlg = wxScrolledMessageDialog(parent=self, |
| 103 |
|
caption="Help", |
| 104 |
|
msg="""PEARS - alternative help (see the docs directory in your Pears folder for more elaborate information) |
| 105 |
|
|
| 106 |
|
Pears is a relatively simple three-pane news feed aggregator (RSS/RDF reader). |
| 107 |
|
|
| 108 |
|
The left pane contains the list of feeds. You can add feeds using the Feeds menu. Right-click on a feed to update, single-click to view cached contents. |
| 109 |
|
|
| 110 |
|
The right pane contains a list of the topics available in the feed. Single-click to open the contents of a topic in the viewer window at the bottom. Right-click to toggle read/unread status. |
| 111 |
|
|
| 112 |
|
Everything is cached in Python structures stored as plain text in your Home directory (in a subdirectory called '.pears'). Use the About screen to see exactly where that is on your system. |
| 113 |
|
""") |
| 114 |
|
dlg.ShowModal() |
| 115 |
|
dlg.Destroy() |
| 116 |
|
|
| 117 |
|
def showAbout(self): |
| 118 |
|
"""Show about screen""" |
| 119 |
|
dlg = AboutDialog(parent=self, id=-1, title="About Pears") |
| 120 |
|
dlg.ShowModal() |
| 121 |
|
dlg.Destroy() |
| 122 |
|
|
| 123 |
|
def doExit(self): |
| 124 |
|
"""Shut down the program""" |
| 125 |
|
self.Close(True) |
| 126 |
|
self.Destroy() |
| 127 |
|
|
| 128 |
|
def OnMenu1items0Menu(self, event): |
| 129 |
|
self.showPrefs(event) |
| 130 |
|
#event.Skip() |
| 131 |
|
|
| 132 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
| 133 |
self.Destroy() |
self.doExit() |
| 134 |
event.Skip() |
|
| 135 |
|
def OnMenu2items0Menu(self, event): |
| 136 |
|
self.showHelp() |
| 137 |
|
|
| 138 |
|
def OnMenu2items1Menu(self, event): |
| 139 |
|
self.showAbout() |
| 140 |
|
|
| 141 |
|
class fraggleMainWin(fraggleViewport): |
| 142 |
|
def _init_coll_menu1_Items(self, parent): |
| 143 |
|
|
| 144 |
|
if os.name == 'posix': |
| 145 |
|
super(fraggleMainWin, self)._init_coll_menu1_Items(parent) |
| 146 |
|
elif os.name == 'nt': |
| 147 |
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL) |
| 148 |
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, 'Exit Netfraggle', "", wxITEM_NORMAL) |
| 149 |
|
|
| 150 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
| 151 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
| 152 |
|
|
| 153 |
|
def _init_coll_menu2_Items(self, parent): |
| 154 |
|
|
| 155 |
|
if os.name == 'posix': |
| 156 |
|
super(fraggleMainWin, self)._init_coll_menu2_Items(parent) |
| 157 |
|
elif os.name == 'nt': |
| 158 |
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL) |
| 159 |
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL) |
| 160 |
|
|
| 161 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
| 162 |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
| 163 |
|
|