| 1 |
4#Boa:MDIParent:fraggleViewport |
#Boa:MDIParent:fraggleViewport |
| 2 |
|
|
| 3 |
|
# $Id$ |
| 4 |
|
# $Log$ |
| 5 |
|
# Revision 1.12 2004/08/27 00:05:22 joko |
| 6 |
|
# fix for icon-path and wxTaskBarIcon-events |
| 7 |
|
# |
| 8 |
|
# Revision 1.11 2004/08/26 23:10:12 xabbu |
| 9 |
|
# xmlrpc class added |
| 10 |
|
# |
| 11 |
|
# Revision 1.10 2004/08/26 18:19:27 joko |
| 12 |
|
# now using FraggleTopicFrame |
| 13 |
|
# |
| 14 |
|
# Revision 1.9 2004/08/26 15:21:13 joko |
| 15 |
|
# renamed namespaces |
| 16 |
|
# added key shortcuts to menu-items |
| 17 |
|
# correct "showAbout" code |
| 18 |
|
# |
| 19 |
|
|
| 20 |
import os |
import os |
| 21 |
from wxPython.wx import * |
from wxPython.wx import * |
| 22 |
|
from wxPython.stc import * |
| 23 |
|
|
| 24 |
|
from fraggleConstants import * |
| 25 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
| 26 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
| 27 |
from fraggleDialogs import * |
import FraggleAboutDialog |
| 28 |
|
import FraggleTopicFrame |
| 29 |
|
import FraggleXMLRPC |
| 30 |
|
|
| 31 |
def create(parent): |
def create(parent): |
| 32 |
return fraggleMainWin(parent) |
return fraggleViewport(parent) |
| 33 |
|
|
| 34 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
| 35 |
|
|
| 36 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
| 37 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
| 38 |
|
|
| 39 |
[wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
| 40 |
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
| 41 |
|
|
| 42 |
|
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
| 43 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
| 44 |
|
|
| 45 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
| 46 |
|
def _init_coll_menu2_Items(self, parent): |
| 47 |
|
# generated method, don't edit |
| 48 |
|
|
| 49 |
|
parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT, |
| 50 |
|
item='Contents', kind=wxITEM_NORMAL) |
| 51 |
|
parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
| 52 |
|
item='About', kind=wxITEM_NORMAL) |
| 53 |
|
|
| 54 |
def _init_coll_menu1_Items(self, parent): |
def _init_coll_menu1_Items(self, parent): |
| 55 |
# generated method, don't edit |
# generated method, don't edit |
| 56 |
|
|
| 57 |
parent.Append(helpString='Configure Netfraggle', |
parent.Append(helpString='Configure Netfraggle', |
| 58 |
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
| 59 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
| 61 |
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
| 62 |
kind=wxITEM_NORMAL) |
kind=wxITEM_NORMAL) |
| 63 |
|
|
|
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) |
|
|
|
|
| 64 |
def _init_coll_menuBar1_Menus(self, parent): |
def _init_coll_menuBar1_Menus(self, parent): |
| 65 |
# generated method, don't edit |
# generated method, don't edit |
| 66 |
|
|
| 67 |
parent.Append(menu=self.menu1, title='File') |
parent.Append(menu=self.menu1, title='&File') |
| 68 |
parent.Append(menu=self.menu2, title='Help') |
parent.Append(menu=self.menu2, title='&Help') |
| 69 |
|
|
| 70 |
def _init_utils(self): |
def _init_utils(self): |
| 71 |
# generated method, don't edit |
# generated method, don't edit |
| 73 |
self.menuBar1.SetAutoLayout(1) |
self.menuBar1.SetAutoLayout(1) |
| 74 |
|
|
| 75 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
|
self._init_coll_menu1_Items(self.menu1) |
|
| 76 |
|
|
| 77 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
|
self._init_coll_menu2_Items(self.menu2) |
|
| 78 |
|
|
| 79 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
| 80 |
|
self._init_coll_menu1_Items(self.menu1) |
| 81 |
|
self._init_coll_menu2_Items(self.menu2) |
| 82 |
|
|
| 83 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
| 84 |
# generated method, don't edit |
# generated method, don't edit |
| 85 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
| 86 |
name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313), |
name='fraggleViewport', parent=prnt, pos=wxPoint(338, 296), |
| 87 |
size=wxSize(683, 307), |
size=wxSize(435, 296), |
| 88 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
| 89 |
title='wxMDIParentFrame1') |
title='NetFraggle 0.0.1') |
| 90 |
self._init_utils() |
self._init_utils() |
| 91 |
self.SetClientSize(wxSize(683, 284)) |
self.SetClientSize(wxSize(427, 269)) |
| 92 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
| 93 |
|
|
| 94 |
def __init_preferences__(self): |
def __init_preferences__(self): |
| 96 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
| 97 |
self.dialogPrefs.loadConfig() |
self.dialogPrefs.loadConfig() |
| 98 |
self.dialogPrefs.updateConfig() |
self.dialogPrefs.updateConfig() |
| 99 |
|
|
| 100 |
|
# new as of 2004-08-26: TopicFrame |
| 101 |
|
self.topicFrame = FraggleTopicFrame.create(self) |
| 102 |
|
self.topicFrame.Move(wxPoint(10, 10)) |
| 103 |
|
|
| 104 |
|
#frame.Show() |
| 105 |
|
#frame.Destroy() |
| 106 |
|
def __init_xmlrpc__(self): |
| 107 |
|
self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
| 108 |
|
|
| 109 |
|
def __init_taskbar_icon__(self): |
| 110 |
|
if os.name == 'posix': |
| 111 |
|
pass |
| 112 |
|
elif os.name == 'nt': |
| 113 |
|
self.tbicon = wxTaskBarIcon() |
| 114 |
|
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
| 115 |
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
| 116 |
|
self.tbicon.SetIcon(icon, '') |
| 117 |
|
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
| 118 |
|
EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
| 119 |
|
|
| 120 |
|
#EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
| 121 |
|
# self.OnUpdateButtonButton) |
| 122 |
|
|
| 123 |
def __init__(self, parent): |
def __init__(self, parent): |
| 124 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 125 |
self.__init_preferences__() |
self.__init_preferences__() |
| 126 |
|
self.__init_taskbar_icon__() |
| 127 |
def showPrefs(self, event): |
self.__init_xmlrpc__() |
| 128 |
"""Show preferences screen""" |
|
| 129 |
|
def OnMenu1items0Menu(self, event): |
| 130 |
try: |
try: |
| 131 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
| 132 |
finally: |
finally: |
| 133 |
self.dialogPrefs.Destroy() |
self.dialogPrefs.Hide() |
| 134 |
#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() |
|
| 135 |
|
|
| 136 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
| 137 |
self.doExit() |
self.Destroy() |
| 138 |
|
event.Skip() |
| 139 |
|
|
| 140 |
|
|
| 141 |
def OnMenu2items0Menu(self, event): |
def OnMenu2items0Menu(self, event): |
| 142 |
self.showHelp() |
try: |
| 143 |
|
self.dialogPrefs.ShowModal() |
| 144 |
|
finally: |
| 145 |
|
pass |
| 146 |
|
event.Skip() |
| 147 |
|
|
| 148 |
def OnMenu2items1Menu(self, event): |
def OnMenu2items1Menu(self, event): |
| 149 |
self.showAbout() |
"""Show about screen""" |
| 150 |
|
dlg = FraggleAboutDialog.create(self) |
| 151 |
class fraggleMainWin(fraggleViewport): |
dlg.ShowModal() |
| 152 |
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): |
|
| 153 |
|
|
| 154 |
if os.name == 'posix': |
def OnTaskBarLeftDClick(self, event): |
| 155 |
super(fraggleMainWin, self)._init_coll_menu2_Items(parent) |
#event.Skip() |
| 156 |
elif os.name == 'nt': |
#self.SetFocus() |
| 157 |
parent.Append(wxID_FRAGGLEVIEWPORTMENU2CONT, 'Contents', "", wxITEM_NORMAL) |
self.Restore() |
| 158 |
parent.Append(wxID_FRAGGLEVIEWPORTMENU2ABOUT, 'About', "", wxITEM_NORMAL) |
|
| 159 |
|
def OnTaskBarRightClick(self, event): |
| 160 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) |
event.Skip() |
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) |
|
| 161 |
|
|
| 162 |
|
def OnButtonsyncButton(self, event): |
| 163 |
|
fragglexml = self.xml_rpc.FraggleSync() |
| 164 |
|
print fragglexml |
| 165 |
|
#text = fragglexml.data |
| 166 |
|
self.styledTextCtrl1.AddText(fragglexml) |
| 167 |
|
event.Skip() |