def onDeleteBtn(self, event): """ :param event: :return: """ self.checkIfEditing() try: if self.selectedObject: if len(self.selectedObject) > 1: length = len(self.selectedObject) msg = GMD.GenericMessageDialog(None, 'Are you sure you want to delete %d items' % length, 'Clear items?', wx.YES_NO | wx.ICON_WARNING | wx.NO_DEFAULT) value = msg.ShowModal() if value == wx.ID_YES: self.customRemove(self.selectedObject) else: self.customRemove(self.selectedObject) except TypeError as e: msg = GMD.GenericMessageDialog(None, 'Are you sure you want to delete your work?', 'Clear items?', wx.YES_NO | wx.ICON_WARNING | wx.NO_DEFAULT) value = msg.ShowModal() if value == wx.ID_YES: self.customRemove(self.selectedObject) #self.sb.SetStatusText("Removing %s" % self.sb.SetStatusText("Removing %s" % self.selectedObject.dataValue)) self.selectedObject = None event.Skip()
def onFinishedBtn(self, event): """ :param event: :return: """ self.checkIfEditing() #try: points, isIncorrect = self.parseTable() #except: # return message = "" if not points and not isIncorrect: #print "Leaving..." self.Close() return elif not points: message = "Unfortunately there are no points to add, " \ "please check that the data was entered correctly " \ "and try again. " dlg = GMD.GenericMessageDialog(None, message, "Nothing to add", agwStyle=wx.ICON_WARNING | wx.CANCEL | wx.OK | GMD.GMD_USE_GRADIENTBUTTONS) dlg.SetOKCancelLabels(ok="Return to AddPoint Menu", cancel="Quit to ODMTools") value = dlg.ShowModal() if value == wx.ID_OK: return else: self.Close() return elif isIncorrect: message = "Are you ready to add points? " \ "There are rows that are incorrectly formatted, " \ "those rows will not be added. Continue?" else: message = "Are you ready to add points? " \ "Ready to add points to the database?" msg = GMD.GenericMessageDialog( None, message, 'Add Points?', wx.YES_NO | wx.ICON_QUESTION | wx.NO_DEFAULT | GMD.GMD_USE_GRADIENTBUTTONS) value = msg.ShowModal() if value == wx.ID_NO: return self.recordService.add_points(points) self.Close() event.Skip()
def onInfoBtn(self, event): """ :param event: :return: """ self.checkIfEditing() message = "DataValue: FLOAT\n" \ "Date: YYYY-MM-DD\n" \ "Time: HH:MM:SS\n" \ "UTCOffSet: INT (Range [-12,12])\n" \ "CensorCode: gt|nc|lt|nd|pnq\n" \ "ValueAccuracy: FLOAT\n" \ "OffSetValue: INT\n" \ "OffSetType: STRING\n" \ "QualifierCode: STRING\n" \ "LabSampleCode: STRING\n" dlg = GMD.GenericMessageDialog(self, message, "Format Guide", agwStyle=wx.ICON_INFORMATION | wx.OK | GMD.GMD_USE_GRADIENTBUTTONS) dlg.ShowModal() event.Skip()
def OnShowDialog(self, event): btnStyle = 0 for child in self.mainPanel.GetChildren(): if isinstance(child, wx.CheckBox) and child not in [ self.useExtended, self.customIcons ]: if child.GetValue(): btnStyle |= eval(child.GetLabel()) dlgStyle = eval(self.dialogStyles.GetStringSelection()) buttonKind = self.buttonKinds.GetSelection() if buttonKind == 1: # Aquabuttons dlgStyle += GMD.GMD_USE_AQUABUTTONS elif buttonKind == 2: # GradientButtons dlgStyle += GMD.GMD_USE_GRADIENTBUTTONS if self.useExtended: extended = _msg message = "This is the main message!" else: extended = "" message = _msg dlg = GMD.GenericMessageDialog(self, message, "A Nice Message Box", btnStyle | dlgStyle) if self.customIcons.GetValue(): b1, b2, b3 = [ random.randint(0, len(ART_ICONS) - 1) for i in xrange(3) ] b4, b5 = [random.randint(0, len(ART_ICONS) - 1) for i in xrange(2)] yes = wx.ArtProvider.GetBitmap(ART_ICONS[b1], wx.ART_OTHER, (16, 16)) no = wx.ArtProvider.GetBitmap(ART_ICONS[b2], wx.ART_OTHER, (16, 16)) cancel = wx.ArtProvider.GetBitmap(ART_ICONS[b3], wx.ART_OTHER, (16, 16)) ok = wx.ArtProvider.GetBitmap(ART_ICONS[b4], wx.ART_OTHER, (16, 16)) help = wx.ArtProvider.GetBitmap(ART_ICONS[b5], wx.ART_OTHER, (16, 16)) dlg.SetYesNoCancelBitmaps(yes, no, cancel) dlg.SetOKBitmap(ok) dlg.SetHelpBitmap(help) dlg.SetExtendedMessage(extended) dlg.SetIcon(images.Mondrian.GetIcon()) dlg.ShowModal() dlg.Destroy()
def OnShowDialog(self, event): btnStyle = 0 for child in self.mainPanel.GetChildren(): if isinstance(child, wx.CheckBox): if child.GetValue(): btnStyle |= eval(child.GetLabel()) dlgStyle = eval(self.dialogStyles.GetStringSelection()) dlg = GMD.GenericMessageDialog(self, _msg, "A Nice Message Box", btnStyle | dlgStyle) dlg.SetIcon(images.Mondrian.GetIcon()) dlg.ShowModal() dlg.Destroy()
def onClearAllBtn(self, event): """ :param event: :return: """ if len(self.olv.GetObjects()) < 1: wx.MessageBox("Nothing to remove here", " ", wx.OK) return msg = GMD.GenericMessageDialog(None, 'Are you sure you want to delete your work?', 'Clear Everything?', wx.YES_NO | wx.ICON_WARNING |wx.NO_DEFAULT ) value = msg.ShowModal() if value == wx.ID_YES: self._clearAll() return
def OnShowDialog(self, event): btnStyle = 0 for child in self.mainPanel.GetChildren(): if isinstance(child, wx.CheckBox): if child.GetValue(): btnStyle |= eval(child.GetLabel()) dlgStyle = eval(self.dialogStyles.GetStringSelection()) buttonKind = self.buttonKinds.GetSelection() if buttonKind == 1: # Aquabuttons dlgStyle += GMD.GMD_USE_AQUABUTTONS elif buttonKind == 2: # GradientButtons dlgStyle += GMD.GMD_USE_GRADIENTBUTTONS dlg = GMD.GenericMessageDialog(self, _msg, "A Nice Message Box", btnStyle | dlgStyle) dlg.SetIcon(images.Mondrian.GetIcon()) dlg.ShowModal() dlg.Destroy()