This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
XiboOfflineDownloadUI.py
executable file
·296 lines (255 loc) · 13.9 KB
/
XiboOfflineDownloadUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Wed Mar 6 17:54:42 2013
import wx
# begin wxGlade: extracode
# end wxGlade
class XiboOfflineDownloadUI(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: XiboOfflineDownloadUI.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.Tabs = wx.Notebook(self, -1, style=0)
self.Tabs_Displays = wx.Panel(self.Tabs, -1)
self.Tabs_Download = wx.Panel(self.Tabs, -1)
self.selectedDisplays = wx.ListBox(self.Tabs_Download, -1, choices=[], style=wx.LB_MULTIPLE|wx.LB_ALWAYS_SB)
self.lblSelection = wx.StaticText(self.Tabs_Download, -1, _("Selection:"))
self.btnAll = wx.Button(self.Tabs_Download, -1, _("All"))
self.btnNone = wx.Button(self.Tabs_Download, -1, _("None"))
self.btnInvert = wx.Button(self.Tabs_Download, -1, _("Invert"))
self.lblDisplays = wx.StaticText(self.Tabs_Download, -1, _("Displays:"))
self.btnAdd = wx.Button(self.Tabs_Download, -1, _("Add"))
self.btnRemove = wx.Button(self.Tabs_Download, -1, _("Delete"))
self.panel_3 = wx.Panel(self.Tabs_Download, -1)
self.txtOutput = wx.TextCtrl(self.Tabs_Download, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_LINEWRAP)
self.btnDownload = wx.Button(self.Tabs_Download, -1, _("Download"))
self.btnCancel = wx.Button(self.Tabs_Download, -1, _("Cancel"))
self.gaProgress = wx.Gauge(self.Tabs_Download, -1, 100, style=wx.GA_HORIZONTAL|wx.GA_SMOOTH)
self.lblServerURL = wx.StaticText(self.Tabs_Displays, -1, _("Server URL"), style=wx.ALIGN_RIGHT)
self.txtServerURL = wx.TextCtrl(self.Tabs_Displays, -1, "")
self.lblServerKey = wx.StaticText(self.Tabs_Displays, -1, _("Server Key"), style=wx.ALIGN_RIGHT)
self.txtServerKey = wx.TextCtrl(self.Tabs_Displays, -1, "")
self.lblChunkSize = wx.StaticText(self.Tabs_Displays, -1, _("Download Chunk Size"), style=wx.ALIGN_RIGHT)
self.txtChunkSize = wx.TextCtrl(self.Tabs_Displays, -1, "")
self.lblVerbose = wx.StaticText(self.Tabs_Displays, -1, _("Verbose Output"), style=wx.ALIGN_RIGHT)
self.chkVerbose = wx.CheckBox(self.Tabs_Displays, -1, "")
self.panel_4 = wx.Panel(self.Tabs_Displays, -1)
self.btnExport = wx.Button(self.Tabs_Displays, -1, _("Export"))
self.btnImport = wx.Button(self.Tabs_Displays, -1, _("Import"))
self.btnSave = wx.Button(self.Tabs_Displays, -1, _("Save"))
self.lnHorizontalLine = wx.StaticLine(self, -1)
self.Logo = wx.StaticBitmap(self, -1, wx.Bitmap("logo.jpg", wx.BITMAP_TYPE_ANY), style=wx.SUNKEN_BORDER)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_LISTBOX_DCLICK, self.onDisplayListDClick, self.selectedDisplays)
self.Bind(wx.EVT_LISTBOX, self.onDisplayListClick, self.selectedDisplays)
self.Bind(wx.EVT_BUTTON, self.onSelectAll, self.btnAll)
self.Bind(wx.EVT_BUTTON, self.onSelectNone, self.btnNone)
self.Bind(wx.EVT_BUTTON, self.onSelectInvert, self.btnInvert)
self.Bind(wx.EVT_BUTTON, self.onAddDisplay, self.btnAdd)
self.Bind(wx.EVT_BUTTON, self.onDeleteDisplay, self.btnRemove)
self.Bind(wx.EVT_BUTTON, self.onDownload, self.btnDownload)
self.Bind(wx.EVT_BUTTON, self.onCancel, self.btnCancel)
self.Bind(wx.EVT_TEXT, self.onServerUrlChange, self.txtServerURL)
self.Bind(wx.EVT_TEXT, self.onServerKeyChange, self.txtServerKey)
self.Bind(wx.EVT_TEXT, self.onChunkSizeChange, self.txtChunkSize)
self.Bind(wx.EVT_CHECKBOX, self.onVerboseChange, self.chkVerbose)
self.Bind(wx.EVT_BUTTON, self.onConfigExport, self.btnExport)
self.Bind(wx.EVT_BUTTON, self.onConfigImport, self.btnImport)
self.Bind(wx.EVT_BUTTON, self.onConfigSave, self.btnSave)
# end wxGlade
def __set_properties(self):
# begin wxGlade: XiboOfflineDownloadUI.__set_properties
self.SetTitle(_("Xibo Offline Download Application"))
self.SetSize((750, 500))
self.selectedDisplays.SetMinSize((350, 300))
self.btnRemove.Enable(False)
self.txtOutput.SetMinSize((369, 300))
self.btnDownload.Enable(False)
self.btnDownload.SetDefault()
self.btnCancel.Enable(False)
self.gaProgress.SetToolTipString(_("Download Progress"))
self.txtChunkSize.SetToolTipString(_("How large in bytes should each download segment be from the server"))
self.btnSave.Enable(False)
# end wxGlade
def __do_layout(self):
# begin wxGlade: XiboOfflineDownloadUI.__do_layout
frmMainSizer = wx.BoxSizer(wx.VERTICAL)
grid_sizer_2 = wx.FlexGridSizer(4, 2, 2, 2)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
tabDownloadSizer = wx.BoxSizer(wx.HORIZONTAL)
sizer_6 = wx.BoxSizer(wx.VERTICAL)
sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.FlexGridSizer(2, 4, 2, 2)
sizer_5.Add(self.selectedDisplays, 0, 0, 0)
grid_sizer_1.Add(self.lblSelection, 0, 0, 0)
grid_sizer_1.Add(self.btnAll, 0, 0, 0)
grid_sizer_1.Add(self.btnNone, 0, 0, 0)
grid_sizer_1.Add(self.btnInvert, 0, 0, 0)
grid_sizer_1.Add(self.lblDisplays, 0, 0, 0)
grid_sizer_1.Add(self.btnAdd, 0, 0, 0)
grid_sizer_1.Add(self.btnRemove, 0, 0, 0)
grid_sizer_1.Add(self.panel_3, 1, wx.EXPAND, 0)
grid_sizer_1.AddGrowableCol(0)
sizer_5.Add(grid_sizer_1, 1, wx.EXPAND, 10)
tabDownloadSizer.Add(sizer_5, 1, 0, 0)
tabDownloadSizer.Add((5, 20), 0, wx.EXPAND, 0)
sizer_6.Add(self.txtOutput, 0, 0, 0)
sizer_7.Add(self.btnDownload, 0, 0, 0)
sizer_7.Add(self.btnCancel, 0, 0, 0)
sizer_6.Add(sizer_7, 1, wx.ALIGN_RIGHT, 0)
sizer_6.Add(self.gaProgress, 0, wx.EXPAND, 0)
tabDownloadSizer.Add(sizer_6, 1, wx.EXPAND, 0)
tabDownloadSizer.Add((5, 20), 0, wx.EXPAND, 0)
self.Tabs_Download.SetSizer(tabDownloadSizer)
grid_sizer_2.Add(self.lblServerURL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.txtServerURL, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.lblServerKey, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.txtServerKey, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.lblChunkSize, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.txtChunkSize, 0, 0, 0)
grid_sizer_2.Add(self.lblVerbose, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.chkVerbose, 0, 0, 0)
grid_sizer_2.Add(self.panel_4, 1, wx.EXPAND, 0)
sizer_2.Add(self.btnExport, 0, 0, 0)
sizer_2.Add(self.btnImport, 0, 0, 0)
sizer_2.Add((20, 5), 1, 0, 0)
sizer_2.Add(self.btnSave, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(sizer_2, 2, wx.EXPAND, 3)
self.Tabs_Displays.SetSizer(grid_sizer_2)
grid_sizer_2.AddGrowableCol(1)
self.Tabs.AddPage(self.Tabs_Download, _("Download"))
self.Tabs.AddPage(self.Tabs_Displays, _("Configuration"))
frmMainSizer.Add(self.Tabs, 1, wx.EXPAND, 0)
frmMainSizer.Add(self.lnHorizontalLine, 0, wx.EXPAND, 0)
frmMainSizer.Add(self.Logo, 0, wx.ALL|wx.EXPAND|wx.ALIGN_BOTTOM, 0)
self.SetSizer(frmMainSizer)
self.Layout()
# end wxGlade
def onDisplayListDClick(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onDisplayListDClick' not implemented!"
event.Skip()
def onDisplayListClick(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onDisplayListClick' not implemented!"
event.Skip()
def onSelectAll(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onSelectAll' not implemented!"
event.Skip()
def onSelectNone(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onSelectNone' not implemented!"
event.Skip()
def onSelectInvert(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onSelectInvert' not implemented!"
event.Skip()
def onAddDisplay(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onAddDisplay' not implemented!"
event.Skip()
def onDeleteDisplay(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onDeleteDisplay' not implemented!"
event.Skip()
def onDownload(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onDownload' not implemented!"
event.Skip()
def onCancel(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onCancel' not implemented!"
event.Skip()
def onServerUrlChange(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onServerUrlChange' not implemented!"
event.Skip()
def onServerKeyChange(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onServerKeyChange' not implemented!"
event.Skip()
def onChunkSizeChange(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onChunkSizeChange' not implemented!"
event.Skip()
def onVerboseChange(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onVerboseChange' not implemented!"
event.Skip()
def onConfigExport(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onConfigExport' not implemented!"
event.Skip()
def onConfigImport(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onConfigImport' not implemented!"
event.Skip()
def onConfigSave(self, event): # wxGlade: XiboOfflineDownloadUI.<event_handler>
print "Event handler `onConfigSave' not implemented!"
event.Skip()
# end of class XiboOfflineDownloadUI
class AddDisplayUI(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: AddDisplayUI.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP
wx.Dialog.__init__(self, *args, **kwds)
self.lblClientName = wx.StaticText(self, -1, _("Client Name"))
self.txtClientName = wx.TextCtrl(self, -1, "")
self.lblClientKey = wx.StaticText(self, -1, _("Client Key"))
self.txtClientKey = wx.TextCtrl(self, -1, "")
self.panel_1 = wx.Panel(self, -1)
self.btnCreateDisplay = wx.Button(self, -1, _("Add Display"))
self.btnGenerateKey = wx.Button(self, -1, _("Generate Key"))
self.btnCancel = wx.Button(self, -1, _("Cancel"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT, self.onClientNameChange, self.txtClientName)
self.Bind(wx.EVT_TEXT, self.onClientKeyChange, self.txtClientKey)
self.Bind(wx.EVT_BUTTON, self.onCreateDisplay, self.btnCreateDisplay)
self.Bind(wx.EVT_BUTTON, self.onGenerateKey, self.btnGenerateKey)
self.Bind(wx.EVT_BUTTON, self.onCancel, self.btnCancel)
# end wxGlade
def __set_properties(self):
# begin wxGlade: AddDisplayUI.__set_properties
self.SetTitle(_("Add Display"))
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(wx.Bitmap("xibo.ico", wx.BITMAP_TYPE_ANY))
self.SetIcon(_icon)
self.txtClientName.SetToolTipString(_("The name of the client to add as it will appear on the server"))
self.btnCreateDisplay.Enable(False)
self.btnGenerateKey.SetToolTipString(_("Generate a random client license key"))
# end wxGlade
def __do_layout(self):
# begin wxGlade: AddDisplayUI.__do_layout
grid_sizer_3 = wx.FlexGridSizer(3, 3, 0, 0)
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_3.Add(self.lblClientName, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add((20, 20), 0, 0, 0)
grid_sizer_3.Add(self.txtClientName, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add(self.lblClientKey, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add((20, 20), 0, 0, 0)
grid_sizer_3.Add(self.txtClientKey, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add(self.panel_1, 1, wx.EXPAND, 0)
grid_sizer_3.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.btnCreateDisplay, 0, 0, 0)
sizer_1.Add(self.btnGenerateKey, 0, 0, 0)
sizer_1.Add(self.btnCancel, 0, 0, 0)
grid_sizer_3.Add(sizer_1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
self.SetSizer(grid_sizer_3)
grid_sizer_3.Fit(self)
grid_sizer_3.AddGrowableCol(2)
self.Layout()
# end wxGlade
def onClientNameChange(self, event): # wxGlade: AddDisplayUI.<event_handler>
print "Event handler `onClientNameChange' not implemented!"
event.Skip()
def onClientKeyChange(self, event): # wxGlade: AddDisplayUI.<event_handler>
print "Event handler `onClientKeyChange' not implemented!"
event.Skip()
def onCreateDisplay(self, event): # wxGlade: AddDisplayUI.<event_handler>
print "Event handler `onCreateDisplay' not implemented!"
event.Skip()
def onGenerateKey(self, event): # wxGlade: AddDisplayUI.<event_handler>
print "Event handler `onGenerateKey' not implemented!"
event.Skip()
def onCancel(self, event): # wxGlade: AddDisplayUI.<event_handler>
print "Event handler `onCancel' not implemented!"
event.Skip()
# end of class AddDisplayUI
if __name__ == "__main__":
import gettext
gettext.install("app") # replace with the appropriate catalog name
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frmMain = XiboOfflineDownloadUI(None, -1, "")
app.SetTopWindow(frmMain)
frmMain.Show()
app.MainLoop()