| 2 |
|
|
| 3 |
# $Id$ |
# $Id$ |
| 4 |
# $Log$ |
# $Log$ |
| 5 |
|
# Revision 1.13 2004/08/27 03:25:44 joko |
| 6 |
|
# added FraggleTaskBarMenu |
| 7 |
|
# |
| 8 |
|
# Revision 1.12 2004/08/27 00:05:22 joko |
| 9 |
|
# fix for icon-path and wxTaskBarIcon-events |
| 10 |
|
# |
| 11 |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
| 12 |
# xmlrpc class added |
# xmlrpc class added |
| 13 |
# |
# |
| 24 |
from wxPython.wx import * |
from wxPython.wx import * |
| 25 |
from wxPython.stc import * |
from wxPython.stc import * |
| 26 |
|
|
| 27 |
|
from fraggleConstants import * |
| 28 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
| 29 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
| 30 |
import FraggleAboutDialog |
import FraggleAboutDialog |
| 34 |
def create(parent): |
def create(parent): |
| 35 |
return fraggleViewport(parent) |
return fraggleViewport(parent) |
| 36 |
|
|
| 37 |
[wxID_FRAGGLEVIEWPORT, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
|
wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
|
|
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
|
| 38 |
|
|
| 39 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
| 40 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
| 45 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
| 46 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
| 47 |
|
|
| 48 |
|
[wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
| 49 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
| 50 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
| 51 |
|
] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3)) |
| 52 |
|
|
| 53 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
| 54 |
|
def _init_coll_FraggleTaskBarMenu_Items(self, parent): |
| 55 |
|
# generated method, don't edit |
| 56 |
|
|
| 57 |
|
restore = parent.Append(helpString='Restore', |
| 58 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
| 59 |
|
item='Restore', kind=wxITEM_NORMAL) |
| 60 |
|
parent.Append(helpString='Sync enabled', |
| 61 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
| 62 |
|
item='Sync enabled', kind=wxITEM_CHECK) |
| 63 |
|
parent.Append(helpString='Exit', |
| 64 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit', |
| 65 |
|
kind=wxITEM_NORMAL) |
| 66 |
|
#EVT_MENU_OPEN(restore, |
| 67 |
|
# self.OnFraggleTaskBarMenuItemsrestoreMenu) |
| 68 |
|
#EVT_MENU_OPEN(restore, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
| 69 |
|
# self.OnFraggleTaskBarMenuItemsrestoreMenu) |
| 70 |
|
#EVT_MENU(self, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
| 71 |
|
# self.OnFraggleTaskBarMenuItemsexitMenu) |
| 72 |
|
|
| 73 |
def _init_coll_menu2_Items(self, parent): |
def _init_coll_menu2_Items(self, parent): |
| 74 |
# generated method, don't edit |
# generated method, don't edit |
| 75 |
|
|
| 100 |
self.menuBar1.SetAutoLayout(1) |
self.menuBar1.SetAutoLayout(1) |
| 101 |
|
|
| 102 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
|
self._init_coll_menu1_Items(self.menu1) |
|
| 103 |
|
|
| 104 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
| 105 |
self._init_coll_menu2_Items(self.menu2) |
|
| 106 |
|
self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle') |
| 107 |
|
|
| 108 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
| 109 |
|
self._init_coll_menu1_Items(self.menu1) |
| 110 |
|
self._init_coll_menu2_Items(self.menu2) |
| 111 |
|
self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu) |
| 112 |
|
|
| 113 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
| 114 |
# generated method, don't edit |
# generated method, don't edit |
| 115 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
| 116 |
name='fraggleViewport', parent=prnt, pos=wxPoint(525, 292), |
name='fraggleViewport', parent=prnt, pos=wxPoint(338, 296), |
| 117 |
size=wxSize(341, 296), |
size=wxSize(435, 296), |
| 118 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
| 119 |
title='NetFraggle 0.0.1') |
title='NetFraggle 0.0.1') |
| 120 |
self._init_utils() |
self._init_utils() |
| 121 |
self.SetClientSize(wxSize(341, 273)) |
self.SetClientSize(wxSize(427, 269)) |
| 122 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
| 123 |
|
|
|
self.buttonsync = wxButton(id=wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
|
|
label='Sync', name='buttonsync', parent=self, pos=wxPoint(104, |
|
|
240), size=wxSize(136, 24), style=0) |
|
|
EVT_BUTTON(self.buttonsync, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
|
|
self.OnButtonsyncButton) |
|
|
|
|
|
self.styledTextCtrl1 = wxStyledTextCtrl(id=wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
|
|
name='styledTextCtrl1', parent=self, pos=wxPoint(8, 16), |
|
|
size=wxSize(328, 216), style=0) |
|
|
|
|
| 124 |
def __init_preferences__(self): |
def __init_preferences__(self): |
| 125 |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
| 126 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
| 128 |
self.dialogPrefs.updateConfig() |
self.dialogPrefs.updateConfig() |
| 129 |
|
|
| 130 |
# new as of 2004-08-26: TopicFrame |
# new as of 2004-08-26: TopicFrame |
| 131 |
self.topicFrame = FraggleTopicFrame.create(self) |
# new as of 2004-08-27: pass configList to TopicFrame |
| 132 |
|
self.topicFrame = FraggleTopicFrame.create(self, self.preferencesCtl.configList) |
| 133 |
self.topicFrame.Move(wxPoint(10, 10)) |
self.topicFrame.Move(wxPoint(10, 10)) |
| 134 |
|
|
| 135 |
#frame.Show() |
#frame.Show() |
| 136 |
#frame.Destroy() |
#frame.Destroy() |
| 137 |
def __init_xmlrpc__(self): |
def __init_xmlrpc__(self): |
| 138 |
self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
#self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
| 139 |
|
pass |
| 140 |
|
|
| 141 |
def __init_taskbar_icon__(self): |
def __init_taskbar_icon__(self): |
| 142 |
if os.name == 'posix': |
if os.name == 'posix': |
| 143 |
pass |
pass |
| 144 |
elif os.name == 'nt': |
elif os.name == 'nt': |
| 145 |
self.tbicon = wxTaskBarIcon() |
self.tbicon = wxTaskBarIcon() |
| 146 |
icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
| 147 |
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
| 148 |
self.tbicon.SetIcon(icon, '') |
self.tbicon.SetIcon(icon, '') |
| 149 |
wxEVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
| 150 |
wxEVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
| 151 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore) |
| 152 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit) |
| 153 |
|
|
| 154 |
|
#EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
| 155 |
|
# self.OnUpdateButtonButton) |
| 156 |
|
|
| 157 |
def __init__(self, parent): |
def __init__(self, parent): |
| 158 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 159 |
self.__init_preferences__() |
self.__init_preferences__() |
| 186 |
dlg.Destroy() |
dlg.Destroy() |
| 187 |
|
|
| 188 |
def OnTaskBarLeftDClick(self, event): |
def OnTaskBarLeftDClick(self, event): |
| 189 |
event.Skip() |
#event.Skip() |
| 190 |
|
#self.SetFocus() |
| 191 |
|
if self.IsIconized(): |
| 192 |
|
self.Restore() |
| 193 |
|
else: |
| 194 |
|
self.Iconize() |
| 195 |
|
|
| 196 |
def OnTaskBarRightClick(self, event): |
def OnTaskBarRightClick(self, event): |
|
event.Skip() |
|
|
|
|
|
def OnButtonsyncButton(self, event): |
|
|
fragglexml = self.xml_rpc.FraggleSync() |
|
|
print fragglexml |
|
|
import codecs |
|
|
(UTF8_encode, UTF8_decode, |
|
|
UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8') |
|
|
text = UTF8_decode(repr(fragglexml))[0] |
|
|
text = fragglexml.data |
|
|
self.styledTextCtrl1.AddText(text) |
|
|
event.Skip() |
|
| 197 |
|
#event.Skip() |
| 198 |
|
self.tbicon.PopupMenu(self.FraggleTaskBarMenu) |
| 199 |
|
|
| 200 |
|
def OnTaskBarAppRestore(self, event): |
| 201 |
|
self.Restore() |
| 202 |
|
#event.Skip() |
| 203 |
|
|
| 204 |
|
def OnTaskBarAppExit(self, event): |
| 205 |
|
#event.Skip() |
| 206 |
|
#self.Destroy() |
| 207 |
|
self.Close(True) |
| 208 |
|
|