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