1 |
4#Boa:MDIParent:fraggleViewport |
#Boa:MDIParent:fraggleViewport |
2 |
|
|
3 |
|
# $Id$ |
4 |
|
# $Log$ |
5 |
|
# Revision 1.17 2004/09/01 21:43:30 xabbu |
6 |
|
# +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience |
7 |
|
# +FraggleCtlModules class creation for handling content modules |
8 |
|
# |
9 |
|
# Revision 1.16 2004/08/30 13:06:40 joko |
10 |
|
# U now gets preferences via self.engine |
11 |
|
# |
12 |
|
# Revision 1.15 2004/08/27 21:14:02 xabbu |
13 |
|
# TopicDetails can now be closed. |
14 |
|
# GUI change on Preferences Dialog in order to prepare multiple server profiles. |
15 |
|
# Small bugfixes to get the new topic windows working on posix platform. |
16 |
|
# |
17 |
|
# Revision 1.14 2004/08/27 04:39:06 joko |
18 |
|
# cleanup |
19 |
|
# |
20 |
|
# Revision 1.13 2004/08/27 03:25:44 joko |
21 |
|
# added FraggleTaskBarMenu |
22 |
|
# |
23 |
|
# Revision 1.12 2004/08/27 00:05:22 joko |
24 |
|
# fix for icon-path and wxTaskBarIcon-events |
25 |
|
# |
26 |
|
# Revision 1.11 2004/08/26 23:10:12 xabbu |
27 |
|
# xmlrpc class added |
28 |
|
# |
29 |
|
# Revision 1.10 2004/08/26 18:19:27 joko |
30 |
|
# now using FraggleTopicFrame |
31 |
|
# |
32 |
|
# Revision 1.9 2004/08/26 15:21:13 joko |
33 |
|
# renamed namespaces |
34 |
|
# added key shortcuts to menu-items |
35 |
|
# correct "showAbout" code |
36 |
|
# |
37 |
|
|
38 |
import os |
import os |
39 |
from wxPython.wx import * |
from wxPython.wx import * |
40 |
|
from wxPython.stc import * |
41 |
|
|
42 |
|
from fraggleConstants import * |
43 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
44 |
import fraggleCtlPreferences |
import FraggleAboutDialog |
45 |
from fraggleDialogs import * |
import FraggleTopicFrame |
46 |
|
import FraggleXMLRPC |
47 |
|
|
48 |
def create(parent): |
def create(parent): |
49 |
return fraggleMainWin(parent) |
return fraggleViewport(parent) |
50 |
|
|
51 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
52 |
|
|
53 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
54 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
55 |
|
|
56 |
[wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
57 |
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
58 |
|
|
59 |
|
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
60 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
61 |
|
|
62 |
|
[wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
63 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
64 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
65 |
|
] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3)) |
66 |
|
|
67 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
68 |
def _init_coll_menu1_Items(self, parent): |
def _init_coll_FraggleTaskBarMenu_Items(self, parent): |
69 |
# generated method, don't edit |
# generated method, don't edit |
|
|
|
|
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) |
|
70 |
|
|
71 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
parent.Append(helpString='Restore', |
72 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
73 |
|
item='Restore', kind=wxITEM_NORMAL) |
74 |
|
parent.Append(helpString='Sync enabled', |
75 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
76 |
|
item='Sync enabled', kind=wxITEM_CHECK) |
77 |
|
parent.Append(helpString='Exit', |
78 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit', |
79 |
|
kind=wxITEM_NORMAL) |
80 |
|
|
81 |
def _init_coll_menu2_Items(self, parent): |
def _init_coll_menu2_Items(self, parent): |
82 |
# generated method, don't edit |
# generated method, don't edit |
83 |
|
|
84 |
parent.Append(helpString='Documentation', |
parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT, |
85 |
id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents', |
item='Contents', kind=wxITEM_NORMAL) |
86 |
|
parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
87 |
|
item='About', kind=wxITEM_NORMAL) |
88 |
|
|
89 |
|
def _init_coll_menu1_Items(self, parent): |
90 |
|
# generated method, don't edit |
91 |
|
|
92 |
|
parent.Append(helpString='Configure Netfraggle', |
93 |
|
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
94 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
95 |
parent.Append(helpString='About Netfraggle', |
parent.Append(helpString='Exit Netfraggle', |
96 |
id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About', |
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
97 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
|
|
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
|
98 |
|
|
99 |
def _init_coll_menuBar1_Menus(self, parent): |
def _init_coll_menuBar1_Menus(self, parent): |
100 |
# generated method, don't edit |
# generated method, don't edit |
101 |
|
|
102 |
parent.Append(menu=self.menu1, title='File') |
parent.Append(menu=self.menu1, title='&File') |
103 |
parent.Append(menu=self.menu2, title='Help') |
parent.Append(menu=self.menu2, title='&Help') |
104 |
|
|
105 |
def _init_utils(self): |
def _init_utils(self): |
106 |
# generated method, don't edit |
# generated method, don't edit |
113 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
114 |
self._init_coll_menu2_Items(self.menu2) |
self._init_coll_menu2_Items(self.menu2) |
115 |
|
|
116 |
|
self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle') |
117 |
|
self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu) |
118 |
|
|
119 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
120 |
|
|
121 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
122 |
# generated method, don't edit |
# generated method, don't edit |
123 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
124 |
name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313), |
name='fraggleViewport', parent=prnt, pos=wxPoint(335, 382), |
125 |
size=wxSize(683, 307), |
size=wxSize(427, 269), |
126 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
127 |
title='wxMDIParentFrame1') |
title='NetFraggle 0.0.1') |
128 |
self._init_utils() |
self._init_utils() |
129 |
self.SetClientSize(wxSize(683, 284)) |
self.SetClientSize(wxSize(427, 246)) |
130 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
131 |
|
|
132 |
|
def __init_modules__(self): |
133 |
|
self.modulesCtl = self.engine.modules |
134 |
|
self.dialogModules = FraggleDialogModules.create(self) |
135 |
|
|
136 |
def __init_preferences__(self): |
def __init_preferences__(self): |
137 |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
self.preferencesCtl = self.engine.preferences |
138 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
139 |
self.dialogPrefs.loadConfig() |
self.dialogPrefs.loadConfig() |
140 |
self.dialogPrefs.updateConfig() |
self.dialogPrefs.updateConfig() |
141 |
|
|
142 |
|
# new as of 2004-08-26: TopicFrame |
143 |
|
# new as of 2004-08-27: pass configList to TopicFrame |
144 |
|
self.topicFrame = FraggleTopicFrame.create(self) |
145 |
|
self.topicFrame.Move(wxPoint(5, 5)) |
146 |
|
|
147 |
|
#frame.Show() |
148 |
|
#frame.Destroy() |
149 |
|
def __init_xmlrpc__(self): |
150 |
|
#self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
151 |
|
pass |
152 |
|
|
153 |
|
def __init_taskbar_icon__(self): |
154 |
|
if os.name == 'posix': |
155 |
|
pass |
156 |
|
elif os.name == 'nt': |
157 |
|
self.tbicon = wxTaskBarIcon() |
158 |
|
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
159 |
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
160 |
|
self.tbicon.SetIcon(icon, '') |
161 |
|
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
162 |
|
EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
163 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore) |
164 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit) |
165 |
|
|
166 |
def __init__(self, parent): |
def __init__(self, parent): |
167 |
|
import __main__ |
168 |
|
self.engine = __main__.engine |
169 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
170 |
self.__init_preferences__() |
self.__init_preferences__() |
171 |
|
self.__init_taskbar_icon__() |
172 |
def showPrefs(self, event): |
self.__init_xmlrpc__() |
173 |
"""Show preferences screen""" |
|
174 |
|
def OnMenu1items0Menu(self, event): |
175 |
try: |
try: |
176 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
177 |
finally: |
finally: |
178 |
self.dialogPrefs.Destroy() |
self.dialogPrefs.Hide() |
179 |
#event.Skip() |
event.Skip() |
|
|
|
|
def showHelp(self): |
|
|
"""Show help""" |
|
|
try: |
|
|
import webbrowser |
|
|
webbrowser.open("file://"+os.path.join(PEARSLOCATION, "docs/index.html"), 1) |
|
|
except: |
|
|
dlg = wxScrolledMessageDialog(parent=self, |
|
|
caption="Help", |
|
|
msg="""PEARS - alternative help (see the docs directory in your Pears folder for more elaborate information) |
|
|
|
|
|
Pears is a relatively simple three-pane news feed aggregator (RSS/RDF reader). |
|
|
|
|
|
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. |
|
|
|
|
|
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. |
|
|
|
|
|
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. |
|
|
""") |
|
|
dlg.ShowModal() |
|
|
dlg.Destroy() |
|
|
|
|
|
def showAbout(self): |
|
|
"""Show about screen""" |
|
|
dlg = AboutDialog(parent=self, id=-1, title="About Pears") |
|
|
dlg.ShowModal() |
|
|
dlg.Destroy() |
|
|
|
|
|
def doExit(self): |
|
|
"""Shut down the program""" |
|
|
self.Close(True) |
|
|
self.Destroy() |
|
|
|
|
|
def OnMenu1items0Menu(self, event): |
|
|
self.showPrefs(event) |
|
|
#event.Skip() |
|
180 |
|
|
181 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
182 |
self.doExit() |
self.Destroy() |
183 |
|
event.Skip() |
184 |
|
|
185 |
|
|
186 |
def OnMenu2items0Menu(self, event): |
def OnMenu2items0Menu(self, event): |
187 |
self.showHelp() |
try: |
188 |
|
self.dialogPrefs.ShowModal() |
189 |
|
finally: |
190 |
|
pass |
191 |
|
event.Skip() |
192 |
|
|
193 |
def OnMenu2items1Menu(self, event): |
def OnMenu2items1Menu(self, event): |
194 |
self.showAbout() |
"""Show about screen""" |
195 |
|
dlg = FraggleAboutDialog.create(self) |
196 |
class fraggleMainWin(fraggleViewport): |
dlg.ShowModal() |
197 |
def _init_coll_menu1_Items(self, parent): |
dlg.Destroy() |
|
|
|
|
if os.name == 'posix': |
|
|
super(fraggleMainWin, self)._init_coll_menu1_Items(parent) |
|
|
elif os.name == 'nt': |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, 'Configure Netfraggle', "", wxITEM_NORMAL) |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, 'Exit Netfraggle', "", wxITEM_NORMAL) |
|
|
|
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
|
|
|
|
|
def _init_coll_menu2_Items(self, parent): |
|
198 |
|
|
199 |
if os.name == 'posix': |
def OnTaskBarLeftDClick(self, event): |
200 |
super(fraggleMainWin, self)._init_coll_menu2_Items(parent) |
#event.Skip() |
201 |
elif os.name == 'nt': |
#self.SetFocus() |
202 |
parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL) |
if self.IsIconized(): |
203 |
parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL) |
self.Restore() |
204 |
|
else: |
205 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
self.Iconize() |
206 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
|
207 |
|
def OnTaskBarRightClick(self, event): |
208 |
|
#event.Skip() |
209 |
|
self.tbicon.PopupMenu(self.FraggleTaskBarMenu) |
210 |
|
|
211 |
|
def OnTaskBarAppRestore(self, event): |
212 |
|
self.Restore() |
213 |
|
#event.Skip() |
214 |
|
|
215 |
|
def OnTaskBarAppExit(self, event): |
216 |
|
#event.Skip() |
217 |
|
#self.Destroy() |
218 |
|
self.Close(True) |
219 |
|
|