1 |
4#Boa:MDIParent:fraggleViewport |
#Boa:MDIParent:fraggleViewport |
2 |
|
|
3 |
|
# $Id$ |
4 |
|
# $Log$ |
5 |
|
# Revision 1.9 2004/08/26 15:21:13 joko |
6 |
|
# renamed namespaces |
7 |
|
# added key shortcuts to menu-items |
8 |
|
# correct "showAbout" code |
9 |
|
# |
10 |
|
|
11 |
import os |
import os |
12 |
from wxPython.wx import * |
from wxPython.wx import * |
13 |
|
|
14 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
15 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
16 |
from fraggleDialogs import * |
import FraggleAboutDialog |
17 |
|
|
18 |
def create(parent): |
def create(parent): |
19 |
return fraggleMainWin(parent) |
return fraggleViewport(parent) |
20 |
|
|
21 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
22 |
|
|
23 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
24 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
25 |
|
|
26 |
[wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
27 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
28 |
|
|
29 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
30 |
|
def _init_coll_menu2_Items(self, parent): |
31 |
|
# generated method, don't edit |
32 |
|
|
33 |
|
parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT, |
34 |
|
item='Contents', kind=wxITEM_NORMAL) |
35 |
|
parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
36 |
|
item='About', kind=wxITEM_NORMAL) |
37 |
|
|
38 |
def _init_coll_menu1_Items(self, parent): |
def _init_coll_menu1_Items(self, parent): |
39 |
# generated method, don't edit |
# generated method, don't edit |
40 |
|
|
41 |
parent.Append(helpString='Configure Netfraggle', |
parent.Append(helpString='Configure Netfraggle', |
42 |
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
43 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
45 |
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
46 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
47 |
|
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) |
|
|
|
|
|
def _init_coll_menu2_Items(self, parent): |
|
|
# generated method, don't edit |
|
|
|
|
|
parent.Append(helpString='Documentation', |
|
|
id=wxID_FRAGGLEVIEWPORTMENU2CONT, item='Contents', |
|
|
kind=wxITEM_NORMAL) |
|
|
parent.Append(helpString='About Netfraggle', |
|
|
id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, item='About', |
|
|
kind=wxITEM_NORMAL) |
|
|
|
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
|
|
|
|
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') |
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 |
57 |
self.menuBar1.SetAutoLayout(1) |
self.menuBar1.SetAutoLayout(1) |
58 |
|
|
59 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
|
self._init_coll_menu1_Items(self.menu1) |
|
60 |
|
|
61 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
|
self._init_coll_menu2_Items(self.menu2) |
|
62 |
|
|
63 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
64 |
|
self._init_coll_menu1_Items(self.menu1) |
65 |
|
self._init_coll_menu2_Items(self.menu2) |
66 |
|
|
67 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
68 |
# generated method, don't edit |
# generated method, don't edit |
69 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
70 |
name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313), |
name='fraggleViewport', parent=prnt, pos=wxPoint(237, 287), |
71 |
size=wxSize(683, 307), |
size=wxSize(485, 310), |
72 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
73 |
title='wxMDIParentFrame1') |
title='NetFraggle') |
74 |
self._init_utils() |
self._init_utils() |
75 |
self.SetClientSize(wxSize(683, 284)) |
self.SetClientSize(wxSize(477, 283)) |
76 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
77 |
|
|
78 |
def __init_preferences__(self): |
def __init_preferences__(self): |
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 |
|
|
89 |
def showPrefs(self, event): |
def OnMenu1items0Menu(self, event): |
|
"""Show preferences screen""" |
|
90 |
try: |
try: |
91 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
92 |
finally: |
finally: |
93 |
self.dialogPrefs.Destroy() |
pass |
94 |
#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() |
|
95 |
|
|
96 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
97 |
self.doExit() |
self.Destroy() |
98 |
|
event.Skip() |
99 |
|
|
100 |
|
|
101 |
def OnMenu2items0Menu(self, event): |
def OnMenu2items0Menu(self, event): |
102 |
self.showHelp() |
try: |
103 |
|
self.dialogPrefs.ShowModal() |
104 |
|
finally: |
105 |
|
pass |
106 |
|
event.Skip() |
107 |
|
|
108 |
def OnMenu2items1Menu(self, event): |
def OnMenu2items1Menu(self, event): |
109 |
self.showAbout() |
"""Show about screen""" |
110 |
|
dlg = FraggleAboutDialog.create(self) |
111 |
class fraggleMainWin(fraggleViewport): |
dlg.ShowModal() |
112 |
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): |
|
|
|
|
|
if os.name == 'posix': |
|
|
super(fraggleMainWin, self)._init_coll_menu2_Items(parent) |
|
|
elif os.name == 'nt': |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL) |
|
|
parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL) |
|
|
|
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
|
113 |
|
|