def __init__(self, parent, message, title, ButtonLabels=['OK'],onHelp=None,helpEmailAddress="*****@*****.**",q=None,**kw): wx.Dialog.__init__(self, parent, style=wx.DEFAULT_DIALOG_STYLE, **kw) if parent!=None: self.CenterOnParent() else: self.Centre() self.helpEmailAddress = helpEmailAddress if not sys.platform.startswith("darwin"): self.SetTitle(title) if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) elif sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) self.dialogPanel = wx.Panel(self, wx.ID_ANY) self.dialogPanel.SetSizer(wx.FlexGridSizer(cols=2,rows=2,vgap=0,hgap=0)) #self.dialogPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) self.ButtonLabels=ButtonLabels self.onHelp=onHelp iconAsBitmap = IconPys.MASSIVElogoTransparent64x64.getMASSIVElogoTransparent64x64Bitmap() self.iconBitmap = wx.StaticBitmap(self.dialogPanel, wx.ID_ANY, iconAsBitmap, pos=(25,15), size=(64,64)) smallFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): smallFont.SetPointSize(11) self.messagePanel = wx.Panel(self.dialogPanel) if sys.platform.startswith("darwin"): self.messagePanel.SetSizer(wx.FlexGridSizer(cols=1,rows=2)) self.titleLabel = wx.StaticText(self.messagePanel, wx.ID_ANY, title) titleFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) titleFont.SetWeight(wx.BOLD) titleFont.SetPointSize(13) self.titleLabel.SetFont(titleFont) self.messagePanel.GetSizer().Add(self.titleLabel,flag=wx.BOTTOM,border=10) else: self.messagePanel.SetSizer(wx.FlexGridSizer(cols=1,rows=1,vgap=0,hgap=0)) messageWidth = 330 self.messageLabel = wx.StaticText(self.messagePanel, wx.ID_ANY, message) self.messageLabel.SetForegroundColour((0,0,0)) self.messageLabel.SetFont(smallFont) self.messageLabel.Wrap(messageWidth) self.messagePanel.GetSizer().Add(self.messageLabel) contactPanel = wx.Panel(self.dialogPanel) contactPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) contactQueriesContactLabel = wx.StaticText(contactPanel, label = "For queries, please contact:") contactQueriesContactLabel.SetFont(smallFont) contactQueriesContactLabel.SetForegroundColour(wx.Colour(0,0,0)) contactPanel.GetSizer().Add(contactQueriesContactLabel) contactEmailHyperlink = wx.adv.HyperlinkCtrl(contactPanel, id = wx.ID_ANY, label = self.helpEmailAddress, url = "mailto:"+self.helpEmailAddress) contactEmailHyperlink.SetFont(smallFont) #hyperlinkPosition = wx.Point(self.contactQueriesContactLabel.GetPosition().x+self.contactQueriesContactLabel.GetSize().width+10,okButtonPosition.y) #hyperlinkPosition = wx.Point(self.contactQueriesContactLabel.GetPosition().x+self.contactQueriesContactLabel.GetSize().width,buttonPosition.y) #self.contactEmailHyperlink.SetPosition(hyperlinkPosition) contactPanel.GetSizer().Add(contactEmailHyperlink) contactPanel.GetSizer().Fit(contactPanel) buttonPanel = wx.Panel(self.dialogPanel,wx.ID_ANY) buttonPanel.SetSizer(wx.BoxSizer(wx.HORIZONTAL)) for label in ButtonLabels: b = wx.Button(buttonPanel, wx.ID_ANY, label) b.SetDefault() b.Bind(wx.EVT_BUTTON,self.onClose) buttonPanel.GetSizer().Add(b,flag=wx.ALL,border=5) if self.onHelp is not None: b = wx.Button(buttonPanel, wx.ID_ANY, 'Help') b.Bind(wx.EVT_BUTTON,self.onHelp) buttonPanel.GetSizer().Add(b,flag=wx.ALL,border=5) buttonPanel.GetSizer().Fit(buttonPanel) self.dialogPanel.GetSizer().Add(self.iconBitmap,flag=wx.ALL,border=15) self.dialogPanel.GetSizer().Add(self.messagePanel,flag=wx.ALL,border=15) self.dialogPanel.GetSizer().Add(contactPanel,flag=wx.ALL,border=15) self.dialogPanel.GetSizer().Add(buttonPanel,flag=wx.ALL,border=15) self.Bind(wx.EVT_CLOSE, self.onClose) self.q=q self.dialogPanel.GetSizer().Fit(self.dialogPanel) #self.SetClientSize(wx.Size(dialogPanelWidth,dialogPanelHeight)) self.Layout() self.Fit()
def __init__(self, parent, message, title, ButtonLabels=['OK'], onHelp=None, helpEmailAddress="*****@*****.**", q=None, **kw): wx.Dialog.__init__(self, parent, style=wx.DEFAULT_DIALOG_STYLE, **kw) if parent != None: self.CenterOnParent() else: self.Centre() self.helpEmailAddress = helpEmailAddress if not sys.platform.startswith("darwin"): self.SetTitle(title) if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) elif sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) self.dialogPanel = wx.Panel(self, wx.ID_ANY) self.dialogPanel.SetSizer(wx.FlexGridSizer(cols=2, rows=2)) #self.dialogPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) self.ButtonLabels = ButtonLabels self.onHelp = onHelp iconAsBitmap = IconPys.MASSIVElogoTransparent64x64.getMASSIVElogoTransparent64x64Bitmap( ) self.iconBitmap = wx.StaticBitmap(self.dialogPanel, wx.ID_ANY, iconAsBitmap, pos=(25, 15), size=(64, 64)) smallFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): smallFont.SetPointSize(11) self.messagePanel = wx.Panel(self.dialogPanel) if sys.platform.startswith("darwin"): self.messagePanel.SetSizer(wx.FlexGridSizer(cols=1, rows=2)) self.titleLabel = wx.StaticText(self.messagePanel, wx.ID_ANY, title) titleFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) titleFont.SetWeight(wx.BOLD) titleFont.SetPointSize(13) self.titleLabel.SetFont(titleFont) self.messagePanel.GetSizer().Add(self.titleLabel, flag=wx.BOTTOM, border=10) else: self.messagePanel.SetSizer(wx.FlexGridSizer(cols=1, rows=1)) messageWidth = 330 self.messageLabel = wx.StaticText(self.messagePanel, wx.ID_ANY, message) self.messageLabel.SetForegroundColour((0, 0, 0)) self.messageLabel.SetFont(smallFont) self.messageLabel.Wrap(messageWidth) self.messagePanel.GetSizer().Add(self.messageLabel) contactPanel = wx.Panel(self.dialogPanel) contactPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) contactQueriesContactLabel = wx.StaticText( contactPanel, label="For queries, please contact:") contactQueriesContactLabel.SetFont(smallFont) contactQueriesContactLabel.SetForegroundColour(wx.Colour(0, 0, 0)) contactPanel.GetSizer().Add(contactQueriesContactLabel) contactEmailHyperlink = wx.HyperlinkCtrl(contactPanel, id=wx.ID_ANY, label=self.helpEmailAddress, url="mailto:" + self.helpEmailAddress) contactEmailHyperlink.SetFont(smallFont) #hyperlinkPosition = wx.Point(self.contactQueriesContactLabel.GetPosition().x+self.contactQueriesContactLabel.GetSize().width+10,okButtonPosition.y) #hyperlinkPosition = wx.Point(self.contactQueriesContactLabel.GetPosition().x+self.contactQueriesContactLabel.GetSize().width,buttonPosition.y) #self.contactEmailHyperlink.SetPosition(hyperlinkPosition) contactPanel.GetSizer().Add(contactEmailHyperlink) contactPanel.Fit() buttonPanel = wx.Panel(self.dialogPanel, wx.ID_ANY) buttonPanel.SetSizer(wx.BoxSizer(wx.HORIZONTAL)) for label in ButtonLabels: b = wx.Button(buttonPanel, wx.ID_ANY, label) b.SetDefault() b.Bind(wx.EVT_BUTTON, self.onClose) buttonPanel.GetSizer().Add(b, flag=wx.ALL, border=5) if self.onHelp is not None: b = wx.Button(buttonPanel, wx.ID_ANY, 'Help') b.Bind(wx.EVT_BUTTON, self.onHelp) buttonPanel.GetSizer().Add(b, flag=wx.ALL, border=5) buttonPanel.Fit() self.dialogPanel.GetSizer().Add(self.iconBitmap, flag=wx.ALL, border=15) self.dialogPanel.GetSizer().Add(self.messagePanel, flag=wx.ALL, border=15) self.dialogPanel.GetSizer().Add(contactPanel, flag=wx.ALL, border=15) self.dialogPanel.GetSizer().Add(buttonPanel, flag=wx.ALL, border=15) self.Bind(wx.EVT_CLOSE, self.onClose) self.q = q self.dialogPanel.Fit() #self.SetClientSize(wx.Size(dialogPanelWidth,dialogPanelHeight)) self.Layout() self.Fit()
def __init__(self, *args, **kw): super(HelpDialog, self).__init__(*args, **kw) self.callback = None if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) self.CenterOnParent() iconPanel = wx.Panel(self) import MASSIVE_icon iconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap() wx.StaticBitmap(iconPanel, wx.ID_ANY, iconAsBitmap, (0, 25), (iconAsBitmap.GetWidth(), iconAsBitmap.GetHeight())) sizer = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5) contactPanel = wx.Panel(self) contactPanelSizer = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5) contactPanel.SetSizer(contactPanelSizer) contactQueriesContactLabel = wx.StaticText( contactPanel, label="For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) contactQueriesContactLabel.SetFont(font) contactEmailHyperlink = wx.HyperlinkCtrl( contactPanel, id=wx.ID_ANY, label="*****@*****.**", url="mailto:[email protected]") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) # contactPanelSizer.Add(wx.StaticText(contactPanel, wx.ID_ANY, "")) contactPanelSizer.Add(contactQueriesContactLabel, border=10, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) contactPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM) #contactPanelSizer.Add(wx.StaticText(contactPanel)) contactPanelSizer.Fit(contactPanel) okButton = wx.Button(self, 1, ' OK ') okButton.SetDefault() okButton.Bind(wx.EVT_BUTTON, self.OnClose) sizer.Add(iconPanel, flag=wx.EXPAND | wx.ALIGN_TOP | wx.ALIGN_LEFT) sizer.Add(contactPanel) sizer.Add(okButton, flag=wx.RIGHT | wx.BOTTOM) #sizer.Add(wx.StaticText(self,label=" ")) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, *args, **kw): if kw.has_key('parent'): self.parent = kw.get('parent') logger.debug("ListSelectionDialog: parent is not None.") logger.debug("ListSelectionDialog: parent class name is " + self.parent.__class__.__name__) else: self.parent = None logger.debug("ListSelectionDialog: parent is None.") if kw.has_key('progressDialog'): self.progressDialog = kw.pop('progressDialog') else: self.progressDialog = None if kw.has_key('headers'): self.headers = kw.pop('headers') else: self.headers = None if kw.has_key('items'): self.items = kw.pop('items') else: self.items = None if kw.has_key('message'): self.message = kw.pop('message') else: self.message = None if kw.has_key('noSelectionMessage'): self.noSelectionMessage = kw.pop('noSelectionMessage') else: self.noSelectionMessage = "Please select a valid item from the list.", if kw.has_key('okCallback'): self.okCallback = kw.pop('okCallback') else: logger.debug("okCallback set to none") self.okCallback = None if kw.has_key('cancelCallback'): self.cancelCallback = kw.pop('cancelCallback') else: logger.debug("cancelCallback set to none") self.cancelCallback = None if kw.has_key('helpEmailAddress'): self.helpEmailAddress = kw.pop('helpEmailAddress') else: logger.debug("helpEmailAddress set to none") self.helpEmailAddress = "*****@*****.**" super(ListSelectionDialog, self).__init__(*args, **kw) self.itemList = [] self.closedProgressDialog = False if self.progressDialog is not None: self.progressDialog.Show(False) self.closedProgressDialog = True self.CenterOnParent() if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) listSelectionDialogPanel = wx.Panel(self) listSelectionDialogSizer = wx.FlexGridSizer(rows=1, cols=1) self.SetSizer(listSelectionDialogSizer) listSelectionDialogSizer.Add(listSelectionDialogPanel, flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=10) iconPanel = wx.Panel(listSelectionDialogPanel) import MASSIVE_icon iconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap() wx.StaticBitmap(iconPanel, wx.ID_ANY, iconAsBitmap, (0, 25), (iconAsBitmap.GetWidth(), iconAsBitmap.GetHeight())) sizer = wx.BoxSizer(wx.HORIZONTAL) lcSizer = wx.BoxSizer(wx.VERTICAL) rcSizer = wx.BoxSizer(wx.VERTICAL) contactPanel = wx.Panel(listSelectionDialogPanel) contactPanelSizer = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5) contactPanel.SetSizer(contactPanelSizer) contactQueriesContactLabel = wx.StaticText( contactPanel, label="For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) contactQueriesContactLabel.SetFont(font) contactEmailHyperlink = wx.HyperlinkCtrl(contactPanel, id=wx.ID_ANY, label=self.helpEmailAddress, url="mailto:" + self.helpEmailAddress) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) contactPanelSizer.Add(contactQueriesContactLabel, border=10, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) contactPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM) contactPanelSizer.Fit(contactPanel) listSelectionPanel = wx.Panel(listSelectionDialogPanel) listSelectionPanelSizer = wx.BoxSizer(wx.VERTICAL) listSelectionPanel.SetSizer(listSelectionPanelSizer) if (self.message != None): messageText = wx.StaticText(parent=listSelectionPanel, id=wx.ID_ANY, label=self.message) listSelectionPanelSizer.Add(messageText, border=5, flag=wx.ALL ^ wx.EXPAND) if (self.headers != None): self.listSelectionList = ListSelectionDialog.ResizeListCtrl( listSelectionPanel, -1, style=wx.LC_REPORT | wx.EXPAND) else: self.listSelectionList = ListSelectionDialog.ResizeListCtrl( listSelectionPanel, -1, style=wx.LC_REPORT | wx.EXPAND | wx.LC_NO_HEADER) col = 0 if (self.headers != None): for hdr in self.headers: self.listSelectionList.InsertColumn(col, hdr, width=-1) col = col + 1 elif (self.items != None): if (len(self.items) > 0 and isinstance(self.items[0], list)): for i in self.items[0]: self.listSelectionList.InsertColumn(col, "", width=-1) else: self.listSelectionList.InsertColumn(col, "", width=-1) if (self.items != None): for item in self.items: if (isinstance(item, list)): self.listSelectionList.Append(item) #self.listSelectionList.InsertStringItem(0,item) else: self.listSelectionList.Append([item]) #self.listSelectionList=wx.ListView(listSelectionPanel,style=wx.LC_REPORT) listSelectionPanelSizer.Add(self.listSelectionList, proportion=1, border=10, flag=wx.EXPAND | wx.ALL) self.buttonsPanel = wx.Panel(listSelectionDialogPanel, wx.ID_ANY) self.buttonsPanelSizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5) self.buttonsPanel.SetSizer(self.buttonsPanelSizer) self.cancelButton = wx.Button(self.buttonsPanel, wx.ID_ANY, 'Cancel') self.cancelButton.SetDefault() self.cancelButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, self.onClose) # Bottom border of 5 is a workaround for an OS X bug where bottom of button can be clipped. self.buttonsPanelSizer.Add(self.cancelButton, flag=wx.BOTTOM, border=5) self.okButton = wx.Button(self.buttonsPanel, wx.ID_ANY, ' OK ') self.okButton.SetDefault() self.okButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, self.onClose) #self.okButton.Disable() # Bottom border of 5 is a workaround for an OS X bug where bottom of button can be clipped. self.buttonsPanelSizer.Add(self.okButton, flag=wx.BOTTOM, border=5) self.buttonsPanel.Fit() #self.listSelectionList.Bind(wx.EVT_LIST_ITEM_SELECTED,self.onFocus) self.listSelectionList.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onClose) lcSizer.Add(iconPanel, proportion=1, flag=wx.EXPAND | wx.ALIGN_TOP | wx.ALIGN_LEFT) lcSizer.Add(contactPanel, proportion=0, flag=wx.ALIGN_LEFT | wx.ALIGN_BOTTOM) rcSizer.Add(listSelectionPanel, proportion=1, flag=wx.EXPAND) #rcSizer.Add(self.okButton,proportion=0,flag=wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM|wx.BOTTOM,border=5) rcSizer.Add(self.buttonsPanel, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) sizer.Add(lcSizer, proportion=0, flag=wx.EXPAND) sizer.Add(rcSizer, proportion=1, flag=wx.EXPAND) listSelectionDialogPanel.SetSizer(sizer) sizer.Fit(listSelectionDialogPanel) self.Fit() self.listSelectionList.SetFocus()
def __init__(self, *args, **kw): super(HelpDialog, self).__init__(*args, **kw) self.callback=None if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) iconPanel = wx.Panel(self) import MASSIVE_icon iconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap() wx.StaticBitmap(iconPanel, wx.ID_ANY, iconAsBitmap, (0, 25), (iconAsBitmap.GetWidth(), iconAsBitmap.GetHeight())) sizer = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5) contactPanel = wx.Panel(self) contactPanelSizer = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5) contactPanel.SetSizer(contactPanelSizer) contactQueriesContactLabel = wx.StaticText(contactPanel, label = "For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) contactQueriesContactLabel.SetFont(font) contactEmailHyperlink = wx.HyperlinkCtrl(contactPanel, id = wx.ID_ANY, label = "*****@*****.**", url = "mailto:[email protected]") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) # contactPanelSizer.Add(wx.StaticText(contactPanel, wx.ID_ANY, "")) contactPanelSizer.Add(contactQueriesContactLabel, border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BORDER) contactPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.BORDER) #contactPanelSizer.Add(wx.StaticText(contactPanel)) contactPanelSizer.Fit(contactPanel) okButton = wx.Button(self, 1, ' OK ') okButton.SetDefault() okButton.Bind(wx.EVT_BUTTON, self.OnClose) sizer.Add(iconPanel, flag=wx.EXPAND|wx.ALIGN_TOP|wx.ALIGN_LEFT) sizer.Add(contactPanel) sizer.Add(okButton, flag=wx.RIGHT|wx.BOTTOM) #sizer.Add(wx.StaticText(self,label=" ")) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, id, title, latestVersionNumber, latestVersionChanges, LAUNCHER_URL): wx.Dialog.__init__(self, parent, id, title, size=(680, 290), pos=(200, 150)) if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) massiveIconPanel = wx.Panel(self) import MASSIVE_icon massiveIconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap( ) wx.StaticBitmap( massiveIconPanel, wx.ID_ANY, massiveIconAsBitmap, (0, 50), (massiveIconAsBitmap.GetWidth(), massiveIconAsBitmap.GetHeight())) newVersionAlertPanel = wx.Panel(self) newVersionAlertPanelSizer = wx.BoxSizer(wx.VERTICAL) newVersionAlertPanel.SetSizer(newVersionAlertPanelSizer) newVersionAlertTitleLabel = wx.StaticText(newVersionAlertPanel, label=parent.programName) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) font.SetPointSize(14) font.SetWeight(wx.BOLD) newVersionAlertTitleLabel.SetFont(font) newVersionAlertPanelSizer.Add( wx.StaticText(newVersionAlertPanel, label="")) newVersionAlertPanelSizer.Add(newVersionAlertTitleLabel, flag=wx.EXPAND) newVersionAlertPanelSizer.Add( wx.StaticText(newVersionAlertPanel, label="")) newVersionAlertTextLabel1 = wx.StaticText( newVersionAlertPanel, label="You are running version " + launcher_version_number.version_number + "\n\n" + "The latest version is " + latestVersionNumber + "\n\n" + 'RUNNING AN OLD VERSION OF THE LAUNCHER IS NOT RECOMMENDED!\n\n' "Please download a new version from:\n\n") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) newVersionAlertTextLabel1.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertTextLabel1, flag=wx.EXPAND) newVersionAlertHyperlink = wx.HyperlinkCtrl(newVersionAlertPanel, id=wx.ID_ANY, label=LAUNCHER_URL, url=LAUNCHER_URL) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) newVersionAlertHyperlink.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertHyperlink, border=10, flag=wx.LEFT) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel)) self.latestVersionChangesTextCtrl = wx.TextCtrl(newVersionAlertPanel, size=(600, 200), style=wx.TE_MULTILINE | wx.TE_READONLY) newVersionAlertPanelSizer.Add(self.latestVersionChangesTextCtrl, flag=wx.EXPAND) if sys.platform.startswith("darwin"): font = wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Courier New') else: font = wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Courier New') self.latestVersionChangesTextCtrl.SetFont(font) self.latestVersionChangesTextCtrl.AppendText(latestVersionChanges) self.latestVersionChangesTextCtrl.SetInsertionPoint(0) newVersionAlertPanelSizer.Add( wx.StaticText(newVersionAlertPanel, wx.ID_ANY, "")) newVersionAlertQueriesContactLabel = wx.StaticText( newVersionAlertPanel, label="For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) newVersionAlertQueriesContactLabel.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertQueriesContactLabel, border=10, flag=wx.EXPAND) contactEmailHyperlink = wx.HyperlinkCtrl( newVersionAlertPanel, id=wx.ID_ANY, label="*****@*****.**", url="mailto:[email protected]") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) newVersionAlertPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT) def onOK(event): self.EndModal(wx.ID_OK) self.Destroy() okButton = wx.Button(newVersionAlertPanel, 1, ' OK ') okButton.SetDefault() newVersionAlertPanelSizer.Add(okButton, flag=wx.ALIGN_RIGHT) newVersionAlertPanelSizer.Add( wx.StaticText(newVersionAlertPanel, label="")) newVersionAlertPanelSizer.Fit(newVersionAlertPanel) self.Bind(wx.EVT_BUTTON, onOK, id=1) newVersionAlertDialogSizer = wx.FlexGridSizer(rows=1, cols=3, vgap=5, hgap=5) newVersionAlertDialogSizer.Add(massiveIconPanel, flag=wx.EXPAND) newVersionAlertDialogSizer.Add(newVersionAlertPanel, flag=wx.EXPAND) newVersionAlertDialogSizer.Add(wx.StaticText(self, label=" ")) self.SetSizer(newVersionAlertDialogSizer) newVersionAlertDialogSizer.Fit(self)
def __init__(self, parent, id, title, latestVersionNumber, latestVersionChanges, LAUNCHER_URL): wx.Dialog.__init__(self, parent, id, title, size=(680, 290), pos=(200,150)) if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) massiveIconPanel = wx.Panel(self) import MASSIVE_icon massiveIconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap() wx.StaticBitmap(massiveIconPanel, wx.ID_ANY, massiveIconAsBitmap, (0, 50), (massiveIconAsBitmap.GetWidth(), massiveIconAsBitmap.GetHeight())) newVersionAlertPanel = wx.Panel(self) newVersionAlertPanelSizer = wx.BoxSizer(wx.VERTICAL) newVersionAlertPanel.SetSizer(newVersionAlertPanelSizer) newVersionAlertTitleLabel = wx.StaticText(newVersionAlertPanel, label = parent.programName) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) font.SetPointSize(14) font.SetWeight(wx.BOLD) newVersionAlertTitleLabel.SetFont(font) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel,label="")) newVersionAlertPanelSizer.Add(newVersionAlertTitleLabel, flag=wx.EXPAND) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel,label="")) newVersionAlertTextLabel1 = wx.StaticText(newVersionAlertPanel, label = "You are running version " + launcher_version_number.version_number + "\n\n" + "The latest version is " + latestVersionNumber + "\n\n" + 'RUNNING AN OLD VERSION OF THE LAUNCHER IS NOT RECOMMENDED!\n\n' "Please download a new version from:\n\n") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) newVersionAlertTextLabel1.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertTextLabel1, flag=wx.EXPAND) newVersionAlertHyperlink = wx.HyperlinkCtrl(newVersionAlertPanel, id = wx.ID_ANY, label = LAUNCHER_URL, url = LAUNCHER_URL) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) newVersionAlertHyperlink.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertHyperlink, border=10, flag=wx.LEFT) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel)) self.latestVersionChangesTextCtrl = wx.TextCtrl(newVersionAlertPanel, size=(600, 200), style=wx.TE_MULTILINE|wx.TE_READONLY) newVersionAlertPanelSizer.Add(self.latestVersionChangesTextCtrl, flag=wx.EXPAND) if sys.platform.startswith("darwin"): font = wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Courier New') else: font = wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Courier New') self.latestVersionChangesTextCtrl.SetFont(font) self.latestVersionChangesTextCtrl.AppendText(latestVersionChanges) self.latestVersionChangesTextCtrl.SetInsertionPoint(0) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel, wx.ID_ANY, "")) newVersionAlertQueriesContactLabel = wx.StaticText(newVersionAlertPanel, label = "For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) newVersionAlertQueriesContactLabel.SetFont(font) newVersionAlertPanelSizer.Add(newVersionAlertQueriesContactLabel, border=10, flag=wx.EXPAND) contactEmailHyperlink = wx.HyperlinkCtrl(newVersionAlertPanel, id = wx.ID_ANY, label = "*****@*****.**", url = "mailto:[email protected]") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) newVersionAlertPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT) def onOK(event): self.EndModal(wx.ID_OK) self.Destroy() okButton = wx.Button(newVersionAlertPanel, 1, ' OK ') okButton.SetDefault() newVersionAlertPanelSizer.Add(okButton, flag=wx.ALIGN_RIGHT) newVersionAlertPanelSizer.Add(wx.StaticText(newVersionAlertPanel,label="")) newVersionAlertPanelSizer.Fit(newVersionAlertPanel) self.Bind(wx.EVT_BUTTON, onOK, id=1) newVersionAlertDialogSizer = wx.FlexGridSizer(rows=1, cols=3, vgap=5, hgap=5) newVersionAlertDialogSizer.Add(massiveIconPanel, flag=wx.EXPAND) newVersionAlertDialogSizer.Add(newVersionAlertPanel, flag=wx.EXPAND) newVersionAlertDialogSizer.Add(wx.StaticText(self,label=" ")) self.SetSizer(newVersionAlertDialogSizer) newVersionAlertDialogSizer.Fit(self)
def __init__(self, parent, id, title, message, maxValue, userCanAbort,cancelCallback=None): wx.Frame.__init__(self, parent, id, title, style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT) self.user_requested_abort = False self.cancelCallback=cancelCallback self.panel = wx.Panel(self, wx.ID_ANY) # We'll just set a temporary message while the dialog, # is constructed, to represent the longest message # likely to appear in the progress dialog. # At the end of the __init__ method, we will use # SetLabel to set the initial message correctly. temporaryMessage = "Getting the one time password for the VNC server" self.messageStaticText = wx.StaticText(self.panel, label = temporaryMessage) self.progressBar = wx.Gauge(self, -1, maxValue) import sys if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) elif sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) else: # FIXME OSX is handled somewhere else? pass #self.progressBar.SetSize(wx.Size(250, -1)) statusMessageWidth = self.messageStaticText.GetSize().width self.progressBar.SetSize(wx.Size(statusMessageWidth, -1)) if userCanAbort: sizer = wx.FlexGridSizer(rows=3, cols=3, vgap=5, hgap=15) else: sizer = wx.FlexGridSizer(rows=2, cols=3, vgap=5, hgap=15) sizer.AddGrowableCol(1) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(self.messageStaticText, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(self.progressBar, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) if userCanAbort: self.Bind(wx.EVT_CLOSE, self.onCancel) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) CANCEL_BUTTON_ID=12345 self.cancelButton = wx.Button(self.panel, CANCEL_BUTTON_ID, "Cancel") self.Bind(wx.EVT_BUTTON, self.onCancel, id=CANCEL_BUTTON_ID) sizer.Add(self.cancelButton, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) else: # Currently the Launcher only uses this class with userCanAbort=True, # so this event handler should never be called. self.Bind(wx.EVT_CLOSE, self.doNothing) self.panel.SetSizerAndFit(sizer) self.Fit() self.messageStaticText.SetLabel(message) self.Center() self.Show() return None
def __init__(self, *args, **kw): if kw.has_key('parent'): self.parent=kw.get('parent') logger.debug("ListSelectionDialog: parent is not None.") logger.debug("ListSelectionDialog: parent class name is " + self.parent.__class__.__name__) else: self.parent = None logger.debug("ListSelectionDialog: parent is None.") if kw.has_key('progressDialog'): self.progressDialog=kw.pop('progressDialog') else: self.progressDialog=None if kw.has_key('headers'): self.headers=kw.pop('headers') else: self.headers=None if kw.has_key('items'): self.items=kw.pop('items') else: self.items=None if kw.has_key('message'): self.message=kw.pop('message') else: self.message=None if kw.has_key('noSelectionMessage'): self.noSelectionMessage=kw.pop('noSelectionMessage') else: self.noSelectionMessage="Please select a valid item from the list.", if kw.has_key('okCallback'): self.okCallback=kw.pop('okCallback') else: logger.debug("okCallback set to none") self.okCallback=None if kw.has_key('cancelCallback'): self.cancelCallback=kw.pop('cancelCallback') else: logger.debug("cancelCallback set to none") self.cancelCallback=None if kw.has_key('helpEmailAddress'): self.helpEmailAddress=kw.pop('helpEmailAddress') else: logger.debug("helpEmailAddress set to none") self.helpEmailAddress="*****@*****.**" super(ListSelectionDialog, self).__init__(*args, **kw) self.itemList=[] self.closedProgressDialog = False if self.progressDialog is not None: self.progressDialog.Show(False) self.closedProgressDialog = True self.CenterOnParent() if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) if sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) listSelectionDialogPanel = wx.Panel(self) listSelectionDialogSizer = wx.FlexGridSizer(rows=1, cols=1) self.SetSizer(listSelectionDialogSizer) listSelectionDialogSizer.Add(listSelectionDialogPanel, flag=wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, border=10) iconPanel = wx.Panel(listSelectionDialogPanel) import MASSIVE_icon iconAsBitmap = MASSIVE_icon.getMASSIVElogoTransparent128x128Bitmap() wx.StaticBitmap(iconPanel, wx.ID_ANY, iconAsBitmap, (0, 25), (iconAsBitmap.GetWidth(), iconAsBitmap.GetHeight())) sizer = wx.BoxSizer(wx.HORIZONTAL) lcSizer = wx.BoxSizer(wx.VERTICAL) rcSizer = wx.BoxSizer(wx.VERTICAL) contactPanel = wx.Panel(listSelectionDialogPanel) contactPanelSizer = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5) contactPanel.SetSizer(contactPanelSizer) contactQueriesContactLabel = wx.StaticText(contactPanel, label = "For queries, please contact:") font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(9) contactQueriesContactLabel.SetFont(font) contactEmailHyperlink = wx.HyperlinkCtrl(contactPanel, id = wx.ID_ANY, label = self.helpEmailAddress, url = "mailto:" + self.helpEmailAddress) font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) if sys.platform.startswith("darwin"): font.SetPointSize(11) else: font.SetPointSize(8) contactEmailHyperlink.SetFont(font) contactPanelSizer.Add(contactQueriesContactLabel, border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) contactPanelSizer.Add(contactEmailHyperlink, border=20, flag=wx.LEFT|wx.RIGHT|wx.BOTTOM) contactPanelSizer.Fit(contactPanel) listSelectionPanel = wx.Panel(listSelectionDialogPanel) listSelectionPanelSizer = wx.BoxSizer(wx.VERTICAL) listSelectionPanel.SetSizer(listSelectionPanelSizer) if (self.message!=None): messageText = wx.StaticText(parent=listSelectionPanel,id=wx.ID_ANY,label=self.message) listSelectionPanelSizer.Add(messageText,border=5,flag=wx.ALL^wx.EXPAND) if (self.headers!=None): self.listSelectionList=ListSelectionDialog.ResizeListCtrl(listSelectionPanel,-1,style=wx.LC_REPORT|wx.EXPAND) else: self.listSelectionList=ListSelectionDialog.ResizeListCtrl(listSelectionPanel,-1,style=wx.LC_REPORT|wx.EXPAND|wx.LC_NO_HEADER) col=0 if (self.headers!=None): for hdr in self.headers: self.listSelectionList.InsertColumn(col,hdr,width=-1) col=col+1 elif (self.items!=None): if (len(self.items)>0 and isinstance(self.items[0],list)): for i in self.items[0]: self.listSelectionList.InsertColumn(col,"",width=-1) else: self.listSelectionList.InsertColumn(col,"",width=-1) if (self.items!=None): for item in self.items: if (isinstance(item,list)): self.listSelectionList.Append(item) #self.listSelectionList.InsertStringItem(0,item) else: self.listSelectionList.Append([item]) #self.listSelectionList=wx.ListView(listSelectionPanel,style=wx.LC_REPORT) listSelectionPanelSizer.Add(self.listSelectionList,proportion=1,border=10,flag=wx.EXPAND|wx.ALL) self.buttonsPanel = wx.Panel(listSelectionDialogPanel, wx.ID_ANY) self.buttonsPanelSizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5) self.buttonsPanel.SetSizer(self.buttonsPanelSizer) self.cancelButton = wx.Button(self.buttonsPanel, wx.ID_ANY, 'Cancel') self.cancelButton.SetDefault() self.cancelButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, self.onClose) # Bottom border of 5 is a workaround for an OS X bug where bottom of button can be clipped. self.buttonsPanelSizer.Add(self.cancelButton, flag=wx.BOTTOM, border=5) self.okButton = wx.Button(self.buttonsPanel, wx.ID_ANY, ' OK ') self.okButton.SetDefault() self.okButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, self.onClose) #self.okButton.Disable() # Bottom border of 5 is a workaround for an OS X bug where bottom of button can be clipped. self.buttonsPanelSizer.Add(self.okButton, flag=wx.BOTTOM, border=5) self.buttonsPanel.GetSizer().Fit(self.buttonsPanel) #self.listSelectionList.Bind(wx.EVT_LIST_ITEM_SELECTED,self.onFocus) self.listSelectionList.Bind(wx.EVT_LIST_ITEM_ACTIVATED,self.onClose) lcSizer.Add(iconPanel,proportion=1,flag=wx.EXPAND|wx.ALIGN_TOP|wx.ALIGN_LEFT) lcSizer.Add(contactPanel,proportion=0,flag=wx.ALIGN_LEFT|wx.ALIGN_BOTTOM) rcSizer.Add(listSelectionPanel,proportion=1,flag=wx.EXPAND) #rcSizer.Add(self.okButton,proportion=0,flag=wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM|wx.BOTTOM,border=5) rcSizer.Add(self.buttonsPanel,proportion=0,flag=wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM) sizer.Add(lcSizer,proportion=0,flag=wx.EXPAND) sizer.Add(rcSizer,proportion=1,flag=wx.EXPAND) listSelectionDialogPanel.SetSizer(sizer) sizer.Fit(listSelectionDialogPanel) self.GetSizer().Fit(self) self.listSelectionList.SetFocus()
def __init__(self, parent, message, title, helpEmailAddress="*****@*****.**", **kw): wx.Dialog.__init__(self, parent, style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP, **kw) if parent != None: self.CenterOnParent() else: self.Centre() self.helpEmailAddress = helpEmailAddress self.dialogPanel = wx.Panel(self, wx.ID_ANY) import sys if sys.platform.startswith("win"): _icon = wx.Icon("MASSIVE.ico", wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) elif sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) # self.iconBitmap = wx.StaticBitmap(self.dialogPanel,bitmap=wx.ArtProvider.GetBitmap(wx.ART_INFORMATION), pos=(25,15), size=(32,32)) iconAsBitmap = IconPys.MASSIVElogoTransparent64x64.getMASSIVElogoTransparent64x64Bitmap() self.iconBitmap = wx.StaticBitmap(self.dialogPanel, bitmap=iconAsBitmap, pos=(25, 15), size=(64, 64)) self.SetTitle(title) self.queriesContactLabel = wx.StaticText(self.dialogPanel, label="For queries, please contact:") self.queriesContactLabel.SetForegroundColour(wx.Colour(0, 0, 0)) self.contactEmailHyperlink = wx.HyperlinkCtrl( self.dialogPanel, id=wx.ID_ANY, label=self.helpEmailAddress, url="mailto:" + self.helpEmailAddress ) self.contactEmailHyperlink.SetSize(self.contactEmailHyperlink.GetBestSize()) self.messageLabel = wx.StaticText(self.dialogPanel, wx.ID_ANY, message) messageWidth = max( self.messageLabel.GetSize().width, self.queriesContactLabel.GetSize().width + self.contactEmailHyperlink.GetSize().width + 50, ) self.messageLabel.Destroy() messageWidth = min(messageWidth, 450) self.messageLabel = wx.StaticText(self.dialogPanel, wx.ID_ANY, message, pos=(105, 15), size=(messageWidth, -1)) self.messageLabel.SetForegroundColour((0, 0, 0)) self.messageLabel.Wrap(messageWidth) self.dialogPanel.Layout() dialogPanelWidth = messageWidth + 125 dialogPanelHeight = max(self.messageLabel.GetSize().height + 70, 140) self.SetClientSize(wx.Size(dialogPanelWidth, dialogPanelHeight)) self.dialogPanel.SetSize(wx.Size(dialogPanelWidth, dialogPanelHeight)) okButtonSize = wx.Size(72, 22) okButtonPosition = wx.Point( dialogPanelWidth - okButtonSize.width - 25, dialogPanelHeight - okButtonSize.height - 18 ) self.okButton = wx.Button(self.dialogPanel, wx.ID_ANY, "OK", pos=okButtonPosition, size=okButtonSize) self.okButton.SetDefault() self.queriesContactLabel.SetPosition(wx.Point(25, okButtonPosition.y)) hyperlinkPosition = wx.Point( self.queriesContactLabel.GetPosition().x + self.queriesContactLabel.GetSize().width + 10, okButtonPosition.y ) self.contactEmailHyperlink.SetPosition(hyperlinkPosition) self.Bind(wx.EVT_CLOSE, self.onClose) self.Bind(wx.EVT_BUTTON, self.onClose, id=self.okButton.GetId())
def __init__(self, parent, id, title, message, maxValue, userCanAbort, cancelCallback=None): wx.Frame.__init__(self, parent, id, title, style=wx.DEFAULT_DIALOG_STYLE | wx.FRAME_FLOAT_ON_PARENT) self.user_requested_abort = False self.cancelCallback = cancelCallback self.panel = wx.Panel(self, wx.ID_ANY) # We'll just set a temporary message while the dialog, # is constructed, to represent the longest message # likely to appear in the progress dialog. # At the end of the __init__ method, we will use # SetLabel to set the initial message correctly. temporaryMessage = "Getting the one time password for the VNC server" self.messageStaticText = wx.StaticText(self.panel, label=temporaryMessage) self.progressBar = wx.Gauge(self, -1, maxValue) import sys if sys.platform.startswith("win"): _icon = wx.Icon('MASSIVE.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(_icon) elif sys.platform.startswith("linux"): import MASSIVE_icon self.SetIcon(MASSIVE_icon.getMASSIVElogoTransparent128x128Icon()) else: # FIXME OSX is handled somewhere else? pass #self.progressBar.SetSize(wx.Size(250, -1)) statusMessageWidth = self.messageStaticText.GetSize().width self.progressBar.SetSize(wx.Size(statusMessageWidth, -1)) if userCanAbort: sizer = wx.FlexGridSizer(rows=3, cols=3, vgap=5, hgap=15) else: sizer = wx.FlexGridSizer(rows=2, cols=3, vgap=5, hgap=15) sizer.AddGrowableCol(1) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(self.messageStaticText, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) sizer.Add(self.progressBar, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) if userCanAbort: self.Bind(wx.EVT_CLOSE, self.onCancel) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) CANCEL_BUTTON_ID = 12345 self.cancelButton = wx.Button(self.panel, CANCEL_BUTTON_ID, "Cancel") self.Bind(wx.EVT_BUTTON, self.onCancel, id=CANCEL_BUTTON_ID) sizer.Add(self.cancelButton, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=15) sizer.Add(wx.StaticText(self.panel, wx.ID_ANY, " ")) else: # Currently the Launcher only uses this class with userCanAbort=True, # so this event handler should never be called. self.Bind(wx.EVT_CLOSE, self.doNothing) self.panel.SetSizerAndFit(sizer) self.Fit() self.messageStaticText.SetLabel(message) self.Center() self.Show() return None