def Configure(self, kwargs={}): def MakeOption(name, checkBox, ctrl): value = kwargs.get(name, None) def OnCheckBox(event): ctrl.Enable(checkBox.GetValue()) event.Skip() checkBox.Bind(wx.EVT_CHECKBOX, OnCheckBox) if value is None: checkBox.SetValue(False) ctrl.SetValue(self.plugin.defaults[name]) ctrl.Enable(False) else: checkBox.SetValue(True) ctrl.SetValue(value) panel.AddLine(checkBox, ctrl) def SetResult(): if checkBox.GetValue(): kwargs[name] = ctrl.GetValue() return SetResult panel = eg.ConfigPanel() panel.SetSizerProperty(vgap=2) text = self.text labelCtrl = panel.TextCtrl(kwargs.get("label", "")) panel.AddLine(text.label, labelCtrl) eventCtrl = panel.TextCtrl(kwargs.get("event", "")) panel.AddLine(text.event, eventCtrl) invisibleCtrl = panel.CheckBox(kwargs.get("invisible", False), "Invisible") panel.AddLine(invisibleCtrl) imageButton = ImageButton(panel, label="Choose Image") imageBox = wx.StaticBitmap(panel, size=(40, 40), pos=(280, 70), style=wx.SUNKEN_BORDER) imageButton.view = imageBox imageOption = MakeOption("image", panel.CheckBox(label="Use image as label:"), imageButton) foregroundColour = MakeOption( "foregroundColour", panel.CheckBox(label="Override foreground colour:"), panel.ColourSelectButton()) backgroundColour = MakeOption( "backgroundColour", panel.CheckBox(label="Override background colour:"), panel.ColourSelectButton()) fontInfo = MakeOption("fontInfo", panel.CheckBox(label="Override button font:"), panel.FontSelectButton()) width = MakeOption("width", panel.CheckBox(label="Override width:"), panel.SpinIntCtrl()) height = MakeOption("height", panel.CheckBox(label="Override height:"), panel.SpinIntCtrl()) while panel.Affirmed(): image = kwargs.get("image", None) kwargs = {} kwargs["label"] = labelCtrl.GetValue() kwargs["event"] = eventCtrl.GetValue() fontInfo() foregroundColour() backgroundColour() width() height() imageOption() if invisibleCtrl.GetValue(): kwargs["invisible"] = True panel.SetResult(kwargs)
def __init__(self): wx.Dialog.__init__(self, None, id=wx.ID_ANY, title=u'O Programie', pos=wx.DefaultPosition, size=wx.Size(350, 320), style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX) ico = wx.Icon('icon/about.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(ico) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_panel1 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer2 = wx.BoxSizer(wx.VERTICAL) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.m_bitmap1 = wx.StaticBitmap( self.m_panel1, wx.ID_ANY, wx.Bitmap(u"icon/pobrane.png", wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.Size(80, -1), 0) bSizer3.Add(self.m_bitmap1, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, 5) bSizer2.Add(bSizer3, 0, wx.TOP | wx.EXPAND, 5) bSizer4 = wx.BoxSizer(wx.VERTICAL) self.m_staticText1 = wx.StaticText(self.m_panel1, wx.ID_ANY, u"PubRansack 1.0", wx.DefaultPosition, wx.Size(-1, -1), 0) self.m_staticText1.Wrap(-1) self.m_staticText1.SetFont( wx.Font(15, 70, 90, 92, False, wx.EmptyString)) bSizer4.Add(self.m_staticText1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer2.Add(bSizer4, 0, wx.EXPAND, 5) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Program do wyszukiwania oraz zarządzania publikacjami naukowymi. Wyszukiwarka współpracująca z Google Scholar. Tworzy własną bazę publikację, na bazie której generowane są pliki bibliograficzne. Program został wykonany w ramach pracy dyplomowej.\nPubRansack Copyright \xa9 2013 Damian Baran This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.m_staticText3.Wrap(-1) bSizer5.Add(self.m_staticText3, 1, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5) bSizer2.Add(bSizer5, 1, wx.EXPAND, 5) # bSizer6 = wx.BoxSizer( wx.VERTICAL ) # # self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"\xa9 2013 Damian Baran", wx.DefaultPosition, wx.DefaultSize, 0 ) # self.m_staticText2.Wrap( -1 ) # bSizer6.Add( self.m_staticText2, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) # # bSizer2.Add( bSizer6, 0, wx.EXPAND, 5 ) bSizer7 = wx.BoxSizer(wx.HORIZONTAL) self.m_button2 = wx.Button(self.m_panel1, wx.ID_ANY, u"Licencja", wx.DefaultPosition, wx.DefaultSize, 0) bSizer7.Add(self.m_button2, 0, wx.ALL, 5) bSizer8 = wx.BoxSizer(wx.VERTICAL) self.m_button1 = wx.Button(self.m_panel1, wx.ID_ANY, u"Zamknij", wx.DefaultPosition, wx.DefaultSize, 0) bSizer8.Add(self.m_button1, 0, wx.ALL | wx.ALIGN_RIGHT, 5) bSizer7.Add(bSizer8, 1, wx.EXPAND | wx.ALIGN_BOTTOM, 5) bSizer2.Add(bSizer7, 0, wx.EXPAND, 5) self.m_panel1.SetSizer(bSizer2) self.m_panel1.Layout() bSizer2.Fit(self.m_panel1) bSizer1.Add(self.m_panel1, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) self.m_button1.Bind(wx.EVT_BUTTON, self.close) self.m_button2.Bind(wx.EVT_BUTTON, self.license)
def __init__(self, parent): wx.Panel.__init__(self, parent=parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetBackgroundColour(wx.WHITE) self.frame = parent # main sizer main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.AddSpacer(30) if no_auto_detect == True: detected_robot = auto_detect_robot.autodetect() print(detected_robot) if detected_robot != "GoPiGo3": detected_robot_str = wx.StaticText( self, -1, label="Warning: Could not find a GoPiGo3") detected_robot_str.SetForegroundColour('red') warning_sizer = wx.BoxSizer(wx.HORIZONTAL) warning_sizer.Add(detected_robot_str, 0, wx.EXPAND | wx.ALIGN_CENTER) main_sizer.Add(warning_sizer, 0, wx.ALIGN_CENTER) led_sizer = wx.BoxSizer(wx.HORIZONTAL) left_led_button = wx.Button(self, label="Left LED") self.Bind(wx.EVT_BUTTON, self.left_led_button_OnButtonClick, left_led_button) right_led_button = wx.Button(self, label="Right LED") self.Bind(wx.EVT_BUTTON, self.right_led_button_OnButtonClick, right_led_button) led_sizer.AddSpacer(30) led_sizer.Add(left_led_button, 0, wx.ALIGN_CENTER) led_sizer.AddSpacer(80) led_sizer.Add(right_led_button, 0, wx.ALIGN_CENTER) led_sizer.AddSpacer(30) eyesSizer = wx.BoxSizer(wx.HORIZONTAL) left_eye_button = wx.Button(self, label="Left eye") self.Bind(wx.EVT_BUTTON, self.left_eye_button_OnButtonClick, left_eye_button) icon_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.Bitmap(ICON_PATH + "dex.png", type=wx.BITMAP_TYPE_PNG) robotbitmap = wx.StaticBitmap(self, bitmap=bmp) right_eye_button = wx.Button(self, label="Right eye") self.Bind(wx.EVT_BUTTON, self.right_eye_button_OnButtonClick, right_eye_button) eyesSizer.AddSpacer(30) eyesSizer.Add(right_eye_button, 0) eyesSizer.Add(robotbitmap, 0) eyesSizer.Add(left_eye_button, 0) eyesSizer.AddSpacer(30) fwd_sizer = wx.BoxSizer(wx.HORIZONTAL) fwd_button = wx.Button(self, label="Forward") self.Bind(wx.EVT_BUTTON, self.fwd_button_OnButtonClick, fwd_button) fwd_sizer.Add(fwd_button, 0, wx.ALIGN_CENTER) middle_sizer = wx.BoxSizer(wx.HORIZONTAL) left_button = wx.Button(self, label="Left") self.Bind(wx.EVT_BUTTON, self.left_button_OnButtonClick, left_button) stop_button = wx.Button(self, label="Stop") stop_button.SetBackgroundColour('red') self.Bind(wx.EVT_BUTTON, self.stop_button_OnButtonClick, stop_button) right_button = wx.Button(self, label="Right") self.Bind(wx.EVT_BUTTON, self.right_button_OnButtonClick, right_button) middle_sizer.Add(left_button, 0, wx.ALIGN_CENTER) middle_sizer.Add(stop_button, 0, wx.ALIGN_CENTER) middle_sizer.Add(right_button, 0, wx.ALIGN_CENTER) bwdSizer = wx.BoxSizer(wx.HORIZONTAL) bwd_button = wx.Button(self, label="Back") self.Bind(wx.EVT_BUTTON, self.bwd_button_OnButtonClick, bwd_button) bwdSizer.Add(bwd_button, 0, wx.ALIGN_CENTER) batterySizer = wx.BoxSizer(wx.HORIZONTAL) battery_button = wx.Button(self, label="Check Battery Voltage") self.Bind(wx.EVT_BUTTON, self.battery_button_OnButtonClick, battery_button) self.battery_label = wx.StaticText(self, label=str(round(v, 1)) + "V") batterySizer.AddSpacer(30) batterySizer.Add(battery_button, 0, wx.ALIGN_LEFT) batterySizer.AddSpacer(20) batterySizer.Add(self.battery_label, 0, wx.ALIGN_CENTER | wx.EXPAND) firmwareSizer = wx.BoxSizer(wx.HORIZONTAL) firmware_button = wx.Button(self, -1, label="Check Firmware Version") self.Bind(wx.EVT_BUTTON, self.firmware_button_OnButtonClick, firmware_button) self.firmware_label = wx.StaticText(self, -1, label=str(f)) firmwareSizer.AddSpacer(30) firmwareSizer.Add(firmware_button, 0, wx.ALIGN_LEFT) firmwareSizer.AddSpacer(15) firmwareSizer.Add(self.firmware_label, 0, wx.ALIGN_CENTER | wx.EXPAND) # Exit exit_sizer = wx.BoxSizer(wx.HORIZONTAL) exit_button = wx.Button(self, label="Exit") exit_button.Bind(wx.EVT_BUTTON, self.onClose) exit_sizer.Add(exit_button, 0, wx.ALIGN_RIGHT) exit_sizer.AddSpacer(30) main_sizer.Add(led_sizer, 0, wx.ALIGN_CENTER) main_sizer.Add(eyesSizer, 0, wx.ALIGN_CENTER) main_sizer.AddSpacer(20) main_sizer.Add(fwd_sizer, 0, wx.ALIGN_CENTER) main_sizer.Add(middle_sizer, 0, wx.ALIGN_CENTER) main_sizer.Add(bwdSizer, 0, wx.ALIGN_CENTER) main_sizer.AddSpacer(30) main_sizer.Add(batterySizer, 0, wx.ALIGN_LEFT) main_sizer.Add(firmwareSizer, 0, wx.ALIGN_LEFT) main_sizer.AddSpacer(20) main_sizer.Add(exit_sizer, 0, wx.ALIGN_RIGHT) self.SetSizerAndFit(main_sizer)
def __init__(self, parent, name, evidenceDetails, caseDir, caseDbPath): # begin wxGlade: MyFrame.__init__ wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) self.notebookTab = " " self.panel_1 = wx.Panel(self, wx.ID_ANY) self.window_1 = wx.SplitterWindow(self.panel_1, wx.ID_ANY) self.window_top_pane = wx.Panel(self.window_1, wx.ID_ANY) self.notebook = wx.Notebook(self.window_top_pane, wx.ID_ANY) self.notebook_pane_Hex = wx.Panel(self.notebook, wx.ID_ANY) self.text_ctrl_hex = wx.TextCtrl(self.notebook_pane_Hex, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.notebook_pane_String = wx.Panel(self.notebook, wx.ID_ANY) self.text_ctrl_String = wx.TextCtrl(self.notebook_pane_String, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) #bitmap will return error type 50 if file not found/cannot be read self.notebook_pane_Image = wx.Panel(self.notebook, wx.ID_ANY) self.bitmap = wx.StaticBitmap(self.notebook_pane_Image, wx.ID_ANY) self.notebook_pane_IndexText = wx.Panel(self.notebook, wx.ID_ANY) self.text_ctrl_IndexText = wx.TextCtrl(self.notebook_pane_IndexText, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.notebook_pane_FileMetadata = wx.Panel(self.notebook, wx.ID_ANY) self.text_ctrl_FileMetadata = wx.TextCtrl( self.notebook_pane_FileMetadata, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.window_bottom_pane = wx.Panel(self.window_1, wx.ID_ANY) self.list_ctrl = wx.ListCtrl(self.window_bottom_pane, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListItemSel, self.list_ctrl) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onNotebookPageChange, self.notebook) self.popupmenu = wx.Menu() rightClickItem = self.popupmenu.Append(-1, "View in file directory") self.Bind(wx.EVT_MENU, self.onViewDir, id=rightClickItem.GetId()) self.popupmenu.AppendSeparator() rightClickItem = self.popupmenu.Append(-1, "Extract to") self.Bind(wx.EVT_MENU, self.onExtract, id=rightClickItem.GetId()) self.popupmenu.AppendSeparator() self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.onRightClick, self.list_ctrl) global caseDirectory, evidenceInfo, caseDb, auiPageName caseDirectory = caseDir evidenceInfo = evidenceDetails caseDb = caseDbPath auiPageName = name self.__set_properties() self.__do_layout()
def __init__(self, parent, iBayesactSim, iOptionsBayesactPanel, iBayesactInteractiveGuiPanel=None, **kwargs): wx.Panel.__init__(self, parent, **kwargs) self.m_OptionsBayesactSimPanel = iOptionsBayesactPanel self.m_BayesactSim = iBayesactSim self.m_BayesactInteractiveGuiPanel = iBayesactInteractiveGuiPanel # You can use self.GetParent() to get the parent, but I like things explicit self.m_SimInteractiveTabs = parent # These are for all the options you can fill into the simulation ######################################################################################## #self.m_SliderSize = (180, 24) #self.m_TextBoxSize = (110, 28) #self.m_ComboBoxSize = (110, 28) #self.m_ButtonSize = (190, 28) self.m_SliderSize = wx.DefaultSize self.m_TextBoxSize = wx.DefaultSize self.m_ComboBoxSize = wx.DefaultSize self.m_ButtonSize = (110, 30) self.m_StaticTextXAlign = 10 self.m_TextboxXAlign = 170 self.m_SliderXAlign = 290 # This here specifies where the client and agent is aligned on the y co-ordinates # The reason why the initialization statements here look long is because I coded them to be relative to each other # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! self.m_ClientYAlign = 40 self.m_AgentYAlign = 200 self.m_HelpButtonXAlign = 60 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! macButtonYDiscrepancy = 0 if (cSystemConstants.m_OS == cSystemConstants.m_MacOS): macButtonYDiscrepancy = -5 # To draw a rectangle to outline the clients and agents self.Bind(wx.EVT_PAINT, self.onDrawOutlines) self.m_ClientStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_ClientText, pos=(self.m_StaticTextXAlign, self.m_ClientYAlign - 35)) # Client Options ################################################################# # The Client and Agent alpha and beta values # Box sizes for windows and mac are: (110 by 28) and (106 by 20) pixels respectively self.m_ClientAlphaStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_ClientAlpha, pos=(self.m_StaticTextXAlign, self.m_ClientYAlign)) self.m_ClientAlphaTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_ClientAlphaStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_ClientAlphaDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_ClientAlphaTextBox.Bind(wx.EVT_TEXT, self.onSetClientAlphaFlag) self.m_ClientAlphaButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_ClientAlphaStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_ClientAlphaButton.Bind( wx.EVT_BUTTON, lambda event, message="Alpha", title="Help": self. onSpawnMessageBox(event, message, title)) # Default size on windows is (100, 24) self.m_ClientAlphaSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_ClientAlphaDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_ClientAlphaTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinAlpha * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxAlpha * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_ClientAlphaSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_ClientAlphaTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_ClientBetaOfClientStaticTextPosition = self.m_StaticTextXAlign, self.m_ClientAlphaStaticText.GetPosition( )[1] + 30 self.m_ClientBetaOfClientStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_ClientBetaOfClient, pos=self.m_ClientBetaOfClientStaticTextPosition) self.m_ClientBetaOfClientSubscript_c_StaticText = wx.StaticText( self, -1, cOptionSimConstants.m_Subscript_c, pos=(self.m_ClientBetaOfClientStaticTextPosition[0] + 8, self.m_ClientBetaOfClientStaticTextPosition[1] + 5)) self.m_ClientBetaOfClientTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_ClientBetaOfClientStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_ClientBetaOfClientDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_ClientBetaOfClientTextBox.Bind(wx.EVT_TEXT, self.onSetClientBetaOfClientFlag) self.m_ClientBetaOfClientButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_ClientBetaOfClientStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_ClientBetaOfClientButton.Bind( wx.EVT_BUTTON, lambda event, message="Client's Beta of Client", title="Help": self .onSpawnMessageBox(event, message, title)) self.m_ClientBetaOfClientSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_ClientBetaOfClientDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_ClientBetaOfClientTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinBeta * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxBeta * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_ClientBetaOfClientSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_ClientBetaOfClientTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_ClientBetaOfAgentStaticTextPosition = self.m_StaticTextXAlign, self.m_ClientBetaOfClientStaticText.GetPosition( )[1] + 30 self.m_ClientBetaOfAgentStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_ClientBetaOfClient, pos=self.m_ClientBetaOfAgentStaticTextPosition) self.m_ClientBetaOfAgentSubscript_a_StaticText = wx.StaticText( self, -1, cOptionSimConstants.m_Subscript_a, pos=(self.m_ClientBetaOfAgentStaticTextPosition[0] + 8, self.m_ClientBetaOfAgentStaticTextPosition[1] + 5)) self.m_ClientBetaOfAgentTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_ClientBetaOfAgentStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_ClientBetaOfAgentDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_ClientBetaOfAgentTextBox.Bind(wx.EVT_TEXT, self.onSetClientBetaOfAgentFlag) self.m_ClientBetaOfAgentButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_ClientBetaOfAgentStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_ClientBetaOfAgentButton.Bind( wx.EVT_BUTTON, lambda event, message="Client's Beta of Agent", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_ClientBetaOfAgentSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_ClientBetaOfAgentDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_ClientBetaOfAgentTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinBeta * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxBeta * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_ClientBetaOfAgentSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_ClientBetaOfAgentTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_ClientGammaStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_ClientGamma, pos=(self.m_StaticTextXAlign, self.m_ClientBetaOfAgentStaticText.GetPosition()[1] + 30)) self.m_ClientGammaTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_ClientGammaStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_GammaValueDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_ClientGammaTextBox.Bind(wx.EVT_TEXT, self.onSetClientGammaFlag) self.m_ClientGammaButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_ClientGammaStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_ClientGammaButton.Bind( wx.EVT_BUTTON, lambda event, message="Client's Gamma Value", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_ClientGammaSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_GammaValueDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_ClientGammaTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinGamma * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxGamma * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_ClientGammaSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_ClientGammaTextBox: self. onChangeValueViaSlider(event, textBox)) ################################################################# self.m_AgentStaticText = wx.StaticText(self, -1, cOptionSimConstants.m_AgentText, pos=(self.m_StaticTextXAlign, self.m_AgentYAlign - 35)) # Agent Options ################################################################# self.m_AgentAlphaStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_AgentAlpha, pos=(self.m_StaticTextXAlign, self.m_AgentYAlign)) self.m_AgentAlphaTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_AgentAlphaStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_AgentAlphaDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_AgentAlphaTextBox.Bind(wx.EVT_TEXT, self.onSetAgentAlphaFlag) self.m_AgentAlphaButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_AgentAlphaStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_AgentAlphaButton.Bind( wx.EVT_BUTTON, lambda event, message="Alpha", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_AgentAlphaSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_AgentAlphaDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_AgentAlphaTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinAlpha * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxAlpha * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_AgentAlphaSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_AgentAlphaTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_AgentBetaOfClientStaticTextPosition = self.m_StaticTextXAlign, self.m_AgentAlphaStaticText.GetPosition( )[1] + 30 self.m_AgentBetaOfClientStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_AgentBetaOfClient, pos=self.m_AgentBetaOfClientStaticTextPosition) self.m_AgentBetaOfClientSubscript_c_StaticText = wx.StaticText( self, -1, cOptionSimConstants.m_Subscript_c, pos=(self.m_AgentBetaOfClientStaticTextPosition[0] + 8, self.m_AgentBetaOfClientStaticTextPosition[1] + 5)) self.m_AgentBetaOfClientTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_AgentBetaOfClientStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_AgentBetaOfClientDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_AgentBetaOfClientTextBox.Bind(wx.EVT_TEXT, self.onSetAgentBetaOfClientFlag) self.m_AgentBetaOfClientButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_AgentBetaOfClientStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_AgentBetaOfClientButton.Bind( wx.EVT_BUTTON, lambda event, message="Agent's Beta of Client", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_AgentBetaOfClientSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_AgentBetaOfClientDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_AgentBetaOfClientTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinBeta * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxBeta * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_AgentBetaOfClientSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_AgentBetaOfClientTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_AgentBetaOfAgentStaticTextPosition = self.m_StaticTextXAlign, self.m_AgentBetaOfClientStaticText.GetPosition( )[1] + 30 self.m_AgentBetaOfAgentStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_AgentBetaOfClient, pos=self.m_AgentBetaOfAgentStaticTextPosition) self.m_AgentBetaOfAgentSubscript_a_StaticText = wx.StaticText( self, -1, cOptionSimConstants.m_Subscript_a, pos=(self.m_AgentBetaOfAgentStaticTextPosition[0] + 8, self.m_AgentBetaOfAgentStaticTextPosition[1] + 5)) self.m_AgentBetaOfAgentTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_AgentBetaOfAgentStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_AgentBetaOfAgentDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_AgentBetaOfAgentTextBox.Bind(wx.EVT_TEXT, self.onSetAgentBetaOfAgentFlag) self.m_AgentBetaOfAgentButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_AgentBetaOfAgentStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_AgentBetaOfAgentButton.Bind( wx.EVT_BUTTON, lambda event, message="Agent's Beta of Agent", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_AgentBetaOfAgentSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_AgentBetaOfAgentDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_AgentBetaOfAgentTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinBeta * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxBeta * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_AgentBetaOfAgentSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_AgentBetaOfAgentTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_AgentGammaStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_AgentGamma, pos=(self.m_StaticTextXAlign, self.m_AgentBetaOfAgentStaticText.GetPosition()[1] + 30)) self.m_AgentGammaTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_AgentGammaStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_GammaValueDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_AgentGammaTextBox.Bind(wx.EVT_TEXT, self.onSetAgentGammaFlag) self.m_AgentGammaButton = wx.Button( self, -1, "?", pos=(self.m_HelpButtonXAlign, self.m_AgentGammaStaticText.GetPosition()[1] + macButtonYDiscrepancy), size=(20, 20)) self.m_AgentGammaButton.Bind( wx.EVT_BUTTON, lambda event, message="Agent's Gamma Value", title="Help": self. onSpawnMessageBox(event, message, title)) self.m_AgentGammaSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_GammaValueDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_AgentGammaTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinGamma * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxGamma * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_AgentGammaSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_AgentGammaTextBox: self. onChangeValueViaSlider(event, textBox)) ################################################################# self.m_EnvironmentNoiseStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_EnvironmentNoise, pos=(self.m_StaticTextXAlign, 340)) self.m_EnvironmentNoiseTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_EnvironmentNoiseStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_EnvironmentNoiseDefault), validator=cNumericValidatorTextBox(iDecimals=True, iNegative=False)) self.m_EnvironmentNoiseTextBox.Bind(wx.EVT_TEXT, self.onSetEnvironmentNoiseFlag) self.m_EnvironmentNoiseSlider = wx.Slider( self, -1, value=cOptionSimConstants.m_EnvironmentNoiseDefault * cSliderConstants.m_Precision, pos=(self.m_SliderXAlign, self.m_EnvironmentNoiseTextBox.GetPosition()[1]), size=self.m_SliderSize, minValue=cOptionSimConstants.m_MinEnvironmentNoise * cSliderConstants.m_Precision, maxValue=cOptionSimConstants.m_MaxEnvironmentNoise * cSliderConstants.m_Precision, style=wx.SL_HORIZONTAL) self.m_EnvironmentNoiseSlider.Bind( wx.EVT_SCROLL, lambda event, textBox=self.m_EnvironmentNoiseTextBox: self. onChangeValueViaSlider(event, textBox)) self.m_NumberOfStepsStaticText = wx.StaticText( self, -1, cOptionSimConstants.m_NumSteps, pos=(self.m_StaticTextXAlign, 370)) self.m_NumberOfStepsTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_NumberOfStepsStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, value=str(cOptionSimConstants.m_NumStepsDefault), validator=cNumericValidatorTextBox(iDecimals=False, iNegative=False)) self.m_NumberOfStepsTextBox.Bind(wx.EVT_TEXT, self.onSetNumStepsFlag) self.m_CurrentIterationsStaticText = wx.StaticText( self, -1, "Current Iteration", pos=(self.m_StaticTextXAlign, 400)) self.m_CurrentIterationsTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_CurrentIterationsStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, style=wx.TE_READONLY) self.m_CurrentIterationsTextBox.SetValue( str(self.m_BayesactSim.total_iterations)) self.m_PreviousIterationsStaticText = wx.StaticText( self, -1, "Previous Iteration", pos=(self.m_StaticTextXAlign, 430)) self.m_PreviousIterationsTextBox = wx.TextCtrl( self, -1, pos=(self.m_TextboxXAlign, self.m_PreviousIterationsStaticText.GetPosition()[1] - 2), size=self.m_TextBoxSize, style=wx.TE_READONLY) self.m_PreviousIterationsTextBox.SetValue("0") ######################################################################################## self.m_StartButton = wx.Button(self, -1, label="Start", pos=(10, 470), size=self.m_ButtonSize) self.m_StartButton.Bind(wx.EVT_BUTTON, self.onStartBayesactSim) self.m_StepButton = wx.Button(self, -1, label="Step", pos=(140, 470), size=self.m_ButtonSize) self.m_StepButton.Bind(wx.EVT_BUTTON, self.onStepBayesactSim) self.m_StopButton = wx.Button(self, -1, label="Stop", pos=(270, 470), size=self.m_ButtonSize) self.m_StopButton.Bind(wx.EVT_BUTTON, self.onStopBayesactSim) #self.m_PauseButton = wx.Button(self, -1, label="Pause", pos=(10, 400), size=(190, 28)) #self.m_PauseButton.Bind(wx.EVT_BUTTON, self.onPauseBayesactSim) #self.m_ResumeButton = wx.Button(self, -1, label="Resume", pos=(10, 430), size=(190, 28)) #self.m_ResumeButton.Bind(wx.EVT_BUTTON, self.onResumeBayesactSim) #self.m_StopButton = wx.Button(self, -1, label="Stop", pos=(10, 460), size=(190, 28)) #self.m_StopButton.Bind(wx.EVT_BUTTON, self.onStopBayesactSim) macImageYDiscrepancy = 0 if (cSystemConstants.m_OS == cSystemConstants.m_MacOS): macImageYDiscrepancy = -3 # The set mask colour (255, 255, 255) which is white, becomes transparent bmp = wx.Image("./gui/images/circleMagenta.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_GreenCircle = wx.StaticBitmap(self, -1, bmp, pos=(10, 525 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_Green2StaticText = wx.StaticText(self, -1, "What Client thinks of self", pos=(30, 520)) bmp = wx.Image("./gui/images/circleRed.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_PinkCircle = wx.StaticBitmap(self, -1, bmp, pos=(10, 545 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_Pink2StaticText = wx.StaticText(self, -1, "What Client thinks of agent", pos=(30, 540)) bmp = wx.Image("./gui/images/circleCyan.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_GoldenrodCircle = wx.StaticBitmap( self, -1, bmp, pos=(10, 565 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_Yellow2StaticText = wx.StaticText(self, -1, "What Agent thinks of self", pos=(30, 560)) bmp = wx.Image("./gui/images/circleBlue.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_BlueCircle = wx.StaticBitmap(self, -1, bmp, pos=(10, 585 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_Blue2StaticText = wx.StaticText(self, -1, "What Agent thinks of client", pos=(30, 580)) bmp = wx.Image("./gui/images/starMagenta.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_CyanStar = wx.StaticBitmap(self, -1, bmp, pos=(240, 523 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_CyanStarStaticText = wx.StaticText(self, -1, "Client action", pos=(260, 520)) bmp = wx.Image("./gui/images/starCyan.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap() bmp.SetMaskColour((255, 255, 255)) self.m_YellowStar = wx.StaticBitmap(self, -1, bmp, pos=(240, 563 + macImageYDiscrepancy), size=(bmp.GetWidth(), bmp.GetHeight())) self.m_YellowStarStaticText = wx.StaticText(self, -1, "Agent Action", pos=(260, 560)) self.updateSettingsFromBayesact()
def __init__(self, parent, title, studentId): '''初始化学生表总体布局,包括各种控件''' global reader_id reader_id = studentId wx.Frame.__init__(self, parent, title=title, size=(480, 480)) #定一个网格布局,两行一列 self.main_layout = wx.BoxSizer(wx.VERTICAL) self.panel_1 = wx.Panel(self, pos = (0, 0), size = (480, 180)) self.panel_1.SetBackgroundColour("#FFFFFF") self.panel_2 = wx.Panel(self, pos = (0, 400), size = (480, 100)) self.panel_2.SetBackgroundColour("#FFFFFF") self.dbhelper = DBHelper() data = self.dbhelper.getStudentById(studentId) self.studentid = studentId self.stuname = data[2] self.insname = data[4] self.tele = str(data[5]) self.money = data[8]# 欠款 Font1 = wx.Font(14,wx.DECORATIVE,wx.NORMAL,wx.BOLD) Font2 = wx.Font(14,wx.DECORATIVE,wx.NORMAL,wx.NORMAL,True) stu_id = wx.StaticText(self.panel_1, label = "学号: ", pos = (8, 10), size = (60, 25)) stu_id.SetBackgroundColour("#FFFFFF") stu_id_text = wx.StaticText(self.panel_1, label = str(self.studentid), pos = (75, 10), size = (250, 25)) stu_id_text.SetFont(Font2) stu_id.SetFont(Font1) stu_name = wx.StaticText(self.panel_1, label = "姓名: ", pos = (8, 40), size = (60, 20)) stu_name.SetBackgroundColour("#FFFFFF") stu_name_text = wx.StaticText(self.panel_1, label = self.stuname, pos = (75, 40), size = (250, 20)) stu_name_text.SetFont(Font2) stu_name.SetFont(Font1) ins_name = wx.StaticText(self.panel_1, label = "学院: ", pos = (8, 65), size = (60, 20)) ins_name.SetBackgroundColour("#FFFFFF") ins_name_text = wx.StaticText(self.panel_1, label = self.insname, pos = (75, 65), size = (250, 20)) ins_name_text.SetFont(Font2) ins_name.SetFont(Font1) tele = wx.StaticText(self.panel_1, label = "电话: ", pos = (8, 90), size = (60, 20)) tele.SetBackgroundColour("#FFFFFF") tele_text = wx.StaticText(self.panel_1, label = self.tele, pos = (75, 90), size = (250, 20)) tele_text.SetFont(Font2) tele.SetFont(Font1) money = wx.StaticText(self.panel_1, label = "欠款:", pos = (8, 115), size = (60, 20)) money.SetBackgroundColour("#FFFFFF") money_text = wx.StaticText(self.panel_1, label = str(self.money), pos = (75, 115), size = (250, 20)) money_text.SetFont(Font2) money.SetFont(Font1) self.money_show = money_text reserve_tip = wx.StaticText(self.panel_1, label = "预约图书:", pos = (8, 148), size = (60, 25)) reserve_tip.SetBackgroundColour("#FFFFFF") reserve_text = wx.TextCtrl(self.panel_1, pos = (70,145), size = (180, 25)) reserve_tip.SetBackgroundColour("#FFFFFF") reserve_text.SetEditable(False) last_time = self.dbhelper.lasttime(reader_id) time_tip = wx.StaticText(self.panel_1, label="最晚取书日期:", pos=(258, 148), size=(80, 25)) time_tip.SetBackgroundColour("#FFFFFF") if last_time == 0: time_text = wx.StaticText(self.panel_1, label = "空", pos=(350, 148), size=(70, 25)) time_tip.SetBackgroundColour("#FFFFFF") else: time_text = wx.StaticText(self.panel_1, label=self.dbhelper.lasttime(reader_id), pos=(350, 148), size=(70, 25)) time_tip.SetBackgroundColour("#FFFFFF") self.last_time = time_text #reserve_tip.SetFont(Font1) #reserve_text.SetFont(Font1) self.resbook = reserve_text image = wx.Image('student.jpg', wx.BITMAP_TYPE_JPEG) w = image.GetWidth() h = image.GetHeight() bmp = image.Scale(w/6, h/6).ConvertToBitmap() wx.StaticBitmap(self, -1, bmp, pos=(300,8)) #借书列表 self.list = wx.ListCtrl(self, -1, pos=(0,0) ,size = (480,200), style = wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES | wx.LC_SINGLE_SEL) #列表有散列 self.list.InsertColumn(0, "ID") self.list.InsertColumn(1, "书名") self.list.InsertColumn(2, "借书日期") self.list.InsertColumn(3, "应还日期") self.list.InsertColumn(4, "续借状态") #设置各列的宽度 self.list.SetColumnWidth(0, 65) self.list.SetColumnWidth(1, 120) self.list.SetColumnWidth(2, 100) self.list.SetColumnWidth(3, 100) self.list.SetColumnWidth(4, 70) #定义一组按钮 return_button = wx.Button(self.panel_2, label = "还书", pos = (10, 15), size = (60, 30)) renew_button = wx.Button(self.panel_2, label = "续借", pos = (85, 15), size = (60, 30)) borrow_button = wx.Button(self.panel_2, label = "借阅", pos = (160, 15), size = (60, 30)) fine_button = wx.Button(self.panel_2, label = "交罚款", pos = (235, 15), size = (60, 30)) reserveq_button = wx.Button(self.panel_2, label = "取消预约", pos = (310, 15), size = (60, 30)) flash_button = wx.Button(self.panel_2, label = "修改密码", pos = (385, 15), size = (60, 30)) #w为按钮绑定相应事件函数,第一个参数为默认参数,指明为按钮类事件,第二个为事件函数名,第三个为按钮名 self.Bind(wx.EVT_BUTTON, self.return_book, return_button) self.Bind(wx.EVT_BUTTON, self.borrow, borrow_button) self.Bind(wx.EVT_BUTTON, self.renew, renew_button) self.Bind(wx.EVT_BUTTON, self.fine, fine_button) self.Bind(wx.EVT_BUTTON, self.quit, reserveq_button) self.Bind(wx.EVT_BUTTON, self.flash, flash_button) #将列表和panel添加到主面板 self.main_layout.Add(self.panel_1, 1) self.main_layout.Add(self.list, 2) self.main_layout.Add(self.panel_2, 1) self.SetSizer(self.main_layout) items = self.dbhelper.bookOwned(studentId) for item in items: index = self.list.InsertItem(self.list.GetItemCount(), str(item[0])) self.list.SetItem(index, 1, str(item[1])) self.list.SetItem(index, 2, str(item[2])) self.list.SetItem(index, 3, str(item[3])) self.list.SetItem(index, 4, str(item[4])) bookname = self.dbhelper.getReservedBook(self.studentid) self.resbook.SetValue(bookname)
def __init__(self, parent): """Constructor""" global robotbitmap wx.Panel.__init__(self, parent=parent) # self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetBackgroundColour(wx.Colour(255, 255, 255)) self.frame = parent # font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, u'Consolas') font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, u'Helvetica') self.SetFont(font) vSizer = wx.BoxSizer(wx.VERTICAL) hSizer = wx.BoxSizer(wx.HORIZONTAL) # Draw the photograph. robot = read_state() print("Loading Scratch up for {}".format(robot)) logo_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.Bitmap(ICON_PATH + "dexter_industries_logo.png", type=wx.BITMAP_TYPE_PNG) bitmap = wx.StaticBitmap(self, bitmap=bmp) bmpW, bmpH = bitmap.GetSize() logo_sizer.Add(bitmap, 0, wx.RIGHT | wx.LEFT | wx.EXPAND) #------------------------------------------------------------------- # Standard Buttons buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) left_buttons_sizer = wx.BoxSizer(wx.VERTICAL) right_buttons_sizer = wx.BoxSizer(wx.VERTICAL) # Drop Boxes controls = [ 'GoPiGo', 'GrovePi', 'BrickPi', 'PivotPi', 'Just Scratch, no Robot.' ] # Options for drop down. # Select Platform. state = read_state() if state in controls: robotDrop = wx.ComboBox(self, -1, str(state), choices=controls, style=wx.CB_READONLY) # Drop down setup else: write_state("GoPiGo") robotDrop = wx.ComboBox(self, -1, "GoPiGo", choices=controls, style=wx.CB_READONLY) # Drop down setup robotDrop.Bind(wx.EVT_COMBOBOX, self.robotDrop) # Binds drop down. # Start Programming start_programming = wx.Button(self, label="Start Programming") start_programming.Bind(wx.EVT_BUTTON, self.start_programming) # Open Examples examples_button = wx.Button(self, label="Open Examples") examples_button.Bind(wx.EVT_BUTTON, self.examples) # # Update Curriculum # curriculum_update = wx.Button(self, label="Update GoBox", pos=(25,375)) # curriculum_update.Bind(wx.EVT_BUTTON, self.curriculum_update) # About about_button = wx.Button(self, label="About") about_button.Bind(wx.EVT_BUTTON, self.About) # Exit exit_button = wx.Button(self, label="Exit") exit_button.Bind(wx.EVT_BUTTON, self.onClose) left_buttons_sizer.Add(robotDrop, 1) left_buttons_sizer.AddSpacer(20) left_buttons_sizer.Add(start_programming, 1) left_buttons_sizer.AddSpacer(20) left_buttons_sizer.Add(examples_button, 1) left_buttons_sizer.AddSpacer(20) left_buttons_sizer.Add(about_button, 1) left_buttons_sizer.AddSpacer(20) left_buttons_sizer.Add(exit_button, 1) icon_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.Bitmap(ICON_PATH + robot + ".png", type=wx.BITMAP_TYPE_PNG) robotbitmap = wx.StaticBitmap(self, bitmap=bmp) bmpW, bmpH = robotbitmap.GetSize() icon_sizer.Add(robotbitmap, 0, wx.RIGHT | wx.LEFT | wx.EXPAND) # Test Hardware test_button = wx.Button(self, label="Demo Hardware") test_button.Bind(wx.EVT_BUTTON, self.test) # Bind Stop Button stop_gopigo = wx.Button(self, label="Stop GoPiGo") stop_gopigo.SetForegroundColour('red') stop_gopigo.Bind(wx.EVT_BUTTON, self.stop_gopigo) right_buttons_sizer.Add(icon_sizer) right_buttons_sizer.Add(test_button) right_buttons_sizer.AddSpacer(20) right_buttons_sizer.Add(stop_gopigo, 1, wx.EXPAND) # End Standard Buttons #------------------------------------------------------------------- # wx.StaticText(self, -1, "Select a Robot:", (25, 205)) # (Minus 50, minus 0) # wx.StaticText(self, -1, "Caution: Do not close the LXTerminal window running \nin the background right now.", (25, 520)) footnote_sizer = wx.BoxSizer(wx.HORIZONTAL) footnote = wx.StaticText( self, -1, "Caution: Do not close the Scratch Controller window \nrunning in the background when you start Scratch." ) footnote_sizer.AddSpacer(20) footnote_sizer.Add(footnote, 1, wx.EXPAND) footnote_sizer.AddSpacer(20) # Drop Boxes #------------------------------------------------------------------- # vSizer.Add((1,1), 1, wx.EXPAND) # # vSizer.Add(hSizer, 0, wx.TOP, 100) # vSizer.Add((1,1), 0, wx.ALL, 75) vSizer.Add(logo_sizer, 0, wx.SHAPED | wx.EXPAND) buttons_sizer.AddSpacer(20) buttons_sizer.Add(left_buttons_sizer, 1, wx.EXPAND) buttons_sizer.Add(right_buttons_sizer, 1, wx.EXPAND) buttons_sizer.AddSpacer(20) vSizer.Add(buttons_sizer, 1, wx.EXPAND) vSizer.AddSpacer(20) vSizer.Add(footnote_sizer, 1, wx.EXPAND) # vSizer.Add(right_buttons_sizer,1,wx.EXPAND) self.SetSizerAndFit(vSizer)
def __init__(self, *args, **kwds): # begin wxGlade: frmRipper.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.lblTempPath = wx.StaticText(self, -1, "Working path:", style=wx.ALIGN_RIGHT) self.txtTempPath = wx.TextCtrl(self, -1, "/tmp") self.cmdTempPath = wx.Button(self, ID_CHOOSETMPPATH, "...", style=wx.BU_LEFT) self.lblOutPath = wx.StaticText(self, -1, "Final output path:", style=wx.ALIGN_RIGHT) self.txtOutPath = wx.TextCtrl(self, -1, "") self.cmdOutPath = wx.Button(self, ID_CHOOSEOUTPATH, "...", style=wx.BU_LEFT) self.chkEject = wx.CheckBox(self, -1, "Eject CD when done") self.lblCoverArt = wx.StaticText(self, -1, "Cover Art (APPLICATION blocks):") self.bmpCoverArt = wx.StaticBitmap(self, -1, wx.EmptyBitmap(120, 120), style=wx.SIMPLE_BORDER) self.lblCoverArtFilename = wx.StaticText(self, -1, "None Selected") self.lblMimeType = wx.StaticText(self, -1, "application/unknown") self.lblCoverArtSize = wx.StaticText(self, -1, "0 bytes") self.cmdCoverArt = wx.Button(self, ID_CHOOSECOVERART, "...", style=wx.BU_LEFT) self.cmdDetectCD = wx.ToggleButton(self, ID_DETECTCD, "Detect CD") self.cmdRip = wx.ToggleButton(self, ID_RIP, "Rip") #self.cmdWebBrowser = wx.Button(self, ID_WEBBROWSER, "Look Up") self.cmdClose = wx.Button(self, ID_CLOSE, "Close") self.lblTags = wx.StaticText(self, -1, "Tags (VORBIS_COMMENT block):") self.txtTags = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE) self.lblMessages = wx.StaticText(self, -1, "Messages:") self.txtMessages = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE) self.lblProgress = wx.StaticText(self, -1, "Idle") self.__set_properties() self.__do_layout() # end wxGlade wx.Log.SetActiveTarget(wx.LogTextCtrl(self.txtMessages)) wx.EVT_BUTTON(self, ID_CHOOSECOVERART, self.OnChooseCoverArt) wx.EVT_BUTTON(self, ID_CHOOSETMPPATH, self.OnChooseTmpPath) wx.EVT_BUTTON(self, ID_CHOOSEOUTPATH, self.OnChooseOutPath) wx.EVT_TOGGLEBUTTON(self, ID_DETECTCD, self.OnDetectCD) wx.EVT_TOGGLEBUTTON(self, ID_RIP, self.OnRip) wx.EVT_BUTTON(self, ID_CLOSE, self.OnClose) wx.EVT_BUTTON(self, ID_WEBBROWSER, self.OnWebBrowser) self.timer = wx.Timer(self, ID_TIMER) wx.EVT_TIMER(self, ID_TIMER, self.OnIdle) #wx.EVT_IDLE(self, self.OnIdle) self.coverart = None self.workdir = None self.cancelled = False self.cddevice = None self.txtTags.SetValue("Click Detect CD to fill in tag information\n" \ "automatically using the MusicBrainz database.\n\n" \ "Click Rip to start ripping. You may still edit\n" \ "tags and select cover art after ripping has\n" \ "started.") self.setUIState(STATE_IDLE) self.CheckBinaries()
def lightBox(self, i, evt=None): # Which target we clicked on _t = time() i = self.visible_to_index[i + evt.GetPositionTuple()[0] / self.targetw] print "...Starting LightBox...", i targetpath = self.lookupFullList(i)[0] balid, side = targetpath[0], targetpath[1] imgpaths = sorted(self.bal2imgs[balid], key=lambda imP: self.img2page[imP]) ballotpath = imgpaths[side] if not os.path.exists(ballotpath): dlg = wx.MessageDialog( self, message= "Oh no. We couldn't open this ballot for some reason ...", style=wx.ID_OK) dlg.ShowModal() return pan = wx.Panel(self.parent, size=self.parent.thesize, pos=(0, 0)) before = Image.open(ballotpath).convert("RGB") dur = time() - _t print " Phase 1: {0} s".format(dur) _t = time() doflip = self.img2flip[ballotpath] if doflip: before = before.rotate(180) if before.size[1] > self.parent.thesize[1]: fact = float(before.size[1]) / self.parent.thesize[1] before = before.resize( (int(before.size[0] / fact), int(before.size[1] / fact))) else: fact = 1 temp = before.copy() draw = ImageDraw.Draw(temp) ballotid = self.img2bal[ballotpath] input_target_id = targetpath[2] dur = time() - _t print " Phase 2: {0} s".format(dur) _t = time() indexs = [] other_stuff = [] targetids = self.sample_to_targets(ballotpath) target_bboxes = self.sample_to_target_bboxes(ballotpath) page = self.img2page[ballotpath] for tid, bbox in zip(targetids, target_bboxes): ind = self.classified_lookup[tid] indexs.append(([a / fact for a in bbox], ind)) other_stuff.append((ind, bbox, tid)) print " Phase 3: {0} s".format(time() - _t) _t = time() for (ind, locs, tid) in other_stuff: # Note to self: # when adding target-adjustment from here, you need to some how map # targetID name -> index in the list to find if it is 'wrong' or not. color = (0, 255, 0) if tid[2] == input_target_id else (0, 0, 200) draw.rectangle(((locs[2]) / fact - 1, (locs[0]) / fact - 1, (locs[3]) / fact + 1, (locs[1]) / fact + 1), outline=color) draw.rectangle(((locs[2]) / fact - 2, (locs[0]) / fact - 2, (locs[3]) / fact + 2, (locs[1]) / fact + 2), outline=color) isfilled = (ind < self.threshold) ^ (ind in self.wrong) if isfilled: draw.rectangle(((locs[2]) / fact, (locs[0]) / fact, (locs[3]) / fact, (locs[1]) / fact), fill=(255, 0, 0)) print " Phase 4: {0} s".format(time() - _t) _t = time() img = wx.StaticBitmap(pan, -1, pil2wxb(Image.blend(before, temp, .5))) def markwrong(evt): x, y = evt.GetPositionTuple() for (u, d, l, r), index in indexs: if l <= x <= r and u <= y <= d: print "IS", index self.markWrong(index) img.Bind(wx.EVT_LEFT_DOWN, markwrong) def remove(x): pan.Destroy() ifflipped = "(auto-flipped)" if doflip else "" def lines(x): if len(x) < 60: return x return x[:60] + "\n" + lines(x[60:]) templatepath = self.get_meta(self.img2bal[ballotpath], page)['template'] wx.StaticText(pan, label="Ballot image:\n" + lines(ballotpath) + "\n\nTemplate image:\n" + lines(templatepath) + "\n\n" + ifflipped, pos=(before.size[0], before.size[1] / 3)) b = wx.Button(pan, label="Back", pos=(before.size[0], 2 * before.size[1] / 3)) b.Bind(wx.EVT_BUTTON, remove) q = wx.Button(pan, label="Quarantine", pos=(before.size[0], 2 * before.size[1] / 3 + 50)) q.Bind(wx.EVT_BUTTON, lambda x: self.markQuarantine(i))
def _element_setup(self): self.figure = Figure((8.5, 3)) self.canvas = FigureCanvas(self, wx.ID_ANY, self.figure) self.temperature_plot = LiveCoffeeGraph(self.canvas) self.coffee_img = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap("./cslogo.png", wx.BITMAP_TYPE_ANY)) self.temp_readout = wx.TextCtrl(self, id=wx.ID_ANY, value='', size=(220, 220), style=wx.VSCROLL | wx.TE_MULTILINE | wx.EXPAND) self.temperature_label = wx.StaticText(self, wx.ID_ANY, "Temperature:", style=wx.ALIGN_LEFT) self.max_temperature_label = wx.StaticText(self, wx.ID_ANY, "Max temperature:", style=wx.ALIGN_LEFT) self.Rate_of_change_label = wx.StaticText(self, wx.ID_ANY, "Rate of Change:", style=wx.ALIGN_LEFT) self.elapsed_time_label = wx.StaticText(self, wx.ID_ANY, "Elapsed time:", style=wx.ALIGN_LEFT) self.current_temp = wx.StaticText(self, wx.ID_ANY, "212.4", style=wx.ALIGN_RIGHT) self.maximum_temp = wx.StaticText(self, wx.ID_ANY, "250.4", style=wx.ALIGN_RIGHT) self.rate_of_change = wx.StaticText(self, wx.ID_ANY, ".04C/min", style=wx.ALIGN_RIGHT) self.elapsed_time = wx.StaticText(self, wx.ID_ANY, "00:00", style=wx.ALIGN_RIGHT) self.auto_power_chkbx = wx.CheckBox(self, id=wx.ID_ANY, label="Auto Power") self.power_slider = wx.Slider(self, wx.ID_ANY, value=67, minValue=0, maxValue=100, pos=wx.DefaultPosition, size=(250, -1), style=wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS) self.first_crack_btn = wx.Button(self, wx.ID_ANY, label=" First \nCrack", size=wx.Size(90, 50)) self.rolling_first_crack_btn = wx.Button( self, wx.ID_ANY, label=" Rolling \nFirst Crack", size=wx.Size(90, 50)) self.second_crack_btn = wx.Button(self, wx.ID_ANY, label="Second \n Crack", size=wx.Size(90, 50)) self.rolling_second_crack_btn = wx.Button( self, wx.ID_ANY, label=" Rolling \nSecond Crack", size=wx.Size(90, 50)) self.unload_btn = wx.Button(self, wx.ID_ANY, label="Unload", size=wx.Size(90, 50)) self.file_name_label = wx.StaticText(self, wx.ID_ANY, "File Name:") self.file_entry_box = wx.TextCtrl(self, wx.ID_ANY, "20091203.csv", size=(200, 28)) self.vTarget_label = wx.StaticText(self, wx.ID_ANY, "Target:") self.vTarget = wx.SpinCtrlDouble(self, wx.ID_ANY, "0.0", size=(150, 28), min=0, max=250, inc=0.5) self.reset_btn = wx.Button(self, wx.ID_ANY, label="Reset", size=wx.Size(90, 50)) self.save_btn = wx.Button(self, wx.ID_ANY, label="Save", size=wx.Size(90, 50)) self.save_as_btn = wx.Button(self, wx.ID_ANY, label="Save As", size=wx.Size(90, 50)) self.load_profile_btn = wx.Button(self, wx.ID_ANY, label="Load Profile", size=wx.Size(90, 50)) self.quit_btn = wx.Button(self, wx.ID_ANY, label="Quit", size=wx.Size(90, 50))
def __init__(self): wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title=u"Проекции", size=(1024, 768), pos=(150,100)) self.SetIcon(wx.IconFromLocation(wx.IconLocation(r'ico/p1.ico'))) # 4 razmera vidim oblst self.cenx = 0 self.ceny = 0 self.cenz = 0 self.cens = 1 # 3 + 3 solu oblst self.scenx = 0 self.sceny = 0 self.scenz = 0 self.ssizex = 100 self.ssizey = 100 self.ssizez = 100 self.soluType = 3 #2d/3d #self.soluMethod = 0 #int/mcnp/roma self.blocks = [] self.sources = [] self.blockTypes = [] self.bestPoints = [] self.combo = []#subThread.getCombo(len(self.parent.blocks)) #self.bestPoints.append(entity.BestPoints(10,10,10)) #self.bestPoints.append(entity.BestPoints(12,12,12)) #self.bestPoints.append(entity.BestPoints(30,30,30)) #self.bestPoints.append(entity.BestPoints(40,40,40)) self.readTypes() self.curType=1 self.fileName = "" self.worked = True self.nx = 20 self.ny = 20 self.nz = 20 self.mnx = 20 #dlya writemesh self.mny = 20 self.mnz = 20 self.curBestPoint = -1 self.kvantil = -1 self.fon = -1 self.vremya = -1 # blocks.append(entity.Block(self)) # blocks.append(entity.Block(self)) # blocks[0].name = "ccc1" # blocks[1].name = "ccc2" # print blocks[0].name, blocks[1].name sizerMain = wx.BoxSizer( wx.VERTICAL ) #sozdali glavnyi sizer v kotoryi vlojili tool bar i vse ostalnoe self.tBar = toolBar.CreateToolBar(self) #sozdali toolbar sizerContent = wx.GridSizer( 0, 2, 0, 0 ) #sozdali sizer dlya content sizerSetPanels = wx.BoxSizer( wx.VERTICAL ) #sozdali sizer dlya panelei na set paneli self.panelXZ = panels.PanelGraph(self, myid=0) #sozdali panel self.panelYZ = panels.PanelGraph(self, myid=1) self.panelXY = panels.PanelGraph(self, myid=2) self.panelSet = panels.PanelSet(self) #panel set na kotoroi budut knopki pereklucheniya na druguy panel self.curPanel = 0 self.panelBlocks = panels.PanelBlocks(self) #panel nastroiki blokov self.panelBlocks.Hide() self.panelSources = panels.PanelSources(self) #panel nastroiki istochnikov self.panelSources.Hide() self.panelArea = panels.PanelArea(self) #panel nastroiki oblasti self.panelArea.Hide() self.panelSolution = panels.PanelSolution(self) #panel nastroiki vychisleni self.panelSolution.Hide() sizerSetPanels.Add( self.panelSet, 1, wx.EXPAND ) sizerSetPanels.Add( self.panelBlocks, 1, wx.EXPAND ) sizerSetPanels.Add( self.panelSources, 1, wx.EXPAND ) sizerSetPanels.Add( self.panelArea, 1, wx.EXPAND ) sizerSetPanels.Add( self.panelSolution, 1, wx.EXPAND ) sizerContent.Add( self.panelXZ, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 ) #polojili paneli v contentsizer sizerContent.Add( self.panelYZ, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 ) sizerContent.Add( self.panelXY, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 ) sizerContent.Add( sizerSetPanels, 1, wx.EXPAND |wx.BOTTOM|wx.LEFT, 1 ) #self.SetBackgroundColour("yellow") #++++++++++++++++++++++++++UBRAT #sizerMain.Add( self.tBar, 0, wx.EXPAND|wx.BOTTOM, 4 ) #polojili toolbar v mainsizer sizerMain.Add( sizerContent, 1, wx.EXPAND, 5 ) #polojili contentsizer v mainsizer self.SetSizer( sizerMain ) self.Layout() self.statusbar = ESB.EnhancedStatusBar(self, -1) self.statusbar.SetSize((-1, 23)) self.statusbar.SetFieldsCount(1) self.SetStatusBar(self.statusbar) self.gauge = wx.Gauge(self.statusbar, -1, 100, pos=(0,2)) #self.gauge.Hide() bmpBuf = wx.ArtProvider_GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (16,16)) self.btnThreadCancel = wx.StaticBitmap(self.statusbar, -1, bmpBuf, pos=(190,2)) self.btnThreadCancel.Bind(wx.EVT_LEFT_UP, self.abortThread) self.gauge.Hide() self.btnThreadCancel.Hide() self.statictext = wx.StaticText(self.statusbar, -1, "", pos=(350,2)) #self.Bind(wx.EVT_IDLE, self.IdleHandler) # Set up event handler for any worker thread results subThread.EVT_RESULT(self, self.checkThread) self.Bind(wx.EVT_SIZE, self.OnSize)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"RRAP_HCE_182a_R0", pos=wx.DefaultPosition, size=wx.Size(-1, -1), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) fgSizer1 = wx.FlexGridSizer(2, 2, 0, 0) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) gbSizer1 = wx.GridBagSizer(0, 0) gbSizer1.SetFlexibleDirection(wx.BOTH) gbSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"Test Tool Vendor", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) gbSizer1.Add(self.m_staticText1, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.ALL, 8) self.m_staticText11 = wx.StaticText(self, wx.ID_ANY, u"Test Tool Report path", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText11.Wrap(-1) gbSizer1.Add(self.m_staticText11, wx.GBPosition(2, 0), wx.GBSpan(1, 1), wx.ALL, 8) inputChoiceChoices = [u"ICCSolutions", u"Galitt", u"UL"] self.inputChoice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, inputChoiceChoices, 0) self.inputChoice.SetSelection(1) gbSizer1.Add(self.inputChoice, wx.GBPosition(1, 2), wx.GBSpan(1, 1), wx.ALL, 6) self.xmlButton = wx.Button(self, wx.ID_ANY, u"Generate XML Analyze Result", wx.Point(-1, -1), wx.Size(220, -1), 0) self.xmlButton.SetDefault() gbSizer1.Add(self.xmlButton, wx.GBPosition(4, 2), wx.GBSpan(1, 1), wx.ALL, 5) self.pdfButton = wx.Button(self, wx.ID_ANY, u"Generate PDF Analyze Result", wx.Point(-1, -1), wx.Size(220, -1), 0) self.pdfButton.SetDefault() gbSizer1.Add(self.pdfButton, wx.GBPosition(5, 2), wx.GBSpan(1, 1), wx.ALL, 5) self.executeLog = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(500, 400), style=wx.TE_MULTILINE) gbSizer1.Add(self.executeLog, wx.GBPosition(3, 0), wx.GBSpan(1, 5), wx.ALL, 5) gbSizer1.Add((0, 310), wx.GBPosition(3, 5), wx.GBSpan(1, 1), wx.EXPAND, 5) self.inputPath = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select the test report", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) gbSizer1.Add(self.inputPath, wx.GBPosition(2, 2), wx.GBSpan(1, 2), 0, 1) self.m_bitmap3 = wx.StaticBitmap(self, wx.ID_ANY, visa.visa.getBitmap(), wx.DefaultPosition, wx.DefaultSize, 0) gbSizer1.Add(self.m_bitmap3, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.ALL, 5) # self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Developed by", wx.DefaultPosition, wx.DefaultSize, # 0) # self.m_staticText6.Wrap(-1) # self.m_staticText6.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString)) # self.m_staticText6.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)) # gbSizer1.Add(self.m_staticText6, wx.GBPosition(4, 0), wx.GBSpan(1, 1), wx.ALIGN_BOTTOM|wx.ALL, 5) # # #image = wx.Image(u"applus.png", wx.BITMAP_TYPE_ANY) # image = applus.applus.getBitmap().ConvertToImage() # image.Rescale(image.GetWidth()/2.5, image.GetHeight()/2.5) # self.m_bitmap4 = wx.StaticBitmap(self, wx.ID_ANY, image.ConvertToBitmap(), # wx.DefaultPosition, wx.DefaultSize, 0) # # gbSizer1.Add((0, 5), wx.GBPosition(6, 6), wx.GBSpan(1, 1), wx.EXPAND, 5) # # gbSizer1.Add(self.m_bitmap4, wx.GBPosition(5, 0), wx.GBSpan(1, 1), wx.ALL, 5) fgSizer1.Add(gbSizer1, 1, wx.EXPAND, 5) self.SetSizer(fgSizer1) self.Layout() fgSizer1.Fit(self) self.Centre(wx.BOTH) # Connect Events self.xmlButton.Bind(wx.EVT_BUTTON, self.genXmlReport) self.pdfButton.Bind(wx.EVT_BUTTON, self.genPdfReport)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, classparent=None): """ Default class constructor. Used internally. Do not call directly this class in your application! """ wx.Frame.__init__(self, None, -1, "BalloonTip", pos, size, style=wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP) self._parent = classparent self._toptitle = self._parent._toptitle self._topicon = self._parent._topicon self._message = self._parent._message self._shape = self._parent._shape self._tipstyle = self._parent._tipstyle self._ballooncolour = self._parent._ballooncolour self._balloonmsgcolour = self._parent._balloonmsgcolour self._balloonmsgfont = self._parent._balloonmsgfont if self._toptitle != "": self._balloontitlecolour = self._parent._balloontitlecolour self._balloontitlefont = self._parent._balloontitlefont panel = wx.Panel(self, -1) sizer = wx.BoxSizer(wx.VERTICAL) self.panel = panel subsizer = wx.BoxSizer(wx.VERTICAL) hsizer = wx.BoxSizer(wx.HORIZONTAL) subsizer.Add((0, 20), 0, wx.EXPAND) if self._topicon is not None: stb = wx.StaticBitmap(panel, -1, self._topicon) hsizer.Add(stb, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) self._balloonbmp = stb if self._toptitle != "": stt = wx.StaticText(panel, -1, self._toptitle) stt.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False)) if self._topicon is None: hsizer.Add((10, 0), 0, wx.EXPAND) hsizer.Add(stt, 1, wx.EXPAND | wx.TOP, 10) self._balloontitle = stt self._balloontitle.SetForegroundColour(self._balloontitlecolour) self._balloontitle.SetFont(self._balloontitlefont) if self._tipstyle == BT_BUTTON: self._closebutton = GenButton(panel, -1, "X", style=wx.NO_BORDER) self._closebutton.SetMinSize((16, 16)) self._closebutton.SetFont( wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False)) self._closebutton.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterButton) self._closebutton.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveButton) self._closebutton.SetUseFocusIndicator(False) if self._toptitle != "": hsizer.Add(self._closebutton, 0, wx.TOP | wx.RIGHT, 5) else: hsizer.Add((10, 0), 1, wx.EXPAND) hsizer.Add(self._closebutton, 0, wx.ALIGN_RIGHT | wx.TOP | wx.RIGHT, 5) if self._topicon is not None or self._toptitle != "" \ or self._tipstyle == BT_BUTTON: subsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 5) self._firstline = line = wx.StaticLine(panel, -1, style=wx.LI_HORIZONTAL) if self._topicon is not None or self._toptitle != "" \ or self._tipstyle == BT_BUTTON: subsizer.Add(self._firstline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10) else: subsizer.Add(self._firstline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.TOP, 10) mainstt = wx.StaticText(panel, -1, self._message) self._balloonmsg = mainstt self._balloonmsg.SetForegroundColour(self._balloonmsgcolour) self._balloonmsg.SetFont(self._balloonmsgfont) subsizer.Add(self._balloonmsg, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10) self._secondline = wx.StaticLine(panel, -1, style=wx.LI_HORIZONTAL) subsizer.Add(self._secondline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10) subsizer.Add((0, 0), 1) panel.SetSizer(subsizer) sizer.Add(panel, 1, wx.EXPAND) self.SetSizerAndFit(sizer) sizer.Layout() if self._tipstyle == BT_CLICK: if self._toptitle != "": self._balloontitle.Bind(wx.EVT_LEFT_DOWN, self.OnClose) if self._topicon is not None: self._balloonbmp.Bind(wx.EVT_LEFT_DOWN, self.OnClose) self._balloonmsg.Bind(wx.EVT_LEFT_DOWN, self.OnClose) self.panel.Bind(wx.EVT_LEFT_DOWN, self.OnClose) elif self._tipstyle == BT_BUTTON: self._closebutton.Bind(wx.EVT_BUTTON, self.OnClose) self.panel.SetBackgroundColour(self._ballooncolour) if wx.Platform == "__WXGTK__": self.Bind(wx.EVT_WINDOW_CREATE, self.SetBalloonShape) else: self.SetBalloonShape() self.Show(True)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__( self, id=wxID_FRAMEEDICAOALUNO, name=u'frameEdicaoAluno', parent=prnt, pos=wx.Point(700, 273), size=wx.Size(1040, 614), style=wx.DEFAULT_FRAME_STYLE, title=u'Est\xe1gio Curricular - Edi\xe7\xe3o Cadastral de Alunos') self.SetClientSize(wx.Size(1024, 576)) self.Center(wx.BOTH) self.SetIcon(wx.Icon(u'./Graficos/icone.ico', wx.BITMAP_TYPE_ICO)) self.SetMaxSize(wx.Size(1040, 614)) self.SetMinSize(wx.Size(1040, 614)) self.painelEdicao = wx.Panel(id=wxID_FRAMEEDICAOALUNOPAINELEDICAO, name=u'painelEdicao', parent=self, pos=wx.Point(0, 0), size=wx.Size(1024, 576), style=wx.TAB_TRAVERSAL) self.painelEdicao.SetBackgroundColour(wx.Colour(255, 255, 255)) self.logoIFPE = wx.StaticBitmap(bitmap=wx.Bitmap( u'./Graficos/logo.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOLOGOIFPE, name=u'logoIFPE', parent=self.painelEdicao, pos=wx.Point(8, 8), size=wx.Size(175, 70), style=0) self.linhaEdicaoAlunos = wx.StaticBitmap( bitmap=wx.Bitmap(u'./Graficos/LinhaEdicaoAlunos.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOLINHAEDICAOALUNOS, name=u'linhaEdicaoAlunos', parent=self.painelEdicao, pos=wx.Point(0, 80), size=wx.Size(1024, 25), style=0) self.dadosDosAlunos = wx.Notebook( id=wxID_FRAMEEDICAOALUNODADOSDOSALUNOS, name=u'dadosDosAlunos', parent=self.painelEdicao, pos=wx.Point(20, 120), size=wx.Size(984, 424), style=0) self.dadosDosAlunos.SetBackgroundColour(wx.Colour(255, 255, 255)) self.dadosDosAlunos.SetForegroundColour(wx.Colour(255, 255, 255)) self.dadosDosAlunos.SetThemeEnabled(True) self.abaPessoal = wx.Window(id=wxID_FRAMEEDICAOALUNOABAPESSOAL, name=u'abaPessoal', parent=self.dadosDosAlunos, pos=wx.Point(0, 0), size=wx.Size(976, 398), style=wx.TAB_TRAVERSAL) self.campoCPF = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOCPF, name=u'campoCPF', parent=self.abaPessoal, pos=wx.Point(24, 34), size=wx.Size(104, 21), style=0, value=u'') self.campoCPF.SetMask(u'XXX.XXX.XXX-XX') self.campoCPF.SetAutoformat('') self.campoCPF.SetFormatcodes('') self.campoCPF.SetDescription('') self.campoCPF.SetExcludeChars('') self.campoCPF.SetValidRegex('') self.campoCPF.SetMaxLength(14) self.campoCPF.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.campoCPF.SetDefaultEncoding(u'latin1') self.campoCPF.SetFillChar(u' ') self.nomeCPF = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMECPF, label=u'CPF:', name=u'nomeCPF', parent=self.abaPessoal, pos=wx.Point(11, 15), size=wx.Size(24, 13), style=0) self.cpfNaoEncontrado = wx.StaticBitmap( bitmap=wx.Bitmap(u'./Graficos/botao_invalido.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOCPFNAOENCONTRADO, name=u'cpfNaoEncontrado', parent=self.abaPessoal, pos=wx.Point(170, 36), size=wx.Size(14, 14), style=0) self.cpfNaoEncontrado.Show(False) self.cpfEncontrado = wx.StaticBitmap( bitmap=wx.Bitmap(u'./Graficos/botao_valido.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOCPFENCONTRADO, name=u'cpfEncontrado', parent=self.abaPessoal, pos=wx.Point(170, 36), size=wx.Size(14, 14), style=0) self.cpfEncontrado.Show(False) self.BuscarCPF = wx.BitmapButton(bitmap=wx.Bitmap( u'./Graficos/botao_carregar.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOBUSCARCPF, name=u'BuscarCPF', parent=self.abaPessoal, pos=wx.Point(134, 30), size=wx.Size(26, 26), style=wx.BU_AUTODRAW) self.BuscarCPF.Bind(wx.EVT_BUTTON, self.OnBuscarCPFButton, id=wxID_FRAMEEDICAOALUNOBUSCARCPF) self.dataNascimento = wx.StaticText( id=wxID_FRAMEEDICAOALUNODATANASCIMENTO, label=u'Data de nascimento:', name=u'dataNascimento', parent=self.abaPessoal, pos=wx.Point(196, 14), size=wx.Size(100, 13), style=0) self.campoAniversario = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOANIVERSARIO, name=u'campoAniversario', parent=self.abaPessoal, pos=wx.Point(209, 33), size=wx.Size(104, 21), style=0, value=u'') self.campoAniversario.SetMask(u'XX/XX/XXXX') self.campoAniversario.SetAutoformat('') self.campoAniversario.SetFormatcodes('') self.campoAniversario.SetDescription('') self.campoAniversario.SetExcludeChars('') self.campoAniversario.SetValidRegex('') self.campoAniversario.SetMaxLength(10) self.campoAniversario.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.campoAniversario.SetDatestyle('MDY') self.selecionaSexo = wx.RadioBox(choices=['Feminino', 'Masculino'], id=wxID_FRAMEEDICAOALUNOSELECIONASEXO, label=u'Sexo:', majorDimension=1, name=u'selecionaSexo', parent=self.abaPessoal, pos=wx.Point(338, 14), size=wx.Size(176, 41), style=wx.RA_SPECIFY_ROWS) self.nomeNomeAluno = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMENOMEALUNO, label=u'Nome Completo:', name=u'nomeNomeAluno', parent=self.abaPessoal, pos=wx.Point(11, 70), size=wx.Size(80, 13), style=0) self.campoNomeAluno = wx.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPONOMEALUNO, name=u'campoNomeAluno', parent=self.abaPessoal, pos=wx.Point(24, 89), size=wx.Size(496, 21), style=0, value=u'') self.campoNomeAluno.SetMaxLength(50) self.nomeNomeMae = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMENOMEMAE, label=u'Nome da M\xe3e:', name=u'nomeNomeMae', parent=self.abaPessoal, pos=wx.Point(11, 125), size=wx.Size(70, 14), style=0) self.campoNomeMae = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPONOMEMAE, name=u'campoNomeMae', parent=self.abaPessoal, pos=wx.Point(24, 145), size=wx.Size(496, 21), style=0, value=u'') self.campoNomeMae.SetMaxLength(50) self.nomeNomePai = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMENOMEPAI, label=u'Nome do Pai:', name=u'nomeNomePai', parent=self.abaPessoal, pos=wx.Point(11, 181), size=wx.Size(64, 13), style=0) self.campoNomePai = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPONOMEPAI, name=u'campoNomePai', parent=self.abaPessoal, pos=wx.Point(24, 202), size=wx.Size(496, 21), style=0, value=u'') self.campoNomePai.SetMaxLength(50) self.nomeCEP = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMECEP, label=u'CEP:', name=u'nomeCEP', parent=self.abaPessoal, pos=wx.Point(11, 237), size=wx.Size(24, 13), style=0) self.campoCEP = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOCEP, name=u'campoCEP', parent=self.abaPessoal, pos=wx.Point(24, 256), size=wx.Size(104, 21), style=0, value=u' . - ') self.campoCEP.SetMask(u'XX.XXX-XXX') self.campoCEP.SetAutoformat('') self.campoCEP.SetFormatcodes('') self.campoCEP.SetDescription('') self.campoCEP.SetExcludeChars('') self.campoCEP.SetValidRegex('') self.campoCEP.SetMaxLength(10) self.campoCEP.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.campoCEP.SetDatestyle('MDY') self.botaoBuscarCEP = wx.BitmapButton( bitmap=wx.Bitmap(u'./Graficos/botao_buscar.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOBOTAOBUSCARCEP, name=u'botaoBuscarCEP', parent=self.abaPessoal, pos=wx.Point(136, 253), size=wx.Size(26, 26), style=wx.BU_AUTODRAW) self.botaoBuscarCEP.Bind(wx.EVT_BUTTON, self.OnBotaoBuscarCEPButton, id=wxID_FRAMEEDICAOALUNOBOTAOBUSCARCEP) self.nomeNumero = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMENUMERO, label=u'N\xfamero:', name=u'nomeNumero', parent=self.abaPessoal, pos=wx.Point(160, 237), size=wx.Size(42, 13), style=0) self.campoNumero = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPONUMERO, name=u'campoNumero', parent=self.abaPessoal, pos=wx.Point(173, 256), size=wx.Size(100, 21), style=0, value=u'') self.nomeComplemento = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMECOMPLEMENTO, label=u'Complemento:', name=u'nomeComplemento', parent=self.abaPessoal, pos=wx.Point(293, 237), size=wx.Size(70, 13), style=0) self.campoComplemento = wx.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOCOMPLEMENTO, name=u'campoComplemento', parent=self.abaPessoal, pos=wx.Point(306, 256), size=wx.Size(214, 21), style=0, value=u'') self.nomeEndereco = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMEENDERECO, label=u'Endere\xe7o:', name=u'nomeEndereco', parent=self.abaPessoal, pos=wx.Point(11, 292), size=wx.Size(50, 13), style=0) self.campoEndereco = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOENDERECO, name=u'campoEndereco', parent=self.abaPessoal, pos=wx.Point(24, 313), size=wx.Size(496, 21), style=0, value=u'') self.abaProfissional = wx.Window( id=wxID_FRAMEEDICAOALUNOABAPROFISSIONAL, name=u'abaProfissional', parent=self.dadosDosAlunos, pos=wx.Point(0, 0), size=wx.Size(976, 398), style=wx.TAB_TRAVERSAL) self.nomeMatricula = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMEMATRICULA, label=u'Matr\xedcula:', name=u'nomeMatricula', parent=self.abaProfissional, pos=wx.Point(16, 15), size=wx.Size(48, 13), style=0) self.campoMatricula = wx.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOMATRICULA, name=u'campoMatricula', parent=self.abaProfissional, pos=wx.Point(29, 34), size=wx.Size(144, 21), style=0, value=u'') self.abaContato = wx.Window(id=wxID_FRAMEEDICAOALUNOABACONTATO, name=u'abaContato', parent=self.dadosDosAlunos, pos=wx.Point(0, 0), size=wx.Size(976, 398), style=wx.TAB_TRAVERSAL) self.campoEmail = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOEMAIL, name=u'campoEmail', parent=self.abaContato, pos=wx.Point(24, 35), size=wx.Size(312, 21), style=0, value=u'') self.campoEmail.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.nomeEmail = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMEEMAIL, label=u'E-Mail:', name=u'nomeEmail', parent=self.abaContato, pos=wx.Point(11, 16), size=wx.Size(33, 13), style=0) self.nomeTelefone = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMETELEFONE, label=u'Telefone:', name=u'nomeTelefone', parent=self.abaContato, pos=wx.Point(11, 68), size=wx.Size(47, 13), style=0) self.campoTelefone = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOTELEFONE, name=u'campoTelefone', parent=self.abaContato, pos=wx.Point(24, 87), size=wx.Size(136, 21), style=0, value=u'( ) - ') self.campoTelefone.SetAutoformat('') self.campoTelefone.SetMask(u'(XX)XXXX-XXXX') self.campoTelefone.SetFormatcodes('') self.campoTelefone.SetDescription('') self.campoTelefone.SetExcludeChars('') self.campoTelefone.SetValidRegex('') self.campoTelefone.SetMaxLength(13) self.campoTelefone.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.campoCelular = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOCELULAR, name=u'campoCelular', parent=self.abaContato, pos=wx.Point(24, 144), size=wx.Size(136, 21), style=0, value=u'') self.campoCelular.SetAutoformat('') self.campoCelular.SetMask(u'(XX)XXXX-XXXX') self.campoCelular.SetFormatcodes('') self.campoCelular.SetDescription('') self.campoCelular.SetExcludeChars('') self.campoCelular.SetValidRegex('') self.campoCelular.SetMaxLength(13) self.campoCelular.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.nomeBairro = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMEBAIRRO, label=u'Bairro:', name=u'nomeBairro', parent=self.abaPessoal, pos=wx.Point(11, 346), size=wx.Size(33, 13), style=0) self.nomeDepartamento = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMEDEPARTAMENTO, label=u'Departamento:', name=u'nomeDepartamento', parent=self.abaProfissional, pos=wx.Point(200, 15), size=wx.Size(74, 13), style=0) self.nomeCelular = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMECELULAR, label=u'Celular:', name=u'nomeCelular', parent=self.abaContato, pos=wx.Point(11, 125), size=wx.Size(38, 13), style=0) self.nomeCidade = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMECIDADE, label=u'Cidade:', name=u'nomeCidade', parent=self.abaPessoal, pos=wx.Point(265, 346), size=wx.Size(38, 13), style=0) self.campoBairro = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOBAIRRO, name=u'campoBairro', parent=self.abaPessoal, pos=wx.Point(24, 365), size=wx.Size(224, 21), style=0, value=u'') self.campoCidade = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOCIDADE, name=u'campoCidade', parent=self.abaPessoal, pos=wx.Point(278, 365), size=wx.Size(186, 21), style=0, value=u'') self.nomeUF = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMEUF, label=u'UF:', name=u'nomeUF', parent=self.abaPessoal, pos=wx.Point(480, 346), size=wx.Size(18, 13), style=0) self.campoUF = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOUF, name=u'campoUF', parent=self.abaPessoal, pos=wx.Point(493, 365), size=wx.Size(27, 21), style=0, value=u'') self.botaoLimparPessoal = wx.Button( id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARPESSOAL, label=u'Limpar', name=u'botaoLimparPessoal', parent=self.abaPessoal, pos=wx.Point(880, 20), size=wx.Size(75, 23), style=0) self.botaoLimparPessoal.Bind( wx.EVT_BUTTON, self.OnBotaoLimparPessoalButton, id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARPESSOAL) self.comboBoxDepartamento = wx.ComboBox( choices=[], id=wxID_FRAMEEDICAOALUNOCOMBOBOXDEPARTAMENTO, name=u'comboBoxDepartamento', parent=self.abaProfissional, pos=wx.Point(217, 34), size=wx.Size(130, 21), style=wx.CB_READONLY, value=u'Selecione o Departamento') self.comboBoxDepartamento.SetLabel(u'') self.comboBoxDepartamento.SetStringSelection( u'Selecione o departamento') self.nomeCurso = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMECURSO, label=u'Curso:', name=u'nomeCurso', parent=self.abaProfissional, pos=wx.Point(373, 15), size=wx.Size(33, 13), style=0) self.comboBoxCursos = wx.ComboBox( choices=[], id=wxID_FRAMEEDICAOALUNOCOMBOBOXCURSOS, name=u'comboBoxCursos', parent=self.abaProfissional, pos=wx.Point(390, 34), size=wx.Size(130, 21), style=wx.CB_READONLY, value=u'') self.comboBoxCursos.SetLabel(u'Selecione o Curso') self.nomeAnoConclusao = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMEANOCONCLUSAO, label=u'Ano que concluiu (ou concluir\xe1) o curso:', name=u'nomeAnoConclusao', parent=self.abaProfissional, pos=wx.Point(16, 75), size=wx.Size(192, 13), style=0) self.campoAnoConclusao = wx.lib.masked.textctrl.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOANOCONCLUSAO, name=u'campoAnoConclusao', parent=self.abaProfissional, pos=wx.Point(40, 96), size=wx.Size(56, 21), style=0, value=u' . ') self.campoAnoConclusao.SetAutoformat('') self.campoAnoConclusao.SetMask(u'XXXX.X') self.campoAnoConclusao.SetDatestyle('MDY') self.campoAnoConclusao.SetFormatcodes('') self.campoAnoConclusao.SetDescription('') self.campoAnoConclusao.SetExcludeChars('') self.campoAnoConclusao.SetValidRegex('') self.campoAnoConclusao.SetMaxLength(6) self.campoAnoConclusao.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma')) self.botaoLimparProfissional = wx.Button( id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARPROFISSIONAL, label=u'Limpar', name=u'botaoLimparProfissional', parent=self.abaProfissional, pos=wx.Point(880, 20), size=wx.Size(75, 23), style=0) self.botaoLimparProfissional.Bind( wx.EVT_BUTTON, self.OnBotaoLimparProfissionalButton, id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARPROFISSIONAL) self.botaoVoltar = wx.BitmapButton(bitmap=wx.Bitmap( u'./Graficos/botao_voltar.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAMEEDICAOALUNOBOTAOVOLTAR, name=u'botaoVoltar', parent=self.painelEdicao, pos=wx.Point(952, 13), size=wx.Size(57, 57), style=wx.BU_AUTODRAW) self.botaoVoltar.Bind(wx.EVT_BUTTON, self.OnBotaoVoltarButton, id=wxID_FRAMEEDICAOALUNOBOTAOVOLTAR) self.botaoSalvar = wx.Button(id=wxID_FRAMEEDICAOALUNOBOTAOSALVAR, label=u'Salvar', name=u'botaoSalvar', parent=self.abaContato, pos=wx.Point(885, 360), size=wx.Size(75, 23), style=0) self.botaoSalvar.Bind(wx.EVT_BUTTON, self.OnBotaoSalvarButton, id=wxID_FRAMEEDICAOALUNOBOTAOSALVAR) self.campoSenha = wx.TextCtrl(id=wxID_FRAMEEDICAOALUNOCAMPOSENHA, name=u'campoSenha', parent=self.abaContato, pos=wx.Point(24, 197), size=wx.Size(312, 21), style=wx.TE_PASSWORD, value=u'') self.nomeErro = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMEERRO, label=u'', name=u'nomeErro', parent=self.abaPessoal, pos=wx.Point(456, 40), size=wx.Size(0, 13), style=wx.ALIGN_CENTRE) self.nomeErro.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, True, u'Tahoma')) self.nomeErro.SetAutoLayout(True) self.verificarEstagio = wx.RadioBox( choices=['Sim', 'N\xe3o'], id=wxID_FRAMEEDICAOALUNOVERIFICARESTAGIO, label=u'Estagiando:', majorDimension=1, name=u'verificarEstagio', parent=self.abaProfissional, pos=wx.Point(234, 75), size=wx.Size(94, 44), style=wx.RA_SPECIFY_ROWS) self.verificarEstagio.SetStringSelection(u'N\xe3o') self.verificarEstagio.Bind(wx.EVT_RADIOBOX, self.OnVerificarEstagioRadiobox, id=wxID_FRAMEEDICAOALUNOVERIFICARESTAGIO) self.nomeDisponibilidade = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMEDISPONIBILIDADE, label=u'Disponibilidade:', name=u'nomeDisponibilidade', parent=self.abaProfissional, pos=wx.Point(351, 76), size=wx.Size(75, 13), style=0) self.opcaoManha = wx.CheckBox(id=wxID_FRAMEEDICAOALUNOOPCAOMANHA, label=u'Manh\xe3', name=u'opcaoManha', parent=self.abaProfissional, pos=wx.Point(372, 98), size=wx.Size(53, 13), style=0) self.opcaoManha.SetValue(False) self.opcaoTarde = wx.CheckBox(id=wxID_FRAMEEDICAOALUNOOPCAOTARDE, label=u'Tarde', name=u'opcaoTarde', parent=self.abaProfissional, pos=wx.Point(428, 98), size=wx.Size(49, 13), style=0) self.opcaoTarde.SetValue(False) self.opcaoTarde.SetToolTipString(u'opcaoTarde') self.opcaoNoite = wx.CheckBox(id=wxID_FRAMEEDICAOALUNOOPCAONOITE, label=u'Noite', name=u'opcaoNoite', parent=self.abaProfissional, pos=wx.Point(479, 98), size=wx.Size(40, 13), style=0) self.opcaoNoite.SetValue(False) self.nomeConfirmarSenha = wx.StaticText( id=wxID_FRAMEEDICAOALUNONOMECONFIRMARSENHA, label=u'Confirmar Senha:', name=u'nomeConfirmarSenha', parent=self.abaContato, pos=wx.Point(11, 231), size=wx.Size(85, 13), style=0) self.campoConfirmarSenha = wx.TextCtrl( id=wxID_FRAMEEDICAOALUNOCAMPOCONFIRMARSENHA, name=u'campoConfirmarSenha', parent=self.abaContato, pos=wx.Point(24, 250), size=wx.Size(312, 21), style=wx.TE_PASSWORD, value=u'') self.botaoLimparContato = wx.Button( id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARCONTATO, label=u'Limpar', name=u'botaoLimparContato', parent=self.abaContato, pos=wx.Point(880, 20), size=wx.Size(75, 23), style=0) self.botaoLimparContato.Bind( wx.EVT_BUTTON, self.OnBotaoLimparContatoButton, id=wxID_FRAMEEDICAOALUNOBOTAOLIMPARCONTATO) self.nomeSenha = wx.StaticText(id=wxID_FRAMEEDICAOALUNONOMESENHA, label=u'Senha:', name=u'nomeSenha', parent=self.abaContato, pos=wx.Point(11, 178), size=wx.Size(35, 13), style=0) self._init_coll_dadosDosAlunos_Pages(self.dadosDosAlunos)
def __init__(self, app, trackname, position, trackcolor, autostart_uri, schedpgm, fifofilename, insidefilename, csvfile, maxpro_hostname, slowrate, icmprate): self.App = app self.TrackName = trackname self.OurPosition = position self.TrackColor = trackcolor self.AutostartURI = autostart_uri self.AutostartTime = None self.SchedPgm = schedpgm self.FifoFileName = fifofilename self.InsideIndicatorFileName = insidefilename self.CsvFile = csvfile self.MaxProHostname = maxpro_hostname self.SlowRate = slowrate self.ICMPRate = icmprate #--# self.errMsgInfo = None self.SchedProcess = None wx.Frame.__init__(self, None, -1, "DRC Control - Track %s" % self.TrackName, style=wx.NO_FULL_REPAINT_ON_RESIZE | wx.DEFAULT_FRAME_STYLE) self.SetBackgroundColour(self.TrackColor) # The 4D systems 4.3 cape is 480x272, but we have to leave room for # the various window manager and window decorators. self.DimensionX = 474 self.DimensionY = 220 self.SetMinSize((self.DimensionX, self.DimensionY)) self.SetMaxSize((self.DimensionX, self.DimensionY)) self.SetSize((self.DimensionX, self.DimensionY)) if self.OurPosition is not None: if self.OurPosition.lower() == "center": self.CenterOnScreen(wx.BOTH) else: self.SetPosition(map(int, self.OurPosition.split('x'))) self.statusBar = StatusBar(self) self.SetStatusBar(self.statusBar) self.Prepared = False self.Running = False self.Inside = False self.Stopped = False self.SchedPgmStatus = 0 self.SchedPgmStatusTxt = "" self.SchedEmlStatus = 0 self.SchedEmlStatusText = "" self.SchedInsideStatus = False self.SchedPgmMsg = "" #------------------------------------------------------------ # Build up the menus #------------------------------------------------------------ self.menuData = \ [("&File", [ ["E&xit", "Terminate the GUI application.", self.OnMenuExit] ] ) ] helpMenu = \ ("&Help", []) helpMenu[1].append([ "&About", "General information about this application.", self.OnMenuAbout ]) self.menuData.append(helpMenu) # self.CreateMenuBar(self.menuData) #------------------------------------------------------------ # Set up a close handler #------------------------------------------------------------ wx.EVT_CLOSE(self, self.OnCloseFrame) #--# self.statusBar.SetStatusText("", 0) self.statusBar.SetStatusMsg("") self.BlueBall = wx.Bitmap("blueball-16.png", wx.BITMAP_TYPE_ANY) self.RedBall = wx.Bitmap("redball-16.png", wx.BITMAP_TYPE_ANY) self.GreenBall = wx.Bitmap("greenball-16.png", wx.BITMAP_TYPE_ANY) self.YellowBall = wx.Bitmap("yellowball-16.png", wx.BITMAP_TYPE_ANY) self.BlackBall = wx.Bitmap("blackball-16.png", wx.BITMAP_TYPE_ANY) self.BtnDisableFgColor = wx.ColourDatabase.Find( wx.ColourDatabase(), "WHITE") self.BtnDisableBgColor = wx.ColourDatabase.Find( wx.ColourDatabase(), "GREY") self.BtnEnableFgColor = wx.ColourDatabase.Find(wx.ColourDatabase(), "BLACK") self.BtnEnableBgColor = wx.ColourDatabase.Find(wx.ColourDatabase(), "GREEN") self.BtnAutoBgColor = wx.ColourDatabase.Find(wx.ColourDatabase(), "YELLOW") prep_x = 10 start_x = prep_x + 108 inside_x = start_x + 108 stop_x = inside_x + 144 btn_y = 14 btn_sz_x = 98 btn_sz_y = 54 self.PrepBtn = wx.ToggleButton(self, label='PREPARE', pos=(prep_x, btn_y), size=(btn_sz_x, btn_sz_y)) self.EnableButton(self.PrepBtn) self.PrepBtn.SetToolTip(wx.ToolTip("Prepare system")) #self.PrepBtn.SetBitmap(None) self.StartBtn = wx.ToggleButton(self, label='START', pos=(start_x, btn_y), size=(btn_sz_x, btn_sz_y)) self.StartBtn.SetToolTip(wx.ToolTip("Start robot run")) #self.StartBtn.SetBitmap(None) self.DisableButton(self.StartBtn) self.InsideBtn = wx.ToggleButton(self, label='IN/OUT', pos=(inside_x, btn_y), size=(btn_sz_x, btn_sz_y)) self.InsideBtn.SetToolTip(wx.ToolTip("Robot is OUTSIDE")) #self.InsideBtn.SetBitmap(None) self.DisableButton(self.InsideBtn) self.StopBtn = wx.ToggleButton(self, label='STOP', pos=(stop_x, btn_y), size=(btn_sz_x, btn_sz_y)) self.StopBtn.SetToolTip(wx.ToolTip("Stop system")) #self.StopBtn.SetBitmap(None) self.DisableButton(self.StopBtn) self.RestartBtn = wx.ToggleButton(self, label='RESTART', pos=(stop_x, btn_y + 110), size=(btn_sz_x, btn_sz_y)) self.RestartBtn.SetToolTip(wx.ToolTip("Restart system")) #self.RestartBtn.SetBitmap(None) self.DisableButton(self.RestartBtn) bias = 40 ball = self.BlackBall ball_y = 74 self.PrepLed = wx.StaticBitmap(self, pos=(prep_x + bias, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) self.StartLed = wx.StaticBitmap(self, pos=(start_x + bias, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) self.InsideLed = wx.StaticBitmap(self, pos=(inside_x + bias, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) self.StopLed = wx.StaticBitmap(self, pos=(stop_x + bias, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) panel = wx.Panel(self, pos=(10, 130), size=(self.DimensionX - 200, 54), style=wx.BORDER_SIMPLE) box = wx.StaticBox(panel, wx.ID_ANY) wx.StaticText(panel, wx.ID_ANY, "Scheduler", pos=(100, 0)) ball_y = 19 labely = 37 self.SchedPrepLed = wx.StaticBitmap(panel, pos=(18, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) wx.StaticText(panel, wx.ID_ANY, "Prep", pos=(12, labely)) self.SchedRunLed = wx.StaticBitmap(panel, pos=(88, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) wx.StaticText(panel, wx.ID_ANY, "Run", pos=(84, labely)) self.SchedBlackoutLed = wx.StaticBitmap(panel, pos=(158, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) wx.StaticText(panel, wx.ID_ANY, "BlkOut", pos=(144, labely)) self.SchedInsideLed = wx.StaticBitmap(panel, pos=(228, ball_y), bitmap=ball, size=(ball.GetWidth() + 10, ball.GetHeight() + 10)) wx.StaticText(panel, wx.ID_ANY, "Inside", pos=(218, labely)) #--# self.SchedDoneLed = wx.StaticBitmap(panel, #--# pos=(290,ball_y), #--# bitmap=ball, #--# size=(ball.GetWidth()+10, #--# ball.GetHeight()+10)) #--# wx.StaticText(panel, wx.ID_ANY, "Done", pos=(286,labely)) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnPrepare, self.PrepBtn) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnStart, self.StartBtn) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnInside, self.InsideBtn) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnStop, self.StopBtn) self.Bind(wx.EVT_TOGGLEBUTTON, self.OnRestart, self.RestartBtn) self.SchedulerPostsThread = UtilityThread(self.FifoFileName, self.GotSchedMsg)
def __init__(self, parent, id, mainPanel): self.englishNumberArray = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ] self.nepaliNumberArray = loadDataArithmetic.numberStr self.currentNumber = 0 self.nextNumber = 0 self.numberArithmetic = 0 self.currentLesson = "oneMore" self.mainWin = mainPanel self.menuPanel = wx.Panel(parent, wx.ID_ANY, (0, 0), (800, 100)) self.menuPanel.SetBackgroundColour(config.backgroundColour) oneMoreImg = wx.Bitmap(join(config.buttonsPath, 'oneMore.png'), wx.BITMAP_TYPE_PNG) self.oneMoreButton = wx.BitmapButton(self.menuPanel, wx.ID_ANY, oneMoreImg, (50, 10), style=wx.NO_BORDER) self.oneMoreButton.SetBackgroundColour(config.backgroundColour) self.oneMoreButton.Bind(wx.EVT_BUTTON, self.OnOneMoreButton, id=self.oneMoreButton.GetId()) oneLessImg = wx.Bitmap(join(config.buttonsPath, 'oneLess.png'), wx.BITMAP_TYPE_PNG) self.oneLessButton = wx.BitmapButton(self.menuPanel, wx.ID_ANY, oneLessImg, (200, 10), style=wx.NO_BORDER) self.oneLessButton.SetBackgroundColour(config.backgroundColour) self.oneLessButton.Bind(wx.EVT_BUTTON, self.OnOneLessButton, id=self.oneLessButton.GetId()) simplePlusImg = wx.Bitmap(join(config.buttonsPath, 'simplePlus.png'), wx.BITMAP_TYPE_PNG) self.simplePlusButton = wx.BitmapButton(self.menuPanel, wx.ID_ANY, simplePlusImg, (350, 10), style=wx.NO_BORDER) self.simplePlusButton.SetBackgroundColour(config.backgroundColour) self.simplePlusButton.Bind(wx.EVT_BUTTON, self.OnSimplePlusButton, id=self.simplePlusButton.GetId()) simpleMinusImg = wx.Bitmap(join(config.buttonsPath, 'simpleMinus.png'), wx.BITMAP_TYPE_PNG) self.simpleMinusButton = wx.BitmapButton(self.menuPanel, wx.ID_ANY, simpleMinusImg, (500, 10), style=wx.NO_BORDER) self.simpleMinusButton.SetBackgroundColour(config.backgroundColour) self.simpleMinusButton.Bind(wx.EVT_BUTTON, self.OnSimpleMinusButton, id=self.simpleMinusButton.GetId()) self.displayPanel = wx.Panel(parent, wx.ID_ANY, (0, 100), (800, 500)) self.displayPanel.SetBackgroundColour(config.backgroundColour) self.displayLabel0 = wx.StaticText(self.displayPanel, wx.ID_ANY, messages.number, (80, 110), style=wx.ALIGN_CENTRE) self.displayLabel0.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) self.displayLabel1 = wx.StaticText(self.displayPanel, wx.ID_ANY, messages.oneMoreLabel, (320, 110), style=wx.ALIGN_CENTRE) self.displayLabel1.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) self.displayLabel2 = wx.StaticText(self.displayPanel, wx.ID_ANY, messages.upNumberLabel, (540, 110), style=wx.ALIGN_CENTRE) self.displayLabel2.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) self.nextNumber, self.currentNumber = arithmeticUtils.nextNumber( self.currentLesson, self.currentNumber) self.displayLabel3 = wx.StaticText(self.displayPanel, wx.ID_ANY, self.mreplace( str(self.currentNumber), "engToNep"), (80, 160), style=wx.ALIGN_CENTRE) self.displayLabel3.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel4 = wx.StaticText(self.displayPanel, wx.ID_ANY, " + ", (220, 160), style=wx.ALIGN_CENTRE) self.displayLabel4.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel5 = wx.StaticText(self.displayPanel, wx.ID_ANY, self.mreplace(str(1), "engToNep"), (360, 160), style=wx.ALIGN_CENTRE) self.displayLabel5.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel6 = wx.StaticText(self.displayPanel, wx.ID_ANY, " = ", (470, 160), style=wx.ALIGN_CENTRE) self.displayLabel6.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel7 = wx.StaticText(self.displayPanel, wx.ID_ANY, self.mreplace( str(self.nextNumber), "engToNep"), (580, 160), style=wx.ALIGN_CENTRE) self.displayLabel7.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) ###Display the image based arithmetic currentImg = arithmeticUtils.nextImage(self.currentLesson, self.currentNumber) nextImg = arithmeticUtils.nextImage(self.currentLesson, self.nextNumber) currentNumberImg = wx.BitmapFromImage(currentImg) self.currentNumberImage = wx.StaticBitmap( self.displayPanel, -1, currentNumberImg, (50, 230), (currentNumberImg.GetWidth(), currentNumberImg.GetHeight())) self.arithmeticSignLabel = wx.StaticText(self.displayPanel, wx.ID_ANY, " + ", (220, 230), style=wx.ALIGN_CENTRE) self.arithmeticSignLabel.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) nextImg = arithmeticUtils.nextImage(self.currentLesson, 1) numberArithmeticImg = wx.BitmapFromImage(nextImg) self.numberArithmeticImage = wx.StaticBitmap( self.displayPanel, -1, numberArithmeticImg, (360, 230), (numberArithmeticImg.GetWidth(), numberArithmeticImg.GetHeight())) self.equalToLabel = wx.StaticText(self.displayPanel, wx.ID_ANY, " = ", (470, 230), style=wx.ALIGN_CENTRE) self.equalToLabel.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) nextNumberImg = wx.BitmapFromImage(nextImg) self.nextNumberImage = wx.StaticBitmap( self.displayPanel, -1, nextNumberImg, (570, 230), (nextNumberImg.GetWidth(), nextNumberImg.GetHeight())) self.displayLabel8 = wx.StaticText(self.displayPanel, wx.ID_ANY, loadDataArithmetic.numberNames[int( self.currentNumber)], (80, 330), style=wx.ALIGN_CENTRE) self.displayLabel8.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) self.displayLabel9 = wx.StaticText(self.displayPanel, wx.ID_ANY, " + ", (220, 310), style=wx.ALIGN_CENTRE) self.displayLabel9.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel10 = wx.StaticText(self.displayPanel, wx.ID_ANY, loadDataArithmetic.numberNames[1], (360, 330), style=wx.ALIGN_CENTRE) self.displayLabel10.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) self.displayLabel11 = wx.StaticText(self.displayPanel, wx.ID_ANY, " = ", (470, 310), style=wx.ALIGN_CENTRE) self.displayLabel11.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontNameArithmetic)) self.displayLabel12 = wx.StaticText(self.displayPanel, wx.ID_ANY, loadDataArithmetic.numberNames[int( self.nextNumber)], (580, 330), style=wx.ALIGN_CENTRE) self.displayLabel12.SetFont( wx.Font(config.fontSize[0], wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.fontName)) ###End of image based arithmetic previousArrowImg = wx.Bitmap( join(config.coreImagesPath, 'previousArrow.png'), wx.BITMAP_TYPE_PNG) self.previousArrowButton = wx.BitmapButton(self.displayPanel, wx.ID_ANY, previousArrowImg, (50, 0), style=wx.NO_BORDER) self.previousArrowButton.SetBackgroundColour(config.backgroundColour) self.previousArrowButton.Bind(wx.EVT_BUTTON, self.OnPreviousArrow, id=self.previousArrowButton.GetId()) nextArrowImg = wx.Bitmap(join(config.coreImagesPath, 'nextArrow.png'), wx.BITMAP_TYPE_PNG) self.nextArrowButton = wx.BitmapButton(self.displayPanel, wx.ID_ANY, nextArrowImg, (650, 0), style=wx.NO_BORDER) self.nextArrowButton.SetBackgroundColour(config.backgroundColour) self.nextArrowButton.Bind(wx.EVT_BUTTON, self.OnNextArrow, id=self.nextArrowButton.GetId()) bottomMenu.bottomMenu([self.displayPanel, self.menuPanel], parent, self.mainWin, 'twoButton')
def widgets(self): # TODO: get coordinate values by clicking the mouse # TODO: add PySolo single ROI drawing # ------------------------------------------------------------------------------------------------------------ Title self.title = wx.StaticText(self, -1, "\n %s" % self.mon_name) # title font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD) self.title.SetFont(font) # -------------------------------------------------------------------------------------------- video display options self.previewPanel = VM.monitorPanel(self, mon_ID=self.mon_ID, panelType='preview', loop=True) self.previewSizeLabel = wx.StaticText( self, wx.ID_ANY, 'frame size =') # ------ preview frame size self.previewSize = wx.TextCtrl(self, wx.ID_ANY, str(self.preview_size), style=wx.TE_PROCESS_ENTER, name='previewSize') self.previewFPSLabel = wx.StaticText( self, wx.ID_ANY, 'preview fps =') # --------- preview video fps self.previewFPS = wx.TextCtrl(self, wx.ID_ANY, str(self.preview_fps), style=wx.TE_PROCESS_ENTER, name='previewFPS') self.lineThicknessLabel = wx.StaticText( self, wx.ID_ANY, 'ROI line thickness =') # --------- preview ROI line thickness self.lineThickness = wx.TextCtrl(self, wx.ID_ANY, str(self.line_thickness), style=wx.TE_PROCESS_ENTER, name='lineThickness') # --------------------------------------------------------------------------------------- Save Configuration Button self.btnSaveCfg = wx.Button(self, wx.ID_ANY, label='Save Configuration', size=(130, 25)) if self.source != '': self.btnSaveCfg.Enable( True) # don't allow save if no source is selected else: self.btnSaveCfg.Enable(False) # --------------------------------------------------------------------------------------- Delete Monitor Button self.btnRemoveMonitor = wx.Button(self, wx.ID_ANY, label='Delete Monitor', size=(130, 25)) if self.monitors == 1: # don't allow last monitor to be deleted self.btnRemoveMonitor.Enable(False) else: self.btnRemoveMonitor.Enable(True) # -------------------------------------------------------------------------------------------------------- source self.txt_source = wx.StaticText(self, wx.ID_ANY, "Source: ") if self.source is not None: self.currentSource = wx.TextCtrl( self, wx.ID_ANY, self.source, style=wx.TE_READONLY) # get current source else: self.currentSource = wx.TextCtrl( self, wx.ID_ANY, 'None Selected', style=wx.TE_READONLY) # get current source # ------------------------------------------------------------------------------- Webcam selection combobox # if len(gbl.webcams_inuse) >= gbl.webcams: # only one webcam implemented at this time # self.WebcamsList = ['No more webcams available.'] # else: # self.WebcamsList = ['Webcam %s' % (int(w) + 1) for w in range(gbl.webcams)] # self.WebcamsList = ['Webcam 1'] # ------------------------------------------------------------------------------------------- source options self.source_IDs = [wx.ID_ANY, wx.ID_ANY, wx.ID_ANY] self.sources = [ 'placeholder for webcams', # (wx.ComboBox(self, id=self.source_IDs[0], choices=self.WebcamsList, name='sources0', # webcam # style=wx.EXPAND | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT)), ( FileBrowseButton( self, id=self.source_IDs[1], # video file name='sources1', buttonText='Browse', toolTip= 'Type filename or click browse to choose video file', dialogTitle='Choose a video file', startDirectory=self.data_folder, wildcard='*.*', style=wx.ALL, changeCallback=self.onChangeSource1)), ( DirBrowseButton( self, id=self.source_IDs[2], name='sources2', # folder of images style=wx.DD_DIR_MUST_EXIST, startDirectory=self.data_folder, changeCallback=self.onChangeSource2)) ] # -------------------------------------------------------------------------------- source type radio buttons # self.rbs = [(wx.RadioButton(self, wx.ID_ANY, 'Camera', style=wx.RB_GROUP)), self.rbs = [ 'placeholder for camera radiobutton', (wx.RadioButton(self, wx.ID_ANY, 'File')), (wx.RadioButton(self, wx.ID_ANY, 'Folder')) ] # ------------------------------------------------------------------------------------------------ mask file browser wildcard = 'PySolo Video mask file (*.msk)|*.msk|' \ 'All files (*.*)|*.*' # adding space in here will mess it up! if self.mask_file is None: startDirectory = self.data_folder # Default directory for file dialog startup initialValue = 'None Selected' elif os.path.isfile(self.mask_file): startDirectory = os.path.split( self.mask_file)[0] # Default directory for file dialog startup initialValue = self.mask_file else: startDirectory = self.data_folder # Default directory for file dialog startup initialValue = 'None Selected' self.pickMaskBrowser = FileBrowseButton( self, id=wx.ID_ANY, labelText='Mask File: ', buttonText='Browse', toolTip='Type filename or click browse to choose mask file', dialogTitle='Choose a mask file', startDirectory=startDirectory, initialValue=initialValue, wildcard=wildcard, style=wx.ALL, changeCallback=self.onMaskBrowse, name='pickMaskBrowser') # -------------------------------------------------------------------------------------------- output folder browser if self.data_folder is None: startDirectory = self.data_folder = gbl.cfg_path # Default directory is config directory elif os.path.isdir(self.data_folder): startDirectory = self.data_folder # Default directory from config file else: startDirectory = self.data_folder = gbl.cfg_path # Default directory is config directory self.pickOutputBrowser = DirBrowseButton( self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL, labelText='Output Folder: ', dialogTitle='Choose an output folder', startDirectory=self.data_folder, value=gbl.data_folder, changeCallback=self.onChangeOutput, name='pickOutputBrowser') # ------------------------------------------------------------------------------------------------- video attributes self.sourceFPSLabel = wx.StaticText( self, wx.ID_ANY, 'Speed (fps) =') # ---------------- source fps self.sourceFPS = wx.TextCtrl(self, wx.ID_ANY, str(self.source_fps), style=wx.TE_PROCESS_ENTER, name='sourceFPS') self.txtDate = wx.StaticText(self, wx.ID_ANY, "Date: ") # ---------------- start date self.startDate = wx.DatePickerCtrl( self, wx.ID_ANY, dt=self.start_datetime, style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.TE_PROCESS_ENTER, name='start_date') self.txtTime = wx.StaticText( self, wx.ID_ANY, 'Time (24-hr): ') # ---------------- start time self.btnSpin = wx.SpinButton(self, wx.ID_ANY, wx.DefaultPosition, (-1, 20), wx.SP_VERTICAL) starttime = gbl.wxdatetime2timestring(self.start_datetime) self.startTime = masked.TimeCtrl(self, wx.ID_ANY, value=starttime, name='time: \n24 hour control', fmt24hr=True, spinButton=self.btnSpin, style=wx.TE_PROCESS_ENTER) self.instruction = wx.StaticText( self, wx.ID_ANY, 'Clicking on the video will change top left coordinate values.') """ # ------------------------------------------------------------------------------------------------ activate tracking self.trackBox = wx.CheckBox(self, wx.ID_ANY, 'Activate Tracking') self.trackBox.Enable(True) self.trackBox.SetValue(str(self.track)) # ---------------------------------------------------------------------------------------- sleep deprivation monitor self.isSDMonitor = wx.CheckBox(self, wx.ID_ANY, 'Sleep Deprivation Monitor') self.isSDMonitor.Enable(True) self.isSDMonitor.SetValue(str(self.issdmonitor)) # ---------------------------------------------------------------------------------------------------- tracking type self.trackChoice = [(wx.RadioButton(self, wx.ID_ANY, 'Activity as distance traveled', style=wx.RB_GROUP)), (wx.RadioButton(self, wx.ID_ANY, 'Activity as midline crossings count')), (wx.RadioButton(self, wx.ID_ANY, 'Only position of flies'))] for count in range(0, len(self.trackChoice)): self.trackChoice[count].Enable(True) if self.trackType == count: self.trackChoice[count].SetValue(True) else: self.trackChoice[count].SetValue(False) """ # -------------------------------------------------------------------------------------------- instructional diagram self.diagram = wx.Bitmap( os.path.join(gbl.exec_dir, 'maskmakerdiagram.bmp'), wx.BITMAP_TYPE_BMP) self.diagramctl = wx.StaticBitmap(self, -1, self.diagram) # --------------------------------------------------------------------------------------- ROI Coordinates Input Grid self.rowLabels = [ wx.StaticText(self, -1, ' '), wx.StaticText(self, -1, 'Number'), # row labels wx.StaticText(self, -1, 'Top Left'), wx.StaticText(self, -1, 'Span'), wx.StaticText(self, -1, 'Gap'), wx.StaticText(self, -1, 'Tilt') ] self.X = [] self.Y = [] self.X.append(wx.StaticText( self, wx.ID_ANY, "Columns (X)")) # column header for columns self.Y.append(wx.StaticText(self, wx.ID_ANY, "Rows (Y)")) # column header for rows for cnt in range(0, 5): self.X.append(NumCtrl(self, wx.ID_ANY, 0)) self.Y.append(NumCtrl(self, wx.ID_ANY, 0)) # ------------------------------------------------------------------------------------ mask generator & save buttons self.btnMaskGen = wx.Button(self, wx.ID_ANY, label="Generate Mask", size=(130, 25)) self.btnMaskGen.Enable(True) self.btnSaveMask = wx.Button(self, wx.ID_ANY, label="Save Mask", size=(130, 25)) self.btnSaveMask.Enable(True)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=_(u"About"), pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_panelMain = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) fgSizer1 = wx.FlexGridSizer(0, 1, 0, 0) fgSizer1.AddGrowableCol(0) fgSizer1.AddGrowableRow(0) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer2 = wx.FlexGridSizer(1, 0, 0, 0) fgSizer2.AddGrowableCol(0) fgSizer2.AddGrowableCol(1) fgSizer2.AddGrowableRow(0) fgSizer2.SetFlexibleDirection(wx.BOTH) fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_bitmapLogo = wx.StaticBitmap(self.m_panelMain, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add( self.m_bitmapLogo, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5) fgSizer3 = wx.FlexGridSizer(0, 1, 0, 0) fgSizer3.SetFlexibleDirection(wx.BOTH) fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText5 = wx.StaticText( self.m_panelMain, wx.ID_ANY, _(u"Subtitle\nSpeech\nSynchronizer"), wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText5.Wrap(-1) self.m_staticText5.SetFont( wx.Font(24, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, wx.EmptyString)) fgSizer3.Add(self.m_staticText5, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_textVersion = wx.StaticText(self.m_panelMain, wx.ID_ANY, _(u"custom build"), wx.DefaultPosition, wx.DefaultSize, 0) self.m_textVersion.Wrap(-1) fgSizer3.Add(self.m_textVersion, 0, wx.BOTTOM | wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5) fgSizer2.Add(fgSizer3, 1, wx.EXPAND | wx.LEFT, 5) fgSizer1.Add(fgSizer2, 1, wx.EXPAND, 50) fgSizer1.Add((0, 10), 1, wx.EXPAND, 5) self.m_staticText10 = wx.StaticText( self.m_panelMain, wx.ID_ANY, _(u"This is an automatic movie subtitle synchronization tool.\nSynchronization is done by listening to the audio track, translating it if necessary.\nIt could also use another subtitle as a reference.\n\nAuthor: Michał Szymaniak" ), wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10.Wrap(-1) fgSizer1.Add(self.m_staticText10, 0, wx.ALL, 5) fgSizer1.Add((0, 10), 1, wx.EXPAND, 5) self.m_staticline1 = wx.StaticLine(self.m_panelMain, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) fgSizer3 = wx.FlexGridSizer(1, 0, 0, 0) fgSizer3.AddGrowableCol(2) fgSizer3.SetFlexibleDirection(wx.BOTH) fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_buttonLicense = wx.Button(self.m_panelMain, wx.ID_ANY, _(u"License"), wx.DefaultPosition, wx.DefaultSize, 0) fgSizer3.Add(self.m_buttonLicense, 0, wx.ALL, 5) self.m_buttonCredits = wx.Button(self.m_panelMain, wx.ID_ANY, _(u"Credits"), wx.DefaultPosition, wx.DefaultSize, 0) fgSizer3.Add(self.m_buttonCredits, 0, wx.ALL, 5) self.m_buttonWebsite = wx.Button(self.m_panelMain, wx.ID_ANY, _(u"Website"), wx.DefaultPosition, wx.DefaultSize, 0) fgSizer3.Add(self.m_buttonWebsite, 0, wx.ALL, 5) fgSizer3.Add((0, 0), 1, wx.EXPAND, 5) self.m_buttonClose = wx.Button(self.m_panelMain, wx.ID_OK, _(u"Close"), wx.DefaultPosition, wx.DefaultSize, 0) self.m_buttonClose.SetDefault() fgSizer3.Add(self.m_buttonClose, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) fgSizer1.Add(fgSizer3, 1, wx.EXPAND, 5) self.m_panelMain.SetSizer(fgSizer1) self.m_panelMain.Layout() fgSizer1.Fit(self.m_panelMain) bSizer1.Add(self.m_panelMain, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer1) self.Layout() bSizer1.Fit(self) self.Centre(wx.BOTH) # Connect Events self.m_buttonLicense.Bind(wx.EVT_BUTTON, self.onButtonLicenseClick) self.m_buttonCredits.Bind(wx.EVT_BUTTON, self.onButtonCreditsClick) self.m_buttonWebsite.Bind(wx.EVT_BUTTON, self.onButtonWebsiteClick)
def InitUI(self): panel = wx.Panel(self) sizer = wx.GridBagSizer(5, 5) text1 = wx.StaticText(panel, label="Java Class") sizer.Add(text1, pos=(0, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM, border=15) icon = wx.StaticBitmap(panel, bitmap=wx.Bitmap('exec.png')) sizer.Add(icon, pos=(0, 4), flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT, border=5) line = wx.StaticLine(panel) sizer.Add(line, pos=(1, 0), span=(1, 5), flag=wx.EXPAND|wx.BOTTOM, border=10) text2 = wx.StaticText(panel, label="Name") sizer.Add(text2, pos=(2, 0), flag=wx.LEFT, border=10) tc1 = wx.TextCtrl(panel) sizer.Add(tc1, pos=(2, 1), span=(1, 3), flag=wx.TOP|wx.EXPAND) text3 = wx.StaticText(panel, label="Package") sizer.Add(text3, pos=(3, 0), flag=wx.LEFT|wx.TOP, border=10) tc2 = wx.TextCtrl(panel) sizer.Add(tc2, pos=(3, 1), span=(1, 3), flag=wx.TOP|wx.EXPAND, border=5) button1 = wx.Button(panel, label="Browse...") sizer.Add(button1, pos=(3, 4), flag=wx.TOP|wx.RIGHT, border=5) text4 = wx.StaticText(panel, label="Extends") sizer.Add(text4, pos=(4, 0), flag=wx.TOP|wx.LEFT, border=10) combo = wx.ComboBox(panel) sizer.Add(combo, pos=(4, 1), span=(1, 3), flag=wx.TOP|wx.EXPAND, border=5) button2 = wx.Button(panel, label="Browse...") sizer.Add(button2, pos=(4, 4), flag=wx.TOP|wx.RIGHT, border=5) sb = wx.StaticBox(panel, label="Optional Attributes") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(wx.CheckBox(panel, label="Public"), flag=wx.LEFT|wx.TOP, border=5) boxsizer.Add(wx.CheckBox(panel, label="Generate Default Constructor"), flag=wx.LEFT, border=5) boxsizer.Add(wx.CheckBox(panel, label="Generate Main Method"), flag=wx.LEFT|wx.BOTTOM, border=5) sizer.Add(boxsizer, pos=(5, 0), span=(1, 5), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10) button3 = wx.Button(panel, label='Help') sizer.Add(button3, pos=(7, 0), flag=wx.LEFT, border=10) button4 = wx.Button(panel, label="Ok") sizer.Add(button4, pos=(7, 3)) button5 = wx.Button(panel, label="Cancel") sizer.Add(button5, pos=(7, 4), span=(1, 1), flag=wx.BOTTOM|wx.RIGHT, border=10) sizer.AddGrowableCol(2) panel.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, W, H): #if (platform.system() == "Windows"): wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, id=-1, pos=(10, 60), size=(340, H-330), name="ProtSuperimposition") winh = H-330 #else: #wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, id=-1, pos=(10, 60), size=(340, H-290), name="ProtSuperimposition") #winh = H-290 self.SetBackgroundColour("#333333") self.parent = parent self.sizer = wx.GridBagSizer(5, 5) #self.sb = wx.ScrollBar(self) #self.sb.SetScrollRange(10) #print self.sb.GetScrollRange(0) if (platform.system() == "Windows"): self.lblProt = wx.StaticText(self, -1, "Residue/Ligand Creator", (25, 15), (270, 25), style=wx.ALIGN_CENTRE) self.lblProt.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD)) elif (platform.system() == "Darwin"): self.lblProt = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblLigand.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(25, 15), size=(270, 25)) else: self.lblProt = wx.StaticText(self, -1, "Residue/Ligand Creator", pos=(60, 15), style=wx.ALIGN_CENTRE) self.lblProt.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD)) resizeTextControlForUNIX(self.lblProt, 0, self.GetSize()[0]) self.lblProt.SetForegroundColour("#FFFFFF") if (platform.system() == "Darwin"): self.HelpBtn = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/HelpBtn.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(295, 10), size=(25, 25)) else: self.HelpBtn = wx.Button(self, id=-1, label="?", pos=(295, 10), size=(25, 25)) self.HelpBtn.SetForegroundColour("#0000FF") self.HelpBtn.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.HelpBtn.Bind(wx.EVT_BUTTON, self.showHelp) self.HelpBtn.SetToolTipString("Display the help file for this window") if (platform.system() == "Windows"): self.lblInst = wx.StaticText(self, -1, "Upload a PDB file containing unrecognized atoms.\nThen select unrecognized residue types to parameterize.", (0, 45), (320, 25), wx.ALIGN_CENTRE) self.lblInst.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL)) elif (platform.system() == "Darwin"): self.lblInst = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblInstLigand.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(0, 45), size=(320, 50)) else: self.lblInst = wx.StaticText(self, -1, "Upload a PDB file containing unrecognized atoms.\nThen select unrecognized residue types to parameterize.", pos=(0, 45), style=wx.ALIGN_CENTRE) self.lblInst.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL)) resizeTextControlForUNIX(self.lblInst, 0, self.GetSize()[0]) self.lblInst.SetForegroundColour("#FFFFFF") self.lblMOL2 = wx.StaticText(self, -1, "None Uploaded", pos=(10, 103), size=(180, 25), style=wx.ALIGN_CENTRE) self.lblMOL2.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) if (platform.system() == "Linux"): resizeTextControlForUNIX(self.lblMOL2, 10, 180) self.lblMOL2.SetForegroundColour("#FFFFFF") if (platform.system() == "Darwin"): self.btnLoad = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/btnLoadMOL2.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(200, 100), size=(110, 25)) else: self.btnLoad = wx.Button(self, id=-1, label="Load .MOL2", pos=(200, 100), size=(110, 25)) self.btnLoad.SetForegroundColour("#000000") self.btnLoad.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.btnLoad.Bind(wx.EVT_BUTTON, self.loadMOL2) self.btnLoad.SetToolTipString("Load a .mol2 file containing a ligand/NCAA") if (platform.system() == "Darwin"): self.btnType = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/btnType_Ligand.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(40, 140), size=(100, 25)) else: self.btnType = wx.Button(self, id=-1, label="Ligand", pos=(40, 140), size=(100, 25)) self.btnType.SetForegroundColour("#000000") self.btnType.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.btnType.Bind(wx.EVT_BUTTON, self.typeToggle) self.btnType.SetToolTipString("Uploaded .mol2 file represents a ligand") if (platform.system() == "Darwin"): self.btnCreate = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/btnCreate.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(180, 140), size=(100, 25)) else: self.btnCreate = wx.Button(self, id=-1, label="Create!", pos=(180, 140), size=(100, 25)) self.btnCreate.SetForegroundColour("#000000") self.btnCreate.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.btnCreate.Bind(wx.EVT_BUTTON, self.createParams) self.btnCreate.Disable() self.btnCreate.SetToolTipString("Parameterize the uploaded .mol2 structure") self.paramsType = "Ligand" self.paramsAtoms = [] self.grdParamsAtoms = wx.grid.Grid(self) self.grdParamsAtoms.CreateGrid(0, 1) if (winh-265 > 200): self.grdParamsAtoms.SetSize((320, winh-265)) else: self.grdParamsAtoms.SetSize((320, 200)) self.grdParamsAtoms.SetPosition((0, 175)) self.grdParamsAtoms.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.grdParamsAtoms.DisableDragColSize() self.grdParamsAtoms.DisableDragRowSize() self.grdParamsAtoms.SetColLabelValue(0, "Assigned Type") self.grdParamsAtoms.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.gridClick) ypos = self.grdParamsAtoms.GetPosition()[1] + self.grdParamsAtoms.GetSize()[1] + 10 if (platform.system() == "Darwin"): self.atomMenu = wx.ComboBox(self, pos=(10, ypos), size=(140, 25), choices=[], style=wx.CB_READONLY) else: self.atomMenu = wx.ComboBox(self, pos=(10, ypos), size=(140, 25), choices=[], style=wx.CB_READONLY | wx.CB_SORT) self.atomMenu.Bind(wx.EVT_COMBOBOX, self.atomMenuSelect) self.atomMenu.SetToolTipString("Select .mol2 atoms for editing") if (platform.system() == "Darwin"): self.typeMenu = wx.ComboBox(self, pos=(170, ypos), size=(140, 25), choices=[], style=wx.CB_READONLY) else: self.typeMenu = wx.ComboBox(self, pos=(170, ypos), size=(140, 25), choices=[], style=wx.CB_READONLY | wx.CB_SORT) self.typeMenu.Bind(wx.EVT_COMBOBOX, self.typeMenuSelect) self.typeMenu.SetToolTipString("Change the parameterization type for the selected atom") # Useful dictionary of atom elements mapped to available types self.atomtypes = {} self.atomtypes["H"] = ["Hpol", "Haro", "Hapo"] self.atomtypes["C"] = ["CH3", "CH2", "CH1", "aroC", "CNH2", "COO", "CAbb", "CObb"] self.atomtypes["N"] = ["Nlys", "NH2O", "Ntrp", "Nhis", "Npro", "Nbb"] self.atomtypes["O"] = ["OH", "Oaro", "OOC", "OCbb", "ONH2"] self.atomtypes["S"] = ["S"] self.atomtypes["P"] = ["Phos"] self.atomtypes["F"] = ["F"] self.atomtypes["CL"] = ["Cl"] self.atomtypes["BR"] = ["Br"] self.atomtypes["I"] = ["I"] self.atomtypes["NA"] = ["Na1p"] self.atomtypes["K"] = ["K1p"] self.atomtypes["MG"] = ["Mg2p"] self.atomtypes["FE"] = ["Fe3p"] self.atomtypes["CA"] = ["Ca2p"] self.atomtypes["ZN"] = ["Zn2p"] if (platform.system() == "Darwin"): self.lblNterm = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblNterm.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(10, ypos+35), size=(40, 25)) else: self.lblNterm = wx.StaticText(self, -1, "Nterm:", pos=(10, ypos+35), size=(40, 25)) self.lblNterm.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL)) self.lblNterm.SetForegroundColour("#FFFFFF") self.NtermMenu = wx.ComboBox(self, pos=(60, ypos+30), size=(90, 25), choices=[], style=wx.CB_READONLY) self.NtermMenu.Bind(wx.EVT_COMBOBOX, self.atomMenuSelect) self.NtermMenu.SetToolTipString("N-terminus atom for NCAAs") if (platform.system() == "Darwin"): self.lblCterm = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblCterm.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(170, ypos+35), size=(40, 25)) else: self.lblCterm = wx.StaticText(self, -1, "Cterm:", pos=(170, ypos+35), size=(40, 25)) self.lblCterm.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL)) self.lblCterm.SetForegroundColour("#FFFFFF") if (platform.system() == "Darwin"): self.CtermMenu = wx.ComboBox(self, pos=(220, ypos+30), size=(90, 25), choices=[], style=wx.CB_READONLY) else: self.CtermMenu = wx.ComboBox(self, pos=(220, ypos+30), size=(90, 25), choices=[], style=wx.CB_READONLY | wx.CB_SORT) self.CtermMenu.Bind(wx.EVT_COMBOBOX, self.typeMenuSelect) self.CtermMenu.SetToolTipString("C-terminus atom for NCAAs") self.NtermMenu.Disable() self.CtermMenu.Disable() if (platform.system() == "Darwin"): self.lblCode = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblCode.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(10, ypos+65), size=(40, 25)) else: self.lblCode = wx.StaticText(self, -1, "Code:", pos=(10, ypos+65), size=(40, 25)) self.lblCode.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL)) self.lblCode.SetForegroundColour("#FFFFFF") self.txtCode = wx.TextCtrl(self, -1, pos=(50, ypos+60), size=(40, 25)) self.txtCode.SetValue("UNK") self.txtCode.SetToolTipString("Three-letter amino acid code for the ligand/NCAA") if (platform.system() == "Darwin"): self.btnAdd = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/btnAddDB.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(110, ypos+60), size=(200, 25)) else: self.btnAdd = wx.Button(self, id=-1, label="Add to Database", pos=(110, ypos+60), size=(200, 25)) self.btnAdd.SetForegroundColour("#000000") self.btnAdd.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.BOLD)) self.btnAdd.Bind(wx.EVT_BUTTON, self.addToDB) self.btnAdd.Disable() self.btnAdd.SetToolTipString("Add the ligand/NCAA to the Rosetta database with the selected parameters") if (platform.system() == "Windows"): self.lblLine = wx.StaticText(self, -1, "==========================", (0, ypos+90), (320, 20), wx.ALIGN_CENTRE) self.lblLine.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) elif (platform.system() == "Darwin"): self.lblLine = wx.StaticBitmap(self, -1, wx.Image(self.parent.parent.scriptdir + "/images/osx/lblLine.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(0, ypos+90), size=(320, 20)) else: self.lblLine = wx.StaticText(self, -1, "==========================", (0, ypos+90), style=wx.ALIGN_CENTRE) self.lblLine.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) resizeTextControlForUNIX(self.lblLine, 20, 120) self.lblLine.SetForegroundColour("#FFFFFF") self.removeMenu = wx.ComboBox(self, pos=(10, ypos+110), size=(90, 25), choices=[], style=wx.CB_READONLY) self.removeMenu.Bind(wx.EVT_COMBOBOX, self.resMenuSelect) self.removeMenu.SetToolTipString("Select residues already parameterized for removal") if (platform.system() == "Darwin"): self.btnRemove = wx.BitmapButton(self, id=-1, bitmap=wx.Image(self.parent.parent.scriptdir + "/images/osx/btnRemoveDB.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap(), pos=(110, ypos+110), size=(200, 25)) else: self.btnRemove = wx.Button(self, id=-1, label="Remove from DB", pos=(110, ypos+110), size=(200, 25)) self.btnRemove.SetForegroundColour("#000000") self.btnRemove.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.btnRemove.Bind(wx.EVT_BUTTON, self.removeParams) self.btnRemove.SetToolTipString("Uploaded .mol2 file represents a ligand") goToSandbox("params") paramsfiles = glob.glob("*.fa.params") paramslist = [] for param in paramsfiles: if (param != "HOH.fa.params"): paramslist.append(param.split(".fa.params")[0]) self.removeMenu.AppendItems(paramslist) #self.SetSizerAndFit(self.sizer) #self.SetupScrolling() scrollh = self.btnRemove.GetPosition()[1] + self.btnRemove.GetSize()[1] + 5 self.SetScrollbars(1, 1, 320, scrollh) self.grdParamsAtoms.SetColSize(0, int(self.grdParamsAtoms.GetSize()[0] / 2)) self.grdParamsAtoms.SetRowLabelSize(int(self.grdParamsAtoms.GetSize()[0] / 2)) self.winscrollpos = 0 self.Bind(wx.EVT_SCROLLWIN, self.scrolled)
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((400, 300)) self.SetTitle("frame") self.panel_1 = wx.Panel(self, wx.ID_ANY) self.panel_1.SetBackgroundColour(wx.Colour(30, 30, 30)) sizer_1 = wx.BoxSizer(wx.VERTICAL) static_line_1 = wx.StaticLine(self.panel_1, wx.ID_ANY) sizer_1.Add(static_line_1, 0, wx.ALL | wx.EXPAND, 4) static_line_2 = wx.StaticLine(self.panel_1, wx.ID_ANY) sizer_1.Add(static_line_2, 0, wx.ALL | wx.EXPAND, 4) sizer_1.Add((20, 20), 0, 0, 0) static_text_1 = wx.StaticText( self.panel_1, wx.ID_ANY, "COVID PREDICTION USING ARTIFICIAL INTELLIGENCE") static_text_1.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_1.SetFont( wx.Font(20, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_1.Add(static_text_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_1.Add((20, 20), 0, 0, 0) static_line_3 = wx.StaticLine(self.panel_1, wx.ID_ANY) sizer_1.Add(static_line_3, 0, wx.ALL | wx.EXPAND, 4) static_line_4 = wx.StaticLine(self.panel_1, wx.ID_ANY) sizer_1.Add(static_line_4, 0, wx.ALL | wx.EXPAND, 4) sizer_1.Add((20, 20), 0, 0, 0) static_text_2 = wx.StaticText(self.panel_1, wx.ID_ANY, "Welcome !!") static_text_2.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_2.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_1.Add(static_text_2, 0, 0, 0) static_text_3 = wx.StaticText(self.panel_1, wx.ID_ANY, "Good to see you here") static_text_3.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_3.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_1.Add(static_text_3, 0, 0, 0) static_text_4 = wx.StaticText( self.panel_1, wx.ID_ANY, "We help you now in predicting COVID19 using Artificial Intelligence." ) static_text_4.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_4.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_1.Add(static_text_4, 0, 0, 0) static_text_5 = wx.StaticText(self.panel_1, wx.ID_ANY, "Choose the type of prediction") static_text_5.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_5.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_1.Add(static_text_5, 0, 0, 0) sizer_1.Add((40, 40), 0, 0, 0) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) sizer_2.Add((100, 20), 0, 0, 0) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_2.Add(sizer_3, 1, wx.EXPAND, 0) static_text_6 = wx.StaticText(self.panel_1, wx.ID_ANY, "X-Ray based Predicion") static_text_6.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_6.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_3.Add(static_text_6, 0, 0, 0) bitmap_1 = wx.StaticBitmap( self.panel_1, wx.ID_ANY, wx.Bitmap("C:\\Users\\msmit\\Downloads\\circle-cropped.png", wx.BITMAP_TYPE_ANY)) sizer_3.Add(bitmap_1, 0, 0, 0) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_2.Add(sizer_4, 1, wx.EXPAND, 0) static_text_7 = wx.StaticText(self.panel_1, wx.ID_ANY, "Symptom Checker") static_text_7.SetForegroundColour(wx.Colour(255, 255, 255)) static_text_7.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_BOLD, 0, "")) sizer_4.Add(static_text_7, 0, 0, 0) bitmap_2 = wx.StaticBitmap( self.panel_1, wx.ID_ANY, wx.Bitmap("C:/Users/msmit/Downloads/symptoms-icon.png", wx.BITMAP_TYPE_ANY)) sizer_4.Add(bitmap_2, 0, 0, 0) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_1.Add(sizer_6, 1, wx.EXPAND, 0) sizer_6.Add((450, 40), 0, 0, 0) self.combo_box_1 = wx.ComboBox( self.panel_1, wx.ID_ANY, choices=["X-Ray Prediction", "Symptom Checker"], style=wx.CB_DROPDOWN) self.combo_box_1.SetBackgroundColour(wx.Colour(177, 177, 177)) self.combo_box_1.SetForegroundColour(wx.Colour(255, 255, 255)) self.combo_box_1.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_6.Add(self.combo_box_1, 0, wx.ALL, 0) sizer_1.Add((40, 40), 0, 0, 0) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_1.Add(sizer_5, 1, wx.ALL | wx.EXPAND, 0) sizer_5.Add((450, 40), 0, 0, 0) self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, "OK") self.button_1.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_5.Add(self.button_1, 0, 0, 0) sizer_5.Add((20, 20), 0, 0, 0) self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, "EXIT") self.button_2.SetFont( wx.Font(16, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL, 0, "")) sizer_5.Add(self.button_2, 0, 0, 0) self.panel_1.SetSizer(sizer_1) self.Layout() self.Bind(wx.EVT_TEXT, self.Combo_Pred, self.combo_box_1) self.Bind(wx.EVT_BUTTON, self.Ok_Button, self.button_1) self.Bind(wx.EVT_BUTTON, self.Exit_Button, self.button_2)
def __init__(self, *args, **kw): kw.setdefault('style', self.DEFAULT_STYLE) self.view = kw.pop('rv', None) showCheckbox = kw.pop('showCheckbox', True) super(ShutdownDialog, self).__init__(*args, **kw) logo = wx.GetApp().GetImage("Chandler_64.png") bitmap = wx.StaticBitmap(self, -1, logo) title = wx.StaticText(self, -1, _(u"Chandler is shutting down...")) title.Font = getFont(size=15.0, weight=wx.FONTWEIGHT_BOLD) self.status = wx.StaticText(self, -1, " ") self.status.Font = getFont(size=12.0) note = wx.html.HtmlWindow(self, -1, style=wx.html.HW_SCROLLBAR_NEVER|wx.html.HW_NO_SELECTION, size=(270, -1)) note.SetFonts("", "", sizes=[9, 10, 11, 12, 13, 14, 15]) noteTxt = _(u"NOTE: ") warningTxt = _(u"Back up may lose data if\nChandler does not quit completely.") def fixText(text): return text.replace( u"&", u"&" ).replace( u"<", u"<" ).replace( u">", u">" ).replace( "\n", "<br>" ) noteHtml = ''.join(( '<html>\n<body><b><font size="-1">', fixText(noteTxt), '</font></b>', fixText(warningTxt), '</body></html>' )) note.SetPage(noteHtml) ir = note.GetInternalRepresentation() note.SetSize((ir.GetWidth(), ir.GetHeight())) if not showCheckbox: checkbox = self.cancel = None else: doBackup = getattr(self._prefs, 'backupOnQuit', True) checkbox = wx.CheckBox(self, -1, _(u"&Back up data when quitting Chandler")) checkbox.Font = getFont(size=11.0) checkbox.Value = doBackup checkbox.SetFocus() self.cancel = wx.Button(self, wx.ID_CANCEL, _(u"&Skip Back up")) self.cancel.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) self.cancel.Enabled = doBackup checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheck) self.cancel.Bind(wx.EVT_BUTTON, self.OnSkipBackup) topSizer = wx.BoxSizer(wx.HORIZONTAL) topSizer.Add(bitmap, 0, wx.ALIGN_TOP|wx.TOP|wx.LEFT|wx.RIGHT, 20) topRightSizer = wx.BoxSizer(wx.VERTICAL) topRightSizer.Add(title, 0, wx.ALIGN_LEFT|wx.TOP|wx.BOTTOM|wx.RIGHT, 40.0) topRightSizer.Add(self.status, 0, wx.EXPAND, wx.TOP, 12) topRightSizer.Add(note, 0, wx.ALIGN_LEFT|wx.LEFT, -10) topSizer.Add(topRightSizer, 0, wx.EXPAND|wx.BOTTOM, 30) bottomSizer = wx.BoxSizer(wx.HORIZONTAL) if checkbox is not None: bottomSizer.Add(checkbox, 1, wx.ALIGN_BOTTOM, 0) if self.cancel is not None: bottomSizer.Add(self.cancel, 0, wx.ALIGN_BOTTOM |wx.LEFT, 40) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(topSizer, 0, wx.ALIGN_LEFT|wx.ALIGN_TOP, 0) self.Sizer.Add(bottomSizer, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, 15) self.SetAutoLayout(True) self.Sizer.Fit(self) self.CenterOnScreen() self.SetBackgroundColour(wx.WHITE) self.status.MinSize = (self.Size.width, self.status.MinSize.height)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"JaysPyCOM", pos = wx.DefaultPosition, size = wx.Size( 700,598 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) ) self.menubar = wx.MenuBar( 0 ) self.m_menu_help = wx.Menu() self.m_menuItem_homPage = wx.MenuItem( self.m_menu_help, wx.ID_ANY, u"Home Page", wx.EmptyString, wx.ITEM_NORMAL ) self.m_menu_help.Append( self.m_menuItem_homPage ) self.m_menuItem_about = wx.MenuItem( self.m_menu_help, wx.ID_ANY, u"About Author", wx.EmptyString, wx.ITEM_NORMAL ) self.m_menu_help.Append( self.m_menuItem_about ) self.menubar.Append( self.m_menu_help, u"Help" ) self.SetMenuBar( self.menubar ) win_sizer = wx.BoxSizer( wx.VERTICAL ) receive_win = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) self.m_staticText_receive = wx.StaticText( self, wx.ID_ANY, u"Receive:", wx.DefaultPosition, wx.Size( 700,25 ), 0 ) self.m_staticText_receive.Wrap( -1 ) self.m_staticText_receive.SetFont( wx.Font( 14, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial Narrow" ) ) self.m_staticText_receive.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) self.m_staticText_receive.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) ) receive_win.Add( self.m_staticText_receive, 0, wx.ALL, 5 ) self.m_staticText_recvFormat = wx.StaticText( self, wx.ID_ANY, u"Format:", wx.DefaultPosition, wx.Size( 50,15 ), 0 ) self.m_staticText_recvFormat.Wrap( -1 ) self.m_staticText_recvFormat.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) receive_win.Add( self.m_staticText_recvFormat, 0, wx.ALL, 5 ) m_choice_recvFormatChoices = [ u"Char", wx.EmptyString, u"Hex" ] self.m_choice_recvFormat = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 50,20 ), m_choice_recvFormatChoices, 0 ) self.m_choice_recvFormat.SetSelection( 0 ) receive_win.Add( self.m_choice_recvFormat, 0, wx.ALL, 5 ) self.m_staticText_null1 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 480,20 ), 0 ) self.m_staticText_null1.Wrap( -1 ) receive_win.Add( self.m_staticText_null1, 0, wx.ALL, 5 ) self.m_button_recvClear = wx.Button( self, wx.ID_ANY, u"Clear", wx.DefaultPosition, wx.Size( 50,30 ), 0 ) self.m_button_recvClear.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) receive_win.Add( self.m_button_recvClear, 0, wx.ALL, 5 ) self.m_textCtrl_recv = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 700,180 ), wx.TE_MULTILINE ) self.m_textCtrl_recv.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) receive_win.Add( self.m_textCtrl_recv, 0, wx.ALL, 5 ) win_sizer.Add( receive_win, 1, wx.EXPAND, 5 ) edit_win = wx.GridSizer( 0, 2, 0, 0 ) setting_win = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) self.m_staticText_settings = wx.StaticText( self, wx.ID_ANY, u"Settings:", wx.DefaultPosition, wx.Size( 350,25 ), 0 ) self.m_staticText_settings.Wrap( -1 ) self.m_staticText_settings.SetFont( wx.Font( 14, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial Narrow" ) ) self.m_staticText_settings.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) self.m_staticText_settings.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) ) setting_win.Add( self.m_staticText_settings, 0, wx.ALL, 5 ) self.m_staticText_comPort = wx.StaticText( self, wx.ID_ANY, u"Com Port:", wx.DefaultPosition, wx.Size( 150,15 ), wx.ALIGN_RIGHT ) self.m_staticText_comPort.Wrap( -1 ) self.m_staticText_comPort.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) setting_win.Add( self.m_staticText_comPort, 0, wx.ALL, 5 ) m_choice_comPortChoices = [] self.m_choice_comPort = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 120,20 ), m_choice_comPortChoices, 0 ) self.m_choice_comPort.SetSelection( 0 ) setting_win.Add( self.m_choice_comPort, 0, wx.ALL, 5 ) self.m_staticText_baudrate = wx.StaticText( self, wx.ID_ANY, u"Baud Rate:", wx.DefaultPosition, wx.Size( 150,15 ), wx.ALIGN_RIGHT ) self.m_staticText_baudrate.Wrap( -1 ) self.m_staticText_baudrate.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) setting_win.Add( self.m_staticText_baudrate, 0, wx.ALL, 5 ) m_choice_baudrateChoices = [ u"256000", u"128000", u"115200", u"57600", u"38400", u"19200", u"9600", u"4800" ] self.m_choice_baudrate = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 120,20 ), m_choice_baudrateChoices, 0 ) self.m_choice_baudrate.SetSelection( 2 ) self.m_choice_baudrate.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) ) setting_win.Add( self.m_choice_baudrate, 0, wx.ALL, 5 ) self.m_staticText_dataBits = wx.StaticText( self, wx.ID_ANY, u"Data Bits:", wx.DefaultPosition, wx.Size( 150,15 ), wx.ALIGN_RIGHT ) self.m_staticText_dataBits.Wrap( -1 ) self.m_staticText_dataBits.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) setting_win.Add( self.m_staticText_dataBits, 0, wx.ALL, 5 ) m_choice_dataBitsChoices = [ u"8", u"7", u"6", u"5" ] self.m_choice_dataBits = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 120,20 ), m_choice_dataBitsChoices, 0 ) self.m_choice_dataBits.SetSelection( 0 ) setting_win.Add( self.m_choice_dataBits, 0, wx.ALL, 5 ) self.m_staticText_stopBits = wx.StaticText( self, wx.ID_ANY, u"Stop Bits:", wx.DefaultPosition, wx.Size( 150,15 ), wx.ALIGN_RIGHT ) self.m_staticText_stopBits.Wrap( -1 ) self.m_staticText_stopBits.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) setting_win.Add( self.m_staticText_stopBits, 0, wx.ALL, 5 ) m_choice_stopBitsChoices = [ u"1", u"1.5", u"2" ] self.m_choice_stopBits = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 120,20 ), m_choice_stopBitsChoices, 0 ) self.m_choice_stopBits.SetSelection( 0 ) setting_win.Add( self.m_choice_stopBits, 0, wx.ALL, 5 ) self.m_staticText_parityBits = wx.StaticText( self, wx.ID_ANY, u"Parity Bits", wx.DefaultPosition, wx.Size( 150,15 ), wx.ALIGN_RIGHT ) self.m_staticText_parityBits.Wrap( -1 ) self.m_staticText_parityBits.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) setting_win.Add( self.m_staticText_parityBits, 0, wx.ALL, 5 ) m_choice_parityBitsChoices = [ u"None", u"Odd", u"Even", u"Mark", u"Space" ] self.m_choice_parityBits = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 120,20 ), m_choice_parityBitsChoices, 0 ) self.m_choice_parityBits.SetSelection( 0 ) setting_win.Add( self.m_choice_parityBits, 0, wx.ALL, 5 ) self.m_staticText_null2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 90,15 ), 0 ) self.m_staticText_null2.Wrap( -1 ) setting_win.Add( self.m_staticText_null2, 0, wx.ALL, 5 ) self.m_bitmap_led = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) setting_win.Add( self.m_bitmap_led, 0, wx.ALL, 5 ) self.m_button_openClose = wx.Button( self, wx.ID_ANY, u"Open", wx.DefaultPosition, wx.Size( 80,40 ), 0 ) self.m_button_openClose.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) setting_win.Add( self.m_button_openClose, 0, wx.ALL, 5 ) edit_win.Add( setting_win, 1, wx.EXPAND, 5 ) send_win = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) self.m_staticText_send = wx.StaticText( self, wx.ID_ANY, u"Send:", wx.DefaultPosition, wx.Size( 350,25 ), 0 ) self.m_staticText_send.Wrap( -1 ) self.m_staticText_send.SetFont( wx.Font( 14, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial Narrow" ) ) self.m_staticText_send.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) send_win.Add( self.m_staticText_send, 0, wx.ALL, 5 ) self.m_staticText_sendFormat = wx.StaticText( self, wx.ID_ANY, u"Format:", wx.DefaultPosition, wx.Size( 50,15 ), 0 ) self.m_staticText_sendFormat.Wrap( -1 ) self.m_staticText_sendFormat.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) ) send_win.Add( self.m_staticText_sendFormat, 0, wx.ALL, 5 ) m_choice_sendFormatChoices = [ u"Char", u"Hex" ] self.m_choice_sendFormat = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 50,20 ), m_choice_sendFormatChoices, 0 ) self.m_choice_sendFormat.SetSelection( 0 ) send_win.Add( self.m_choice_sendFormat, 0, wx.ALL, 5 ) self.m_staticText_null3 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 130,20 ), 0 ) self.m_staticText_null3.Wrap( -1 ) send_win.Add( self.m_staticText_null3, 0, wx.ALL, 5 ) self.m_button_sendClear = wx.Button( self, wx.ID_ANY, u"Clear", wx.DefaultPosition, wx.Size( 50,30 ), 0 ) self.m_button_sendClear.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) send_win.Add( self.m_button_sendClear, 0, wx.ALL, 5 ) self.m_textCtrl_send = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 350,105 ), wx.TE_MULTILINE ) self.m_textCtrl_send.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) send_win.Add( self.m_textCtrl_send, 0, wx.ALL, 5 ) self.m_staticText_null4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 120,15 ), 0 ) self.m_staticText_null4.Wrap( -1 ) send_win.Add( self.m_staticText_null4, 0, wx.ALL, 5 ) self.m_button_send = wx.Button( self, wx.ID_ANY, u"Send", wx.DefaultPosition, wx.Size( 80,40 ), 0 ) self.m_button_send.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) send_win.Add( self.m_button_send, 0, wx.ALL, 5 ) edit_win.Add( send_win, 1, wx.EXPAND, 5 ) win_sizer.Add( edit_win, 1, wx.EXPAND, 5 ) self.SetSizer( win_sizer ) self.Layout() self.statusBar = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY ) self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_MENU, self.showHomepageMessage, id = self.m_menuItem_homPage.GetId() ) self.Bind( wx.EVT_MENU, self.showAboutMessage, id = self.m_menuItem_about.GetId() ) self.m_choice_recvFormat.Bind( wx.EVT_CHOICE, self.setRecvFormat ) self.m_button_recvClear.Bind( wx.EVT_BUTTON, self.clearRecvDisplay ) self.m_choice_comPort.Bind( wx.EVT_ENTER_WINDOW, self.refreshComPort ) self.m_button_openClose.Bind( wx.EVT_BUTTON, self.openClosePort ) self.m_choice_sendFormat.Bind( wx.EVT_CHOICE, self.setSendFormat ) self.m_button_sendClear.Bind( wx.EVT_BUTTON, self.clearSendDisplay ) self.m_button_send.Bind( wx.EVT_BUTTON, self.sendData )
def __init__(self, parent, title="", message="", alias="", payload=None, flags=0, time=0, action=None, event=None): self.alias = alias self.payload = payload self.action = action self.event = event self.title = title if title else eg.APP_NAME optionFlags, iconFlag, buttonFlags = action.getFlags(flags) dialogStyle = wx.DEFAULT_DIALOG_STYLE & (~wx.CLOSE_BOX) if optionFlags & 2: dialogStyle |= wx.STAY_ON_TOP wx.Dialog.__init__(self, parent, -1, "", wx.DefaultPosition, style=dialogStyle) self.SetTitle(title) icon = wx.EmptyIcon() icon.LoadFile(join(eg.imagesDir, "icon32x32.png"), wx.BITMAP_TYPE_PNG) self.SetIcon(icon) art = self.ARTS[iconFlag] if art is not None: bmp = wx.ArtProvider.GetBitmap(art, wx.ART_MESSAGE_BOX, (32, 32)) icon = wx.StaticBitmap(self, -1, bmp) else: icon = (32, 32) if optionFlags & 4: PlaySound(self.SOUNDS[iconFlag], SND_ASYNC) message = wx.StaticText(self, -1, message) font = message.GetFont() font.SetPointSize(10) message.SetFont(font) message.Wrap(416) line = wx.StaticLine(self, -1, size=(1, -1), style=wx.LI_HORIZONTAL) bottomSizer = wx.BoxSizer(wx.HORIZONTAL) bottomSizer.Add((10, 1)) if time: self.cnt = time txt = action.text.autoClose % self.cnt info = wx.StaticText(self, -1, txt) info.Enable(False) bottomSizer.Add(info, 0, wx.TOP, 3) def UpdateInfoLabel(evt): self.cnt -= 1 txt = action.text.autoClose % self.cnt info.SetLabel(txt) if not self.cnt: self.SetReturnCode(wx.ID_CANCEL) self.Close() self.Bind(wx.EVT_TIMER, UpdateInfoLabel) self.timer = wx.Timer(self) self.timer.Start(1000) else: self.timer = None bottomSizer.Add((5, 1), 1, wx.EXPAND) buttons = self.BUTTONS[buttonFlags] for bttn in buttons: b = wx.Button(self, bttn, action.text.__dict__[self.LABELS[bttn]]) b.SetFont(font) bottomSizer.Add(b, 0, wx.LEFT, 5) bottomSizer.Add((10, 1)) topSizer = wx.BoxSizer(wx.HORIZONTAL) topSizer.Add((1, 1), 0, wx.LEFT | wx.RIGHT, 5) topSizer.Add(icon, 0, wx.LEFT | wx.RIGHT | wx.TOP, 10) topSizer.Add(message, 0, wx.TOP | wx.BOTTOM, 10) topSizer.Add((1, 1), 0, wx.EXPAND | wx.RIGHT, 35) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(topSizer, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) mainSizer.Add(line, 0, wx.EXPAND | wx.ALL, 5) mainSizer.Add(bottomSizer, 0, wx.EXPAND | wx.BOTTOM, 5) self.SetSizer(mainSizer) self.Fit() self.Bind(wx.EVT_CLOSE, self.onClose) def OnButton(evt): self.SetReturnCode(evt.GetId()) self.Close() evt.Skip() wx.EVT_BUTTON(self, -1, OnButton)
def __init__(self, parent, IDcompte=None, defaut=0): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) self.parent = parent self.IDcompte = IDcompte self.defaut = defaut # Généralités self.box_generalites_staticbox = wx.StaticBox(self, -1, _(u"Généralités")) self.label_nom = wx.StaticText(self, -1, _(u"Intitulé :")) self.ctrl_nom = wx.TextCtrl(self, -1, u"") self.label_numero = wx.StaticText(self, -1, _(u"Numéro :")) self.ctrl_numero = wx.TextCtrl(self, -1, u"") # Coordonnées bancaires self.box_infos_staticbox = wx.StaticBox(self, -1, _(u"Coordonnées bancaires")) self.label_raison = wx.StaticText(self, -1, _(u"Raison sociale :")) self.ctrl_raison = wx.TextCtrl(self, -1, u"") self.label_etab = wx.StaticText(self, -1, _(u"N° Etab. :")) self.ctrl_etab = wx.TextCtrl(self, -1, u"") self.label_guichet = wx.StaticText(self, -1, _(u"N° Guichet :")) self.ctrl_guichet = wx.TextCtrl(self, -1, u"") self.label_cle_rib = wx.StaticText(self, -1, _(u"Clé RIB :")) self.ctrl_cle_rib = wx.TextCtrl(self, -1, u"") self.label_cle_iban = wx.StaticText(self, -1, _(u"Clé IBAN :")) self.ctrl_cle_iban = wx.TextCtrl(self, -1, _(u"FR76")) self.label_iban = wx.StaticText(self, -1, _(u"N° IBAN :")) self.ctrl_iban = wx.TextCtrl(self, -1, u"") self.ctrl_iban.Enable(False) self.image_valide = wx.Bitmap( Chemins.GetStaticPath(u"Images/16x16/Ok4.png"), wx.BITMAP_TYPE_ANY) self.image_nonvalide = wx.Bitmap( Chemins.GetStaticPath(u"Images/16x16/Interdit2.png"), wx.BITMAP_TYPE_ANY) self.ctrl_controle_iban = wx.StaticBitmap(self, -1, self.image_nonvalide) self.label_bic = wx.StaticText(self, -1, _(u"N° BIC :")) self.ctrl_bic = wx.TextCtrl(self, -1, u"") self.label_nne = wx.StaticText(self, -1, _(u"N° NNE :")) self.ctrl_nne = wx.TextCtrl(self, -1, u"") self.label_ics = wx.StaticText(self, -1, _(u"N° ICS :")) self.ctrl_ics = wx.TextCtrl(self, -1, u"") # Compte DFT self.box_dft_staticbox = wx.StaticBox(self, -1, _(u"Compte DFT")) self.label_dft_titulaire = wx.StaticText(self, -1, _(u"Titulaire du compte :")) self.ctrl_dft_titulaire = wx.TextCtrl(self, -1, u"") self.label_dft_iban = wx.StaticText(self, -1, _(u"N° IBAN DFT :")) self.ctrl_dft_iban = wx.TextCtrl(self, -1, u"") self.dft_image_valide = wx.Bitmap( Chemins.GetStaticPath(u"Images/16x16/Ok4.png"), wx.BITMAP_TYPE_ANY) self.dft_image_nonvalide = wx.Bitmap( Chemins.GetStaticPath(u"Images/16x16/Interdit2.png"), wx.BITMAP_TYPE_ANY) self.ctrl_controle_dft_iban = wx.StaticBitmap(self, -1, self.dft_image_nonvalide) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_TEXT, self.MAJ_IBAN, self.ctrl_etab) self.Bind(wx.EVT_TEXT, self.MAJ_IBAN, self.ctrl_guichet) self.Bind(wx.EVT_TEXT, self.MAJ_IBAN, self.ctrl_cle_rib) self.Bind(wx.EVT_TEXT, self.MAJ_IBAN, self.ctrl_cle_iban) self.Bind(wx.EVT_TEXT, self.MAJ_DFT_IBAN, self.ctrl_dft_iban) # Init contrôles if self.IDcompte != None: self.Importation() self.MAJ_IBAN() self.MAJ_DFT_IBAN()
def __init__(self, parent, wid=-1, pos=(0, 0), size=wx.DefaultSize, style=wx.NO_BORDER): style = style | wx.NO_BORDER super(InfoLegend, self).__init__(parent, wid, pos, size, style) # Cannot be a constant because loading bitmaps only works after wx.App # has been created. self._type_to_icon = ( (MD_AT_AR, img.getBitmap("icon/ico_blending_ang.png")), (MD_AT_SPECTRUM, img.getBitmap("icon/ico_blending_spec.png")), (MD_AT_EM, img.getBitmap("icon/ico_blending_sem.png")), (MD_AT_OVV_TILES, img.getBitmap("icon/ico_blending_map.png")), (MD_AT_OVV_FULL, img.getBitmap("icon/ico_blending_navcam.png")), (MD_AT_HISTORY, img.getBitmap("icon/ico_blending_history.png")), (MD_AT_CL, img.getBitmap("icon/ico_blending_opt.png")), (MD_AT_FLUO, img.getBitmap("icon/ico_blending_opt.png")), (MD_AT_SLIT, img.getBitmap("icon/ico_blending_slit.png")), ) self.SetBackgroundColour(parent.GetBackgroundColour()) self.SetForegroundColour(parent.GetForegroundColour()) ### Create child windows # Merge slider # TODO: should be possible to use VAConnector self.merge_slider = Slider( self, wx.ID_ANY, 50, # val 0, 100, size=(100, 12), style=(wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_TICKS | wx.NO_BORDER)) self.merge_slider.SetBackgroundColour(parent.GetBackgroundColour()) self.merge_slider.SetForegroundColour(FG_COLOUR_DIS) # "#4d4d4d" self.merge_slider.SetToolTip("Merge ratio") self.bmp_slider_left = wx.StaticBitmap( self, wx.ID_ANY, img.getBitmap("icon/ico_blending_opt.png")) self.bmp_slider_right = wx.StaticBitmap( self, wx.ID_ANY, img.getBitmap("icon/ico_blending_sem.png")) # Horizontal Field Width text self.hfw_text = wx.TextCtrl(self, style=wx.NO_BORDER | wx.CB_READONLY) self.hfw_text.SetBackgroundColour(parent.GetBackgroundColour()) self.hfw_text.SetForegroundColour(parent.GetForegroundColour()) self.hfw_text.SetToolTip("Horizontal Field Width") # Magnification text self.magnification_text = wx.TextCtrl(self, style=wx.NO_BORDER | wx.CB_READONLY) self.magnification_text.SetBackgroundColour( parent.GetBackgroundColour()) self.magnification_text.SetForegroundColour( parent.GetForegroundColour()) self.magnification_text.SetToolTip("Magnification") # Z position text self.zPos_text = wx.TextCtrl(self, style=wx.NO_BORDER | wx.CB_READONLY) self.zPos_text.SetBackgroundColour(parent.GetBackgroundColour()) self.zPos_text.SetForegroundColour(parent.GetForegroundColour()) self.zPos_text.SetToolTip("Z Position") self.zPos_text.Hide() # Scale window self.scale_win = ScaleWindow(self) ## Child window layout # Sizer composition: # # +-------------------------------------------------------+ # | <Mag> | <HFW> | <Scale> | [Icon|Slider|Icon] | # +-------------------------------------------------------+ slider_sizer = wx.BoxSizer(wx.HORIZONTAL) # TODO: need to have the icons updated according to the streams type slider_sizer.Add(self.bmp_slider_left, 0, border=3, flag=wx.ALIGN_CENTER | wx.RIGHT) slider_sizer.Add(self.merge_slider, 1, flag=wx.ALIGN_CENTER | wx.EXPAND) slider_sizer.Add(self.bmp_slider_right, 0, border=3, flag=wx.ALIGN_CENTER | wx.LEFT) control_sizer = wx.BoxSizer(wx.HORIZONTAL) control_sizer.Add(self.magnification_text, 2, border=10, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.EXPAND) control_sizer.Add(self.hfw_text, 2, border=10, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.EXPAND) control_sizer.Add(self.scale_win, 3, border=10, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.EXPAND) control_sizer.Add(self.zPos_text, 2, border=10, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.EXPAND) control_sizer.Add(slider_sizer, 0, border=10, flag=wx.ALIGN_CENTER | wx.RIGHT) # border_sizer is needed to add a border around the legend border_sizer = wx.BoxSizer(wx.VERTICAL) border_sizer.Add(control_sizer, border=6, flag=wx.ALL | wx.EXPAND) self.SetSizerAndFit(border_sizer) ## Event binding # Dragging the slider should set the focus to the right view self.merge_slider.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.merge_slider.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) # Make sure that mouse clicks on the icons set the correct focus self.bmp_slider_left.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.bmp_slider_right.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) # Set slider to min/max self.bmp_slider_left.Bind(wx.EVT_LEFT_UP, parent.OnSliderIconClick) self.bmp_slider_right.Bind(wx.EVT_LEFT_UP, parent.OnSliderIconClick) self.hfw_text.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.magnification_text.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.zPos_text.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
def __init__(self, parent, id_, title, style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX): """Creates a standalone window that is used for downloading updates for the editor. @param parent: Parent Window of the dialog @param title: Title of dialog """ wx.Frame.__init__(self, parent, id_, title, style=style) util.SetWindowIcon(self) #---- Attributes/Objects ----# self.LOG = wx.GetApp().GetLog() panel = wx.Panel(self) self._progress = UpdateProgress(panel, self.ID_PROGRESS_BAR) fname = self._progress.GetCurrFileName() floc = self._progress.GetDownloadLocation() dl_file = wx.StaticText(panel, label=_("Downloading: %s") % fname) dl_loc = wx.StaticText(panel, wx.ID_ANY, _("Downloading To: %s") % floc) self._cancel_bt = wx.Button(panel, wx.ID_CANCEL, _("Cancel")) self._timer = wx.Timer(self, id=self.ID_TIMER) self._proghist = list() #---- Layout ----# self.CreateStatusBar(2) self._sizer = wx.GridBagSizer() bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_WEB), wx.ART_TOOLBAR) mdc = wx.MemoryDC(bmp) tmp_bmp = wx.Image(ed_glob.CONFIG['SYSPIX_DIR'] + u"editra.png", wx.BITMAP_TYPE_PNG) tmp_bmp.Rescale(20, 20, wx.IMAGE_QUALITY_HIGH) mdc.DrawBitmap(tmp_bmp.ConvertToBitmap(), 11, 11) mdc.SelectObject(wx.NullBitmap) bmp = wx.StaticBitmap(panel, wx.ID_ANY, bmp) self._sizer.AddMany([(bmp, (1, 1), (3, 2)), (dl_file, (1, 4), (1, 4)), (dl_loc, (2, 4), (1, 4)), ((15, 15), (3, 5), (1, 1))]) self._sizer.Add(self._progress, (4, 1), (1, 10), wx.EXPAND) bsizer = wx.BoxSizer(wx.HORIZONTAL) bsizer.AddStretchSpacer() bsizer.Add(self._cancel_bt, 0, wx.ALIGN_CENTER_HORIZONTAL) bsizer.AddStretchSpacer() self._sizer.Add(bsizer, (6, 1), (1, 10), wx.EXPAND) self._sizer.Add((5, 5), (7, 1)) self._sizer.Add((5, 5), (7, 11)) panel.SetSizer(self._sizer) mwsz = wx.BoxSizer(wx.HORIZONTAL) mwsz.Add(panel, 1, wx.EXPAND) self.SetSizer(mwsz) self.SetInitialSize() self.SetStatusWidths([-1, 100]) self.SetStatusText(_("Downloading") + u"...", self.SB_INFO) #---- Bind Events ----# self.Bind(wx.EVT_BUTTON, self.OnButton) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_TIMER, self.OnUpdate, id=self.ID_TIMER)
def __init__( self, chipName, parseTagTime, parent, id = wx.ID_ANY, fileSuffix = 'txt' ): wx.Dialog.__init__( self, parent, id, u'{} {}'.format(chipName, _('Import')), style=wx.DEFAULT_DIALOG_STYLE|wx.TAB_TRAVERSAL ) self.chipName = chipName self.parseTagTime = parseTagTime self.fileSuffix = fileSuffix todoList = [ u'{} {}'.format(chipName, _('Import Data File')), u'', _('You must first "New" a race and fill in the details.'), _('You must also configure a "Tag" field in your Sign-On Excel Sheet and link the sheet to the race.'), _('This is required so CrossMgr can link the tags in the import file back to rider numbers and info.'), u'', _('Race Data:'), _('If the first chip read is NOT the start of the race, you will need to enter the start time manually.'), _('Otherwise the import will use the first chip read as the race start.'), u'', _('TimeTrial Data:'), _("The first chip read for each rider will be interpreted as the rider's start time."), u'', _('Warning: Importing from chip data could replace all the data in this race.'), _('Proceed with caution.'), ] intro = u'\n'.join(todoList) gs = wx.FlexGridSizer( rows=0, cols=3, vgap=10, hgap=5 ) gs.Add( wx.StaticText(self, label = u'{} {}:'.format(chipName, _('Data File'))), 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT ) self.chipDataFile = wx.TextCtrl( self, -1, '', size=(450,-1) ) defaultPath = Utils.getFileName() if not defaultPath: defaultPath = Utils.getDocumentsDir() else: defaultPath = os.path.join( os.path.split(defaultPath)[0], '' ) self.chipDataFile.SetValue( defaultPath ) gs.Add( self.chipDataFile, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.GROW) btn = wx.Button( self, label=_('Browse') + u'...' ) btn.Bind( wx.EVT_BUTTON, self.onBrowseChipReaderDataFile ) gs.Add( btn, 0, wx.ALIGN_CENTER_VERTICAL ) gs.AddSpacer(1) self.dataType = wx.StaticText( self, label = _("Data Is:") ) gs.Add( self.dataType, 1, wx.ALIGN_LEFT ) gs.AddSpacer(1) gs.Add( wx.StaticText(self, label = _('Data Policy:') ), 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT ) self.importPolicy = wx.Choice( self, choices = [ _('Clear All Existing Data Before Import'), _('Merge New Data with Existing') ] ) self.importPolicy.SetSelection( 0 ) gs.Add( self.importPolicy, 1, wx.ALIGN_LEFT ) gs.AddSpacer(1) gs.Add( wx.StaticText(self, label = _('Import Data Time Adjustment:') ), 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT ) self.timeAdjustment = HighPrecisionTimeEdit( self, size=(120,-1) ) self.behindAhead = wx.Choice( self, choices=[_('Behind'), _('Ahead')] ) if JChip.readerComputerTimeDiff: rtAdjust = JChip.readerComputerTimeDiff.total_seconds() if rtAdjust >= 0.0: self.behindAhead.SetSelection( 0 ) else: self.behindAhead.SetSelection( 1 ) rtAdjust *= -1.0 self.timeAdjustment.SetSeconds( rtAdjust ) else: self.behindAhead.SetSelection( 0 ) hb = wx.BoxSizer() hb.Add( self.behindAhead, flag=wx.ALIGN_BOTTOM|wx.BOTTOM, border=4 ) hb.Add( self.timeAdjustment, flag=wx.ALL, border=4 ) gs.Add( hb, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT ) gs.AddSpacer(1) self.manualStartTime = wx.CheckBox(self, label = _('Race Start Time (if NOT first recorded time):') ) self.Bind( wx.EVT_CHECKBOX, self.onChangeManualStartTime, self.manualStartTime ) gs.Add( self.manualStartTime, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT ) self.raceStartTime = masked.TimeCtrl( self, fmt24hr=True, value="10:00:00" ) self.raceStartTime.Enable( False ) gs.Add( self.raceStartTime, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT) gs.AddSpacer(1) with Model.LockRace() as race: isTimeTrial = getattr(race, 'isTimeTrial', False) if race else False if isTimeTrial: self.manualStartTime.Enable( False ) self.manualStartTime.Show( False ) self.raceStartTime.Enable( False ) self.raceStartTime.Show( False ) self.dataType.SetLabel( _('Data will be imported for a Time Trial') ) else: self.dataType.SetLabel( _('Data will be imported for a Race') ) self.okBtn = wx.Button( self, wx.ID_OK ) self.Bind( wx.EVT_BUTTON, self.onOK, self.okBtn ) self.cancelBtn = wx.Button( self, wx.ID_CANCEL ) self.Bind( wx.EVT_BUTTON, self.onCancel, self.cancelBtn ) bs = wx.BoxSizer( wx.VERTICAL ) border = 4 hs = wx.BoxSizer( wx.HORIZONTAL ) try: image = wx.Image( os.path.join(Utils.getImageFolder(), '{}Logo.png'.format(chipName)), wx.BITMAP_TYPE_PNG ) except Exception as e: image = wx.EmptyImage( 32, 32, True ) hs.Add( wx.StaticBitmap(self, wx.ID_ANY, image.ConvertToBitmap()), 0 ) hs.Add( wx.StaticText(self, label = intro), 1, wx.EXPAND|wx.LEFT, border*2 ) bs.Add( hs, 1, wx.EXPAND|wx.ALL, border ) #------------------------------------------------------------------- bs.AddSpacer( border ) bs.Add( gs, 0, wx.EXPAND | wx.ALL, border ) buttonBox = wx.BoxSizer( wx.HORIZONTAL ) buttonBox.AddStretchSpacer() buttonBox.Add( self.okBtn, flag = wx.RIGHT, border = border ) self.okBtn.SetDefault() buttonBox.Add( self.cancelBtn ) bs.Add( buttonBox, 0, wx.EXPAND | wx.ALL, border ) self.SetSizerAndFit(bs) bs.Fit( self ) self.CentreOnParent(wx.BOTH) wx.CallAfter( self.SetFocus )
def __init__(self, parent, net_init, intel_rec, app): wx.Panel.__init__(self, parent) print "你好" self.tm = Timer() self.app = app #self.init = NetInit() #self.intel_rec=IntelRec() self.retrival_params = self.app.get_retrivalParams() self.init = net_init self.intel_rec = intel_rec self.cap_num = self.app.get_cam_num() self.cap = self.app.get_cap() self.pair_infos = self.app.get_pair_info() # cfg.caffemodel, cfg.net, cfg.CLASSES = self.init.getarg self.mode = self.app.get_mode() self.dirname = '' self.auto_flag = self.app.get_auto() self.came_pic = cv2.imread('./interface/tmp/wx_alarm/clear.jpg') self.cam_flag = self.app.get_cam() #if self.cam_flag: # self.cap = cv2.VideoCapture(self.cap_num) self.get_flag = 0 self.info_flag = self.app.get_info() self.pair_flag = self.app.get_pair() #检测对象变化标志 self.object_count_flag = [1, 1, 1] #跳转标志位 self.object_change_flag = [1, 1, 1] #对象改变标志位 self.object_change_count = [0, 0, 0] #跳转后连续对象计数器 self.object_old = [-1, -1, -1] #过去对象 -1表示None self.object_per = [-1, -1, -1] #当前对象 -1表示None #多线程函数 self.threads = [] # create some sizers self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.hSizer = wx.BoxSizer(wx.HORIZONTAL) self.grid = wx.GridBagSizer(hgap=6, vgap=6) #====================================================== #First block # ====================================================== self.title1 = wx.StaticText(self, label="服装检测") self.grid.Add(self.title1, pos=(0, 0)) self.p1 = wx.GridBagSizer(hgap=6, vgap=6) self.grid.Add(self.p1, pos=(0, 1)) self.p2 = wx.Panel(self, -1, size=(500, 800)) self.p1.Add(self.p2, pos=(1, 0)) #self.p2.Bind(wx.EVT_LEFT_UP,self.Info_demo) # ====================================================== #Second block # ====================================================== self.title2 = wx.StaticText(self, label="检测结果") self.grid.Add(self.title2, pos=(0, 2)) self.p = wx.GridBagSizer(hgap=3, vgap=1) self.grid.Add(self.p, pos=(0, 3)) self.p_sec1 = wx.GridBagSizer(hgap=6, vgap=6) self.p.Add(self.p_sec1, pos=(0, 0)) #self.p3 = wx.Panel(self, -1, size=(180,240)) #self.p.Add(self.p3, pos=(0, 0)) self.logger1 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec1.Add(self.logger1, pos=(0, 0)) self.pic1 = wx.Panel(self, -1, size=(180, 240)) self.p_sec1.Add(self.pic1, pos=(1, 0)) self.info1 = wx.TextCtrl(self, size=(380, 240), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec1.Add(self.info1, pos=(1, 1)) self.p_sec2 = wx.GridBagSizer(hgap=6, vgap=6) self.p.Add(self.p_sec2, pos=(1, 0)) self.logger2 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec2.Add(self.logger2, pos=(0, 0)) self.pic2 = wx.Panel(self, -1, size=(180, 240)) self.p_sec2.Add(self.pic2, pos=(1, 0)) self.info2 = wx.TextCtrl(self, size=(380, 240), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec2.Add(self.info2, pos=(1, 1)) self.p_sec3 = wx.GridBagSizer(hgap=6, vgap=6) self.p.Add(self.p_sec3, pos=(2, 0)) self.logger3 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec3.Add(self.logger3, pos=(0, 0)) self.pic3 = wx.Panel(self, -1, size=(180, 240)) self.p_sec3.Add(self.pic3, pos=(1, 0)) self.info3 = wx.TextCtrl(self, size=(380, 240), style=wx.TE_MULTILINE | wx.TE_READONLY) self.p_sec3.Add(self.info3, pos=(1, 1)) # ====================================================== #Third block # ====================================================== self.title3 = wx.StaticText(self, label="服装推荐") self.grid.Add(self.title3, pos=(0, 4)) self.pr = wx.GridBagSizer(hgap=6, vgap=6) self.grid.Add(self.pr, pos=(0, 5)) #-----------------------1----------------------------------------------------- self.logger4 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger4, pos=(0, 0)) self.logger5 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger5, pos=(0, 1)) self.logger6 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger6, pos=(0, 2)) self.pic10 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic10, pos=(1, 0)) self.pic11 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic11, pos=(1, 1)) self.pic12 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic12, pos=(1, 2)) #----------------------2------------------------------------------------------- self.logger7 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger7, pos=(2, 0)) self.logger8 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger8, pos=(2, 1)) self.logger9 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger9, pos=(2, 2)) self.pic13 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic13, pos=(3, 0)) self.pic14 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic14, pos=(3, 1)) self.pic15 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic15, pos=(3, 2)) #---------------------3---------------------------------------------------------------------- self.logger10 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger10, pos=(4, 0)) self.logger11 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger11, pos=(4, 1)) self.logger12 = wx.TextCtrl(self, size=(180, 25), style=wx.TE_MULTILINE | wx.TE_READONLY) self.pr.Add(self.logger12, pos=(4, 2)) self.pic16 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic16, pos=(5, 0)) self.pic17 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic17, pos=(5, 1)) self.pic18 = wx.Panel(self, -1, size=(180, 240)) self.pr.Add(self.pic18, pos=(5, 2)) # ===================================Button========================================================= self.pb = wx.GridBagSizer(hgap=6, vgap=6) self.grid.Add(self.pb, pos=(2, 1)) self.button1 = wx.Button(self, label="手动检测") self.Bind(wx.EVT_BUTTON, self.OpenImg, self.button1) self.pb.Add(self.button1, pos=(0, 0)) # self.button1_info = wx.StaticText(self, label="(Open from Floder)") # self.grid.Add(self.button1_info, pos=(1, 0)) self.button2 = wx.Button(self, label="捕获检测") self.Bind(wx.EVT_BUTTON, self.RecoImg, self.button2) self.pb.Add(self.button2, pos=(1, 0)) self.button3 = wx.Button(self, label="开启摄像头") self.Bind(wx.EVT_BUTTON, self.OpenCam, self.button3) self.pb.Add(self.button3, pos=(0, 1)) self.button4 = wx.Button(self, label="自动检测") self.Bind(wx.EVT_BUTTON, self.AutoPic, self.button4) self.pb.Add(self.button4, pos=(1, 1)) self.button5 = wx.Button(self, label="在线检索") self.Bind(wx.EVT_BUTTON, self.Mode, self.button5) self.pb.Add(self.button5, pos=(0, 2)) self.button6 = wx.Button(self, label="模式转换") self.Bind(wx.EVT_BUTTON, self.Info, self.button6) self.pb.Add(self.button6, pos=(1, 2)) self.button7 = wx.Button(self, label="服装搭配") self.Bind(wx.EVT_BUTTON, self.Pair, self.button7) self.pb.Add(self.button7, pos=(0, 3)) self.button8 = wx.Button(self, label="属性筛选") self.Bind(wx.EVT_BUTTON, self.ClothRetrival, self.button8) self.pb.Add(self.button8, pos=(1, 3)) self.font1 = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD) self.font2 = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL) if self.cam_flag: self.button3.SetFont(self.font1) print "font1" else: self.button3.SetFont(self.font2) print "font2" if self.auto_flag: self.button4.SetFont(self.font1) print "font1" else: self.button4.SetFont(self.font2) print "font2" if self.mode: self.button5.SetFont(self.font1) print "font1" else: self.button5.SetFont(self.font2) print "font2" if self.pair_flag: self.button7.SetFont(self.font1) print "font1" else: self.button7.SetFont(self.font2) print "font2" self.Bind(wx.EVT_IDLE, self.AutoGet) #self.Bind(wx.EVT_IDLE, self.AutoDec) self.hSizer.Add(self.grid, 0, wx.ALL, 5) # hSizer.Add(self.logger) self.mainSizer.Add(self.hSizer, 0, wx.ALL, 5) # mainSizer.Add(self.button, 0, wx.LEFT) self.SetSizerAndFit(self.mainSizer) img = wx.Image(Path_tmp_alarm + 'start1.jpg', wx.BITMAP_TYPE_ANY).Scale(500, 800) self.sb = wx.StaticBitmap(self.p2, -1, wx.Bitmap(img), size=(500, 800)) #sb = wx.Bitmap #初始化界面 for i in range(1, 19): if i < 4 or i > 9: img = wx.Image( Path_tmp_alarm + 'clear' + str((i) % 7 + 1) + '.jpg', wx.BITMAP_TYPE_ANY).Scale(180, 240) sb = wx.StaticBitmap(eval('self.pic' + str(i)), -1, wx.Bitmap(img), size=(180, 240)) if i <= 12: eval('self.logger' + str(i)).Clear() eval('self.logger' + str(i)).AppendText("%s" % 'None') if i <= 3: eval('self.info' + str(i)).Clear()
def __init__(self, parent, gui_size, cfg): """Constructor""" wx.Panel.__init__(self, parent=parent) # variable initialization self.filelist = [] self.config = cfg self.bodyparts = [] self.draw = False self.slow = False # design the panel self.sizer = wx.GridBagSizer(5, 5) text = wx.StaticText(self, label="DeepLabCut - Create Labeled Videos") self.sizer.Add(text, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15) # Add logo of DLC icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(LOGO_PATH)) self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line1 = wx.StaticLine(self) self.sizer.Add(line1, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10) self.cfg_text = wx.StaticText(self, label="Select the config file") self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP | wx.LEFT, border=5) if sys.platform == "darwin": self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="*.yaml", ) else: self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="config.yaml", ) self.sizer.Add(self.sel_config, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) self.sel_config.SetPath(self.config) self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config) self.vids = wx.StaticText(self, label="Choose the videos") self.sizer.Add(self.vids, pos=(3, 0), flag=wx.TOP | wx.LEFT, border=10) self.sel_vids = wx.Button(self, label="Select videos") self.sizer.Add(self.sel_vids, pos=(3, 1), flag=wx.TOP | wx.EXPAND, border=10) self.sel_vids.Bind(wx.EVT_BUTTON, self.select_videos) sb = wx.StaticBox(self, label="Additional Attributes") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox4 = wx.BoxSizer(wx.HORIZONTAL) videotype_text = wx.StaticBox(self, label="Specify the videotype") videotype_text_boxsizer = wx.StaticBoxSizer(videotype_text, wx.VERTICAL) self.videotype = wx.ComboBox(self, choices=("", ) + SUPPORTED_VIDEOS, style=wx.CB_READONLY) self.videotype.SetValue("") videotype_text_boxsizer.Add(self.videotype, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 1) shuffle_text = wx.StaticBox(self, label="Specify the shuffle") shuffle_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL) self.shuffle = wx.SpinCtrl(self, value="1", min=0, max=100) shuffle_boxsizer.Add(self.shuffle, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 1) hbox1.Add(videotype_text_boxsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox1.Add(shuffle_boxsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.sizer.Add( boxsizer, pos=(4, 0), span=(1, 5), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=5, ) self.cfg = auxiliaryfunctions.read_config(self.config) if self.cfg.get("multianimalproject", False): self.plot_idv = wx.RadioBox( self, label="Create video with animal ID colored?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.plot_idv.SetSelection(1) hbox3.Add(self.plot_idv, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) self.draw_skeleton = wx.RadioBox( self, label="Include the skeleton in the video?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.draw_skeleton.Bind(wx.EVT_RADIOBOX, self.choose_draw_skeleton_options) self.draw_skeleton.SetSelection(1) self.filter = wx.RadioBox( self, label="Use filtered predictions?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.filter.SetSelection(1) self.video_slow = wx.RadioBox( self, label="Create a higher quality video? (slow)", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.video_slow.Bind(wx.EVT_RADIOBOX, self.choose_video_slow_options) self.video_slow.SetSelection(1) self.trail_points_text = wx.StaticBox( self, label="Specify the number of trail points") trail_pointsboxsizer = wx.StaticBoxSizer(self.trail_points_text, wx.VERTICAL) self.trail_points = wx.SpinCtrl(self, value="0") trail_pointsboxsizer.Add(self.trail_points, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) self.bodypart_choice = wx.RadioBox( self, label="Plot all bodyparts?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.bodypart_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption) config_file = auxiliaryfunctions.read_config(self.config) if config_file.get("multianimalproject", False): bodyparts = config_file["multianimalbodyparts"] else: bodyparts = config_file["bodyparts"] self.bodyparts_to_compare = wx.CheckListBox( self, choices=bodyparts, style=0, name="Select the bodyparts") self.bodyparts_to_compare.Bind(wx.EVT_CHECKLISTBOX, self.getbp) self.bodyparts_to_compare.Hide() hbox2.Add(self.draw_skeleton, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox2.Add(trail_pointsboxsizer, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox2.Add(self.video_slow, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) boxsizer.Add(hbox2, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox3.Add(self.filter, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox4.Add(self.bodypart_choice, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) hbox4.Add(self.bodyparts_to_compare, 3, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) if self.cfg.get("multianimalproject", False): self.trajectory = wx.RadioBox( self, label="Want to plot the trajectories?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.trackerType = wx.RadioBox( self, label="Which tracker to use?", choices=["Default", "Transformer"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) hbox4.Add(self.trajectory, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox4.Add(self.trackerType, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(hbox3, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) boxsizer.Add(hbox4, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.build = wx.Button(self, label="Build skeleton") self.sizer.Add(self.build, pos=(5, 3), flag=wx.BOTTOM | wx.RIGHT, border=10) self.build.Bind(wx.EVT_BUTTON, self.build_skeleton) self.build.Enable(True) self.help_button = wx.Button(self, label="Help") self.sizer.Add(self.help_button, pos=(5, 0), flag=wx.LEFT, border=10) self.help_button.Bind(wx.EVT_BUTTON, self.help_function) self.ok = wx.Button(self, label="RUN") self.sizer.Add(self.ok, pos=(5, 4)) self.ok.Bind(wx.EVT_BUTTON, self.create_videos) self.reset = wx.Button(self, label="Reset") self.sizer.Add(self.reset, pos=(5, 1), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) self.reset.Bind(wx.EVT_BUTTON, self.reset_create_videos) self.sizer.AddGrowableCol(3) self.SetSizer(self.sizer) self.sizer.Fit(self)