/[cvs]/nfo/projects/netfraggle/bin/fraggleViewport.py
ViewVC logotype

Contents of /nfo/projects/netfraggle/bin/fraggleViewport.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Wed Aug 25 22:53:41 2004 UTC (19 years, 10 months ago) by joko
Branch: MAIN
Changes since 1.6: +93 -8 lines
File MIME type: text/x-python
some helper methods inside fraggleViewport
subclass fraggleMainWin hopefully gives us win32-compatibility

1 4#Boa:MDIParent:fraggleViewport
2
3 import os
4 from wxPython.wx import *
5
6 import fraggleDialogPrefs
7 import fraggleCtlPreferences
8 from fraggleDialogs import *
9
10 def create(parent):
11 return fraggleMainWin(parent)
12
13 [wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1))
14
15 [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1,
16 ] = 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):
22 def _init_coll_menu1_Items(self, parent):
23 # 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
32 EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu)
33 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):
49 # generated method, don't edit
50
51 parent.Append(menu=self.menu1, title='File')
52 parent.Append(menu=self.menu2, title='Help')
53
54 def _init_utils(self):
55 # generated method, don't edit
56 self.menuBar1 = wxMenuBar()
57 self.menuBar1.SetAutoLayout(1)
58
59 self.menu1 = wxMenu(title='')
60 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)
66
67 def _init_ctrls(self, prnt):
68 # generated method, don't edit
69 wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT,
70 name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313),
71 size=wxSize(683, 307),
72 style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
73 title='wxMDIParentFrame1')
74 self._init_utils()
75 self.SetClientSize(wxSize(683, 284))
76 self.SetMenuBar(self.menuBar1)
77
78 def __init_preferences__(self):
79 self.preferencesCtl = fraggleCtlPreferences.create(self)
80 self.dialogPrefs = fraggleDialogPrefs.create(self)
81 self.dialogPrefs.loadConfig()
82 self.dialogPrefs.updateConfig()
83
84 def __init__(self, parent):
85 self._init_ctrls(parent)
86 self.__init_preferences__()
87
88 def showPrefs(self, event):
89 """Show preferences screen"""
90 try:
91 self.dialogPrefs.ShowModal()
92 finally:
93 self.dialogPrefs.Destroy()
94 #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):
133 self.doExit()
134
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

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed