我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用wx.StaticBox()。
def addCheckBoxes(self): # Regular Box Sizer boxSizerH = wx.BoxSizer(wx.HORIZONTAL) chk1 = wx.CheckBox(self.panel, label='Disabled') chk1.SetValue(True) chk1.Disable() boxSizerH.Add(chk1) chk2 = wx.CheckBox(self.panel, label='UnChecked') boxSizerH.Add(chk2, flag=wx.LEFT, border=10) chk3 = wx.CheckBox(self.panel, label='Toggle') boxSizerH.Add(chk3, flag=wx.LEFT, border=10) chk3.SetValue(True) # Add Regular Box Sizer to StaticBox sizer self.statBoxSizerV.Add(boxSizerH, flag=wx.LEFT, border=10) self.statBoxSizerV.Add((0, 8)) #----------------------------------------------------------
def __init__(self, parent): """Constructor""" self.notUseDetaul = None wx.Panel.__init__(self, parent=parent, size = (500,800)) B = wx.StaticBox(self, -1) BSizer = wx.StaticBoxSizer(B, wx.VERTICAL) self.imagesDir = os.path.join(".", "images") self.screenShotDir = os.path.join(".", "screenShot") self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage) self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll) self.statusBar = wx.StaticText(self, -1, "") BSizer.Add(self.statusBar) BSizer.Add(self.screenShot,5,wx.EXPAND, 5) self.SetSizer(BSizer) pub.subscribe(self.updateStatus, "update") pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode") pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput") self.hasDrew = False
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) B = wx.StaticBox(self, -1) self.BSizer = wx.StaticBoxSizer(B, wx.VERTICAL) self.tree = XMLTree(parent=self, ID=-1) self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.onSelectItem) self.tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.getFullXpath) self.BSizer.Add(self.tree, 5, wx.EXPAND, 5) self.SetSizer(self.BSizer) cDir = os.getcwd() self.xmlPath = os.path.join(cDir,"Hierarchy","window_dump.xml") pub.subscribe(self.updateTree, "updateTree") pub.subscribe(self.setSelectedNode, "setSelectedNode") pub.subscribe(self.DoSearch, "DoSearch")
def __init__(self, *args, **kwds): self.settings = kwds['settings'] del kwds['settings'] # begin wxGlade: TerminalSettingsDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.checkbox_echo = wx.CheckBox(self, -1, "Local Echo") self.checkbox_unprintable = wx.CheckBox(self, -1, "Show unprintable characters") self.radio_box_newline = wx.RadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.sizer_4_staticbox = wx.StaticBox(self, -1, "Input/Output") self.button_ok = wx.Button(self, wx.ID_OK, "") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade self.__attach_events() self.checkbox_echo.SetValue(self.settings.echo) self.checkbox_unprintable.SetValue(self.settings.unprintable) self.radio_box_newline.SetSelection(self.settings.newline)
def __init__(self, parent, frame, ID, label): wx.Panel.__init__(self, parent, ID) self.frame = frame box = wx.StaticBox(self, -1, label) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.next_button = wx.Button(self, -1, label="Next 100") self.next_button.Bind(wx.EVT_BUTTON, self.on_next) self.previous_button = wx.Button(self, -1, label="Previous 100") self.previous_button.Bind(wx.EVT_BUTTON, self.on_previous) manual_box = wx.BoxSizer(wx.HORIZONTAL) manual_box.Add(self.previous_button, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.AddSpacer(10) manual_box.Add(self.next_button, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def createWidgetsFrame(self): staticBox = wx.StaticBox( self.panel, -1, "Widgets Frame", size=(285, -1) ) self.statBoxSizerV = wx.StaticBoxSizer(staticBox, wx.VERTICAL) #----------------------------------------------------------
def createManageFilesFrame(self): staticBox = wx.StaticBox( self.panel, -1, "Manage Files", size=(285, -1) ) self.statBoxSizerMgrV = wx.StaticBoxSizer(staticBox, wx.VERTICAL) #----------------------------------------------------------
def addStaticBoxWithLabels(self): boxSizerH = wx.BoxSizer(wx.HORIZONTAL) staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" ) staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL ) boxSizerV = wx.BoxSizer( wx.VERTICAL ) staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" ) boxSizerV.Add( staticText1, 0, wx.ALL) staticText2 = wx.StaticText( self.panel, -1, " Label 2") boxSizerV.Add( staticText2, 0, wx.ALL ) #------------------------------------------------------ staticBoxSizerV.Add( boxSizerV, 0, wx.ALL ) boxSizerH.Add(staticBoxSizerV) #------------------------------------------------------ boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1))) #------------------------------------------------------ boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED)) # Add local boxSizer to main frame self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL ) #----------------------------------------------------------
def __init__(self, parent, run, api): """Initialize the RunPanel. Args: parent: The parent Window for this panel. run: The sequencing run that should be displayed. api: An initialized instance of an API for interacting with IRIDA. """ ScrolledPanel.__init__(self, parent, style=wx.SUNKEN_BORDER) box = wx.StaticBox(self, label=run.sample_sheet_name) self._timer = wx.Timer(self) self._run = run self._progress_value = 0 self._last_progress = 0 self._last_timer_progress = 0 self._sample_panels = {} # the current overall progress for the run is calculated as a percentage # of the total file size of all samples in the run. self._progress_max = sum(sample.get_files_size() for sample in run.samples_to_upload) logging.info("Total file size for run is {}".format(self._progress_max)) self._sizer = wx.StaticBoxSizer(box, wx.VERTICAL) pub.subscribe(self._upload_started, run.upload_started_topic) pub.subscribe(self._handle_progress, run.upload_progress_topic) pub.subscribe(self._upload_complete, run.upload_completed_topic) pub.subscribe(self._upload_failed, run.upload_failed_topic) for sample in run.sample_list: self._sample_panels[sample.get_id()] = SamplePanel(self, sample, run, api) self._sizer.Add(self._sample_panels[sample.get_id()], flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) self.SetSizer(self._sizer) self.Bind(wx.EVT_TIMER, self._update_progress_timer, self._timer) self.Layout() self.SetupScrolling()
def __init__(self, parent, label='', orient=wx.VERTICAL): wx.StaticBoxSizer.__init__(self, wx.StaticBox(parent, label=label), orient=orient)
def __init__(self, *args, **kwds): # begin wxGlade: Dialogo_texto.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.salida_texto = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.bnt_salida_ok = wx.Button(self, wx.ID_OK, "OK", style=wx.BU_BOTTOM) self.sizer_1_staticbox = wx.StaticBox(self, wx.ID_ANY, "Information") self.__set_properties() self.__do_layout() # end wxGlade
def MakeRange(self, i, inc=1.0): if len(self.parent.datarangelist) < (i+1): min = self.scalebar_ranges[i][0] max = self.scalebar_ranges[i][1] self.parent.datarangelist.append( [min, max] ) current_min = min current_max = max else: min = self.parent.datarangelist[i][0] max = self.parent.datarangelist[i][1] current_min = self.scalebar_ranges[i][0] current_max = self.scalebar_ranges[i][1] label= "Range %d"%((i+1)) range = abs(max - min) if range > MAX_INT: newinc = range/MAX_INT else: newinc = inc self.sbox.append( wx.StaticBox(self, label=label, style=wx.SUNKEN_BORDER) ) self.sboxs.append( wx.StaticBoxSizer(self.sbox[-1],wx.VERTICAL) ) self.shbox.append( wx.BoxSizer(wx.HORIZONTAL) ) self.valuemax.append( SpinnerObject(self,"Max:",max,min,newinc,current_max,50,150) ) self.shbox[-1].Add(self.valuemax[-1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.shbox[-1].Add((5, -1)) self.valuemin.append( SpinnerObject(self,"Min:",max,min,newinc,current_min,50,150) ) self.shbox[-1].Add(self.valuemin[-1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.sboxs[-1].Add(self.shbox[-1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.vbox.Add(self.sboxs[-1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) self.gd = GD.Grid(self) self.gd.CreateGrid(20, 2) self.gd.SetRowLabelSize(0) self.gd.SetColLabelSize(0) self.B = wx.StaticBox(self, -1, "Node Detail") BSizer = wx.StaticBoxSizer(self.B, wx.VERTICAL) BSizer.Add(self.gd, 1, wx.EXPAND|wx.ALL) self.SetSizer(BSizer) pub.subscribe(self.updateNodeDetail, "updateNodeDetail") pub.subscribe(self.updateXPath, "updateXPath") self.Bind(wx.EVT_SIZE, self.ResizeGrid)
def __init__(self, *args, **kwds): # grab the serial keyword and remove it from the dict self.serial = kwds['serial'] del kwds['serial'] self.show = SHOW_ALL if 'show' in kwds: self.show = kwds.pop('show') # begin wxGlade: SerialConfigDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_2 = wx.StaticText(self, -1, "Port") self.choice_port = wx.Choice(self, -1, choices=[]) self.label_1 = wx.StaticText(self, -1, "Baudrate") self.combo_box_baudrate = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.sizer_1_staticbox = wx.StaticBox(self, -1, "Basics") self.panel_format = wx.Panel(self, -1) self.label_3 = wx.StaticText(self.panel_format, -1, "Data Bits") self.choice_databits = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.label_4 = wx.StaticText(self.panel_format, -1, "Stop Bits") self.choice_stopbits = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.label_5 = wx.StaticText(self.panel_format, -1, "Parity") self.choice_parity = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.sizer_format_staticbox = wx.StaticBox(self.panel_format, -1, "Data Format") self.panel_timeout = wx.Panel(self, -1) self.checkbox_timeout = wx.CheckBox(self.panel_timeout, -1, "Use Timeout") self.text_ctrl_timeout = wx.TextCtrl(self.panel_timeout, -1, "") self.label_6 = wx.StaticText(self.panel_timeout, -1, "seconds") self.sizer_timeout_staticbox = wx.StaticBox(self.panel_timeout, -1, "Timeout") self.panel_flow = wx.Panel(self, -1) self.checkbox_rtscts = wx.CheckBox(self.panel_flow, -1, "RTS/CTS") self.checkbox_xonxoff = wx.CheckBox(self.panel_flow, -1, "Xon/Xoff") self.sizer_flow_staticbox = wx.StaticBox(self.panel_flow, -1, "Flow Control") self.button_ok = wx.Button(self, wx.ID_OK, "") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade # attach the event handlers self.__attach_events()
def __init__(self, parent, ID): wx.Panel.__init__(self, parent, ID) box = wx.StaticBox(self, -1, "relabelling key") sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.real = wx.StaticText(self, label="REAL") self.real.SetBackgroundColour(wx.WHITE) self.real.SetForegroundColour("#3366FF") self.bogus = wx.StaticText(self, label="BOGUS") self.bogus.SetBackgroundColour(wx.WHITE) self.bogus.SetForegroundColour("#FF0066") self.ghost = wx.StaticText(self, label="GHOST") self.ghost.SetBackgroundColour(wx.WHITE) self.ghost.SetForegroundColour("#9933FF") manual_box = wx.BoxSizer(wx.HORIZONTAL) manual_box.Add(self.real, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.bogus, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.ghost, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, frame, ID): wx.Panel.__init__(self, parent, ID) self.frame = frame box = wx.StaticBox(self, -1, "data set control") sizer = wx.StaticBoxSizer(box, wx.VERTICAL) """ self.fp_button = wx.Button(self, -1, label="FP") self.fp_button.Bind(wx.EVT_BUTTON, self.on_fp) self.tp_button = wx.Button(self, -1, label="TP") self.tp_button.Bind(wx.EVT_BUTTON, self.on_tp) self.fn_button = wx.Button(self, -1, label="FN") self.fn_button.Bind(wx.EVT_BUTTON, self.on_fn) self.tn_button = wx.Button(self, -1, label="TN") self.tn_button.Bind(wx.EVT_BUTTON, self.on_tn) """ self.real_button = wx.Button(self, -1, label="Real") self.real_button.Bind(wx.EVT_BUTTON, self.on_real) self.bogus_button = wx.Button(self, -1, label="Bogus") self.bogus_button.Bind(wx.EVT_BUTTON, self.on_bogus) manual_box = wx.BoxSizer(wx.HORIZONTAL) """ manual_box.Add(self.tp_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.fp_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.tn_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.fn_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) """ manual_box.Add(self.real_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) manual_box.Add(self.bogus_button, border=2, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(manual_box, 0, wx.ALL, 10) self.SetSizer(sizer) sizer.Fit(self)
def create_preorder(self): self.w = wx.StaticBox(self.get_parent(), self.id, self.label, self.pos, self.size, self.style, self.name) self.sized = wx.StaticBoxSizer(self.w, self.orient)
def CreateContainer(self, container_type_name, *args, **kwargs): try: if container_type_name == 'BoxSizer': container_class = BoxSizerContainer elif container_type_name == 'GridSizer': container_class = GridSizerContainer elif container_type_name == 'FlexGridSizer': container_class = FlexGridSizerContainer elif container_type_name == 'GridBagSizer': container_class = GridBagSizerContainer elif container_type_name == 'StaticBox': container_class = StaticBoxContainer elif container_type_name == 'WarpSizer': container_class = WarpSizerContainer else: raise Exception('Unregistered container.') #print 'CreateContainer:', container_class, args, kwargs if not args: #print 'self.mainpanel:', self.mainpanel parent = self.mainpanel else: parent = args[0] container = container_class(parent, **kwargs) #print 'CreateContainer fim' return container except: raise
def __init__(self, *args, **kwargs): sbkw, kwargs = pop_registers(static_box_keys, kwargs) wx.StaticBox.__init__(self, args[0], **sbkw) if kwargs.get('orient') is None: orient = wx.VERTICAL else: orient = kwargs.pop('orient') self._sizer = wx.StaticBoxSizer(self, orient)
def create_well_choice(self): sb_well = wx.StaticBox(self, label=u"Poço:") sbs_well = wx.StaticBoxSizer(sb_well, wx.VERTICAL) self.well_choice = wx.Choice(self) self.well_choice.Bind(wx.EVT_CHOICE, self.on_well_input) sbs_well.Add(self.well_choice, proportion=1, flag=wx.EXPAND) self.sizer.Add(sbs_well) self.selected_well = None
def create_logs_choices(self, labels): sb = wx.StaticBox(self, label=u"Perfis:") sbs = wx.StaticBoxSizer(sb, wx.VERTICAL) fgs = wx.FlexGridSizer(len(labels), 2, 4, 4) self.choices = [] for label in labels: st = wx.StaticText(self, label=label + ": ") choice = wx.Choice(self) fgs.Add(st) fgs.Add(choice) self.choices.append(choice) sbs.Add(fgs, proportion=1, flag=wx.EXPAND) self.sizer.Add(sbs)
def __init__(self, parent=None, default_user="", default_pass=""): wx.Panel.__init__(self, parent) border = wx.StaticBox(self, label="User authorization") sizer = wx.StaticBoxSizer(border, wx.VERTICAL) self._status_label_user = ProcessingPlaceholderText(self) self._status_label_pass = ProcessingPlaceholderText(self) username_sizer = wx.BoxSizer(wx.VERTICAL) username_label = wx.StaticText(self, label="Username") username_label.SetToolTipString("Your IRIDA username") username_sizer.Add(username_label, flag=wx.EXPAND | wx.BOTTOM, border=2) username_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._username = wx.TextCtrl(self) self._username.Bind(wx.EVT_KILL_FOCUS, self._username_changed) self._username.SetValue(default_user) username_input_sizer.Add(self._username, flag=wx.EXPAND, proportion=1) username_input_sizer.Add(self._status_label_user, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) username_sizer.Add(username_input_sizer, flag=wx.EXPAND) sizer.Add(username_sizer, flag=wx.EXPAND | wx.ALL, border=5) password_sizer = wx.BoxSizer(wx.VERTICAL) password_label = wx.StaticText(self, label="Password") password_label.SetToolTipString("Your IRIDA password") password_sizer.Add(password_label, flag=wx.EXPAND | wx.BOTTOM, border=2) password_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._password = wx.TextCtrl(self, style=wx.TE_PASSWORD) self._password.Bind(wx.EVT_KILL_FOCUS, self._password_changed) self._password.SetValue(default_pass) password_input_sizer.Add(self._password, flag=wx.EXPAND, proportion=1) password_input_sizer.Add(self._status_label_pass, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) password_sizer.Add(password_input_sizer, flag=wx.EXPAND) sizer.Add(password_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(sizer) self.Layout() pub.subscribe(self._handle_connection_error, APIConnectorTopics.connection_error_user_credentials_topic) pub.subscribe(self._status_label_user.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._status_label_pass.SetSuccess, APIConnectorTopics.connection_success_topic) self.Bind(wx.EVT_CLOSE, self._on_close)
def __init__(self, parent=None, default_client_id="", default_client_secret=""): wx.Panel.__init__(self, parent) border = wx.StaticBox(self, label="Client authorization") sizer = wx.StaticBoxSizer(border, wx.VERTICAL) self._client_id_status_label = ProcessingPlaceholderText(self) self._client_secret_status_label = ProcessingPlaceholderText(self) client_id_sizer = wx.BoxSizer(wx.VERTICAL) client_id_label = wx.StaticText(self, label="Client ID") client_id_label.SetToolTipString("Your IRIDA client ID") client_id_sizer.Add(client_id_label, flag=wx.EXPAND | wx.BOTTOM, border=2) client_id_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._client_id = wx.TextCtrl(self) self._client_id.Bind(wx.EVT_KILL_FOCUS, self._client_id_changed) self._client_id.SetValue(default_client_id) client_id_input_sizer.Add(self._client_id, flag=wx.EXPAND, proportion=1) client_id_input_sizer.Add(self._client_id_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) client_id_sizer.Add(client_id_input_sizer, flag=wx.EXPAND) sizer.Add(client_id_sizer, flag=wx.EXPAND | wx.ALL, border=5) client_secret_sizer = wx.BoxSizer(wx.VERTICAL) client_secret_label = wx.StaticText(self, label="Client Secret") client_secret_label.SetToolTipString("Your IRIDA client secret") client_secret_sizer.Add(client_secret_label, flag=wx.EXPAND | wx.BOTTOM, border=2) client_secret_input_sizer = wx.BoxSizer(wx.HORIZONTAL) self._client_secret = wx.TextCtrl(self) self._client_secret.Bind(wx.EVT_KILL_FOCUS, self._client_secret_changed) self._client_secret.SetValue(default_client_secret) client_secret_input_sizer.Add(self._client_secret, flag=wx.EXPAND, proportion=1) client_secret_input_sizer.Add(self._client_secret_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) client_secret_sizer.Add(client_secret_input_sizer, flag=wx.EXPAND) sizer.Add(client_secret_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(sizer) self.Layout() pub.subscribe(self._client_id_status_label.SetError, APIConnectorTopics.connection_error_client_id_topic) pub.subscribe(self._client_secret_status_label.SetError, APIConnectorTopics.connection_error_client_secret_topic) pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_id) pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_secret) self.Bind(wx.EVT_CLOSE, self._on_close)
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Replace Voxels in Numpy Array") title.SetToolTipNew("Useful for viewing data with a cut-out section.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) title2 = wx.StaticText(self, label="Start dimensions:") vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.sdims=[{} for i in range(3)] self.sdims[0] = SpinnerObject(self,"i",MAX_INT_16,0,1,0,20,60) self.sdims[1] = SpinnerObject(self,"j",MAX_INT_16,0,1,0,20,60) self.sdims[2] = SpinnerObject(self,"k",MAX_INT_16,0,1,0,20,60) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.sdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.sdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.sdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) title3 = wx.StaticText(self, label="End dimensions:") vbox.Add(title3 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.edims=[{} for i in range(3)] self.edims[0] = SpinnerObject(self,"i",MAX_INT_16,0,1,0,20,60) self.edims[1] = SpinnerObject(self,"j",MAX_INT_16,0,1,0,20,60) self.edims[2] = SpinnerObject(self,"k",MAX_INT_16,0,1,0,20,60) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(self.edims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox1.Add(self.edims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox1.Add(self.edims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox1, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) sbox1 = wx.StaticBox(self, label="Complex Value", style=wx.SUNKEN_BORDER) sboxs1 = wx.StaticBoxSizer(sbox1,wx.VERTICAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.real = SpinnerObject(self,"Real:",MAX_INT_16,MIN_INT_16,0.1,1.0,50,150) hbox2.Add(self.real, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) hbox2.Add((5, -1)) self.imag = SpinnerObject(self,"Imag:",MAX_INT_16,MIN_INT_16,0.1,0.0,50,150) hbox2.Add(self.imag, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) sboxs1.Add(hbox2, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add(sboxs1, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self,parent,ancestor): from math import pi self.ancestor = ancestor wx.ScrolledWindow.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="View Support array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.support = TextPanelObject(self, "Support: ", "",100,'*.npy') vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Data array: ", "",100,'*.npy') vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.sbox1 = wx.StaticBox(self, label="Isosurface", style=wx.BORDER_DEFAULT) self.sboxs1 = wx.StaticBoxSizer(self.sbox1,wx.VERTICAL) self.hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.contour_support = SpinnerObject(self,"Support:",1.0,0.0,0.1,0.5,100,100) self.hbox1.Add(self.contour_support,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.hbox1.Add((20, -1)) self.opacity = SpinnerObject(self,"Opacity:",1.0,0.0,0.1,0.5,130,100) self.hbox1.Add(self.opacity,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.sboxs1.Add(self.hbox1,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.contour = SpinnerObject(self,"Data:",MAX_INT,MIN_INT,1,100,100,100) self.hbox2.Add(self.contour,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.hbox2.Add((20, -1)) self.feature_angle = SpinnerObject(self,"Feature Angle:",180,0,1,90,130,100) self.hbox2.Add(self.feature_angle,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.sboxs1.Add(self.hbox2,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.sboxs1.Add((-1, 5)) vbox.Add(self.sboxs1,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.hbox6 = wx.BoxSizer(wx.HORIZONTAL) self.chkbox_axes = wx.CheckBox(self, -1, 'View axes', size=(200, 20)) self.chkbox_axes.SetValue(False) self.hbox6.Add(self.chkbox_axes, 1,flag=wx.EXPAND|wx.LEFT|wx.RIGHT, border=2) self.hbox6.Add((-1, 5)) self.axes_fontfactor = SpinnerObject(self,"Font Factor:",MAX_INT,1,1,2,100,100) self.hbox6.Add(self.axes_fontfactor, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT, border=2) vbox.Add(self.hbox6, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, border=2) vbox.Add((-1, 5)) button_view = wx.Button(self, label="View", size=(70, 30)) button_view.Bind(wx.EVT_BUTTON, self.SeqParser ) vbox.Add(button_view,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox ) self.FitInside() self.SetScrollRate(5, 5)
def InitUI(self): self.panel = wx.Panel(self, wx.ID_ANY) # Info Text infotext = _(u'Close all open Applications, it is possible that programs will be closed without a warning ' u'and system could reboot without further confirmation.') infobox = wx.StaticBox(self.panel, -1, _(u'Attention')) infoboxbsizer = wx.StaticBoxSizer(infobox, wx.VERTICAL) info = wx.StaticText(self.panel, label=infotext) info.Wrap(380) infoboxbsizer.Add(info, 0) self.gauge = wx.Gauge(self.panel, size=(24, 26)) self.update_label = wx.StaticText(self.panel, label=_(u'Current Progress:')) self.update_box = wx.TextCtrl(self.panel, style=wx.TE_READONLY) self.update_box.SetBackgroundColour(wx.WHITE) self.chk_shutdown = wx.CheckBox(self.panel, size=(160,20), label=_(u"Shutdown after update")) self.logButton = wx.Button(self.panel, size=(54,26), label="LOG") self.logButton.SetToolTip(wx.ToolTip(_(u'Open WPKG Log'))) self.logButton.SetBitmap(img.get('log')) self.startButton = wx.Button(self.panel, label=_(u"Update")) self.abortButton = wx.Button(self.panel, label=_(u"Cancel")) self.logButton.Disable() self.abortButton.Disable() self.line = wx.StaticLine(self.panel, -1, size=(2,2), style=wx.LI_HORIZONTAL) self.startButton.Bind(wx.EVT_BUTTON, self.OnStartButton) self.abortButton.Bind(wx.EVT_BUTTON, self.OnAbortButton) self.logButton.Bind(wx.EVT_BUTTON, self.OnLogButton) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer2 = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(infoboxbsizer, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.update_label, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.update_box, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.line, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.chk_shutdown, 0, wx.LEFT | wx.EXPAND, 7) self.sizer2.Add(self.logButton, 0) self.sizer2.AddStretchSpacer() self.sizer2.Add(self.startButton, 0)#, wx.RIGHT, 2) self.sizer2.Add(self.abortButton, 0) self.sizer.Add(self.sizer2, 0, wx.ALL | wx.EXPAND, 5) self.panel.SetSizerAndFit(self.sizer) self.Center()
def __init__(self, *args, **kwds): # begin wxGlade: add_div.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL) self.label_1 = wx.StaticText(self.panel_1, -1, "YEAR") self.combo_box_1 = wx.ComboBox(self.panel_1, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT) self.label_2 = wx.StaticText(self.panel_1, -1, "CLASS") self.combo_box_2 = wx.ComboBox(self.panel_1, -1, choices=["Select","8","9","10"], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT) self.sizer_4_staticbox = wx.StaticBox(self.panel_1, -1, "Specify Class ") self.list_box_1 = wx.ListBox(self.panel_1, -1, choices=[], style=wx.LB_SINGLE | wx.LB_SORT) self.button_1 = wx.Button(self.panel_1, -1, "Remove Divison") self.text_ctrl_1 = wx.TextCtrl(self.panel_1, -1, "") self.button_2 = wx.Button(self.panel_1, -1, "Add Division") self.sizer_9_staticbox = wx.StaticBox(self.panel_1, -1, "New Division") self.button_3 = wx.Button(self.panel_1, -1, "Close") self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "Add Academic Year") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2) self.Bind(wx.EVT_LISTBOX, self.on_list, self.list_box_1) self.Bind(wx.EVT_BUTTON, self.on_remove, self.button_1) self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1) self.Bind(wx.EVT_BUTTON, self.on_add, self.button_2) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_3) self.text_ctrl_1 .Bind(wx.EVT_SET_FOCUS,self.onfocus) self.text_ctrl_1 .Bind(wx.EVT_KILL_FOCUS,self.offocus) self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.on_keypress) self.Bind(wx.EVT_HYPERLINK, self.on_hlink, self.hyperlink_1) self.YEAR='' self.CLASS='' self.DB=db_operations() self.load_year() # end wxGlade
def create_static_box(self, **kwargs): panel = kwargs.get('panel') value = kwargs.get('value') gui = kwargs.get('gui') key = kwargs.get('key') static_box = wx.StaticBox(panel, label=translate_key(MODULE_KEY.join(key))) static_sizer = wx.StaticBoxSizer(static_box, wx.VERTICAL) instatic_sizer = wx.BoxSizer(wx.VERTICAL) spacer_size = 7 max_text_size = 0 text_ctrls = [] log.debug("Working on {0}".format(MODULE_KEY.join(key))) spacer = False hidden_items = gui.get('hidden', []) for item, value in value.items(): if item in hidden_items and not self.show_hidden: continue view = gui.get(item, {}).get('view', type(value)) if view in self.value_map.keys(): fnction = self.value_map[view] elif callable(value): fnction = self.value_map['button'] else: return item_dict = fnction['function'](panel=static_box, item=item, value=value, key=key + [item], bind=fnction['bind'], gui=gui.get(item, {}), from_sb=True) if 'text_size' in item_dict: if max_text_size < item_dict.get('text_size'): max_text_size = item_dict['text_size'] text_ctrls.append(item_dict['text_ctrl']) spacer = True if not spacer else instatic_sizer.AddSpacer(spacer_size) instatic_sizer.Add(item_dict['item'], 0, wx.EXPAND, 5) if max_text_size: for ctrl in text_ctrls: ctrl.SetMinSize((max_text_size + 50, ctrl.GetSize()[1])) item_count = instatic_sizer.GetItemCount() if not item_count: static_sizer.Destroy() return wx.BoxSizer(wx.VERTICAL) static_sizer.Add(instatic_sizer, 0, wx.EXPAND | wx.ALL, 5) return static_sizer