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()) 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, 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, *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, *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()