Example #1
0
        def populate(self, panel_sizer):
            sizer = wx.BoxSizer(wx.VERTICAL)

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            text = wx.StaticText(self.panel, -1, 'Filename: ')
            sizer2.Add(text, 0, 0, 3)
            self.path_text = textctrl = wx.TextCtrl(self.panel, -1,
                                                    self.set_path())
            wx.EVT_TEXT(textctrl, -1, self.changed)
            sizer2.Add(textctrl, 1, wx.EXPAND, 3)
            button = wx.Button(self.panel, -1, "Browse")
            wx.EVT_BUTTON(button, -1, self.browse)
            sizer2.Add(button, 0, 0, 3)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            text = wx.StaticText(self.panel, -1, 'Index: ')
            sizer2.Add(text, 0, 0, 3)
            self.index_text = textctrl = wx.TextCtrl(
                self.panel, -1, self.item._xml_item.attr.index)
            wx.EVT_TEXT(textctrl, -1, self.changed)
            sizer2.Add(textctrl, 0, 0, 3)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            self.enabled = checkctrl = wx.CheckBox(self.panel, -1, "Enabled")
            sizer2.Add(checkctrl, 0, 0, 3)
            checkctrl.SetValue(self.item._xml_item.attr.enabled == 'true')
            wx.EVT_CHECKBOX(checkctrl, -1, self.changed)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)

            panel_sizer.Add(sizer, 0, wx.EXPAND | wx.ALL)
Example #2
0
    def _create_email_info(self, parent):
        import wx

        # Layout setup ..
        sizer = wx.FlexGridSizer(5, 2, 10, 10)
        sizer.AddGrowableCol(1)

        title_label = wx.StaticText(parent, -1, "Subject:")
        sizer.Add(title_label, 0, wx.ALL | wx.ALIGN_RIGHT)
        title_field = wx.TextCtrl(parent, -1, self.subject, wx.Point(-1, -1))
        sizer.Add(
            title_field,
            1,
            wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT | wx.CLIP_CHILDREN,
        )
        wx.EVT_TEXT(parent, title_field.GetId(), self._on_subject)

        to_label = wx.StaticText(parent, -1, "To:")
        sizer.Add(to_label, 0, wx.ALL | wx.ALIGN_RIGHT)
        to_field = wx.TextCtrl(parent, -1, self.to_address)
        sizer.Add(
            to_field, 1, wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT | wx.CLIP_CHILDREN
        )
        wx.EVT_TEXT(parent, to_field.GetId(), self._on_to)

        cc_label = wx.StaticText(parent, -1, "Cc:")
        sizer.Add(cc_label, 0, wx.ALL | wx.ALIGN_RIGHT)
        cc_field = wx.TextCtrl(parent, -1, "")
        sizer.Add(
            cc_field, 1, wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT | wx.CLIP_CHILDREN
        )
        wx.EVT_TEXT(parent, cc_field.GetId(), self._on_cc)

        from_label = wx.StaticText(parent, -1, "From:")
        sizer.Add(from_label, 0, wx.ALL | wx.ALIGN_RIGHT)
        from_field = wx.TextCtrl(parent, -1, self.from_address)
        sizer.Add(
            from_field,
            1,
            wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT | wx.CLIP_CHILDREN,
        )
        wx.EVT_TEXT(parent, from_field.GetId(), self._on_from)

        smtp_label = wx.StaticText(parent, -1, "SMTP Server:")
        sizer.Add(smtp_label, 0, wx.ALL | wx.ALIGN_RIGHT)
        smtp_server_field = wx.TextCtrl(parent, -1, self.smtp_server)
        sizer.Add(
            smtp_server_field,
            1,
            wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT | wx.CLIP_CHILDREN,
        )
        wx.EVT_TEXT(parent, smtp_server_field.GetId(), self._on_smtp_server)

        return sizer
Example #3
0
    def __init__(self,
                 mainControl,
                 parent,
                 unifName,
                 allowSkip=False,
                 initialRbChoice=None):
        d = wx.PreDialog()
        self.PostCreate(d)

        self.mainControl = mainControl
        self.value = self.RET_CANCEL, None
        self.unifName = unifName

        res = wx.xrc.XmlResource.Get()
        res.LoadOnDialog(self, parent, "TrashBagRenameDialog")

        self.ctrls = XrcControls(self)
        self.ctrls.btnOk.SetId(wx.ID_OK)
        self.ctrls.btnOk = self.ctrls._byId(wx.ID_OK)
        self.ctrls.btnCancel.SetId(wx.ID_CANCEL)

        self.ctrls.rbSkip.Enable(allowSkip)

        if unifName.startswith(u"wikipage/"):
            nameCollision = unifName[9:]
        else:
            nameCollision = unifName  # Should not happen

        self.ctrls.stNameCollision.SetLabel(nameCollision)

        if allowSkip and initialRbChoice in (self.RET_CANCEL, self.RET_SKIP):
            self.ctrls.rbSkip.SetValue(True)
        elif initialRbChoice == self.RET_RENAME_TRASHBAG:
            self.ctrls.rbRenameTrashBag.SetValue(True)
        elif initialRbChoice == self.RET_RENAME_WIKIELEMENT:
            self.ctrls.rbRenameWikiElement.SetValue(True)

        self.updateValidToWikiWord()

        wx.EVT_BUTTON(self, wx.ID_OK, self.OnOk)
        wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel)
        wx.EVT_TEXT(self, GUI_ID.tfTrashBagTo, self.OnTextTrashBagTo)
        wx.EVT_TEXT(self, GUI_ID.tfWikiElementTo, self.OnTextWikiElementTo)
        wx.EVT_RADIOBUTTON(self, GUI_ID.rbOverwrite, self.OnRadioButtonChanged)
        wx.EVT_RADIOBUTTON(self, GUI_ID.rbSkip, self.OnRadioButtonChanged)
        wx.EVT_RADIOBUTTON(self, GUI_ID.rbRenameTrashBag,
                           self.OnRadioButtonChanged)
        wx.EVT_RADIOBUTTON(self, GUI_ID.rbRenameWikiElement,
                           self.OnRadioButtonChanged)

        # Fixes focus bug under Linux
        self.SetFocus()
Example #4
0
 def __init__(self, FileName):
     wx.Dialog.__init__(self, None, title="Importing a CSV file",\
             size=(600,470))
     self.FileName = FileName
     self.decider = wx.Notebook(self, -1, pos=(10,0), \
             size=(580,240), style=wx.NB_TOP)
     self.p1 = PanelDelimiter(self.decider, self.FileName.fileName)
     self.p2 = PanelFixedWidth(self.decider, self.FileName.fileName)
     self.decider.AddPage(self.p1, "Delimited files")
     self.decider.AddPage(self.p2, "Fixed width files")
     t1 = wx.StaticText(self, -1, label="Import from row:", pos=(245, 250))
     self.headerRow = wx.CheckBox(self, 760, " Header on first row", \
             pos=(430,250))
     self.dataRow = wx.SpinCtrl(self,766,min=1,max=100, initial=1, \
             pos=(365,250),size=(50,-1))
     self.dataRow.SetValue(1)
     self.buttonImport = wx.Button(self,763,"Import", \
             pos=(500,400),size=(70,-1))
     self.buttonImport.SetDefault()
     self.buttonCancel = wx.Button(self,764,"Cancel", \
             pos=(405,400),size=(70,-1))
     self.grid = gridlib.Grid(self, -1, size=(560, 100), pos=(20, 290))
     #self.grid.HideRowLabels()
     self.MaxRows = 100
     self.MaxCols = 8
     self.grid.SetColLabelSize(16)
     self.grid.SetRowLabelSize(40)
     self.grid.SetDefaultColSize(60)
     self.grid.CreateGrid(self.MaxRows, self.MaxCols)
     for i in range(8):
         self.grid.SetRowSize(i, 16)
         self.grid.SetColLabelValue(i, " ")
     self.gridFont = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL)
     self.grid.SetDefaultCellFont(self.gridFont)
     lineEndChoices = [
         'Not sure', '\\n (Unix)', '\\r\\n (Windows)', '\\r (old Mac)'
     ]
     t3 = wx.StaticText(self, -1, "Line ending:", pos=(20, 250))
     self.lineEnd = wx.Choice(self, 765,pos=(105,248),size=(120,-1),\
             choices = lineEndChoices)
     self.AttemptPreview()
     # It seems odd but it seems better for all events to be routed to the same method
     wx.EVT_CHECKBOX(self, 760, self.AttemptPreview)
     wx.EVT_TEXT(self, 761, self.AttemptPreview)
     wx.EVT_TEXT(self, 762, self.AttemptPreview)
     wx.EVT_BUTTON(self, 764, self.CancelButton)
     wx.EVT_BUTTON(self, 763, self.ImportButton)
     wx.EVT_CHOICE(self, 765, self.AttemptPreview)
     wx.EVT_SPINCTRL(self, 766, self.AttemptPreview)
Example #5
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """

        style = 0
        if self.factory.enter_set:
            style = wx.TE_PROCESS_ENTER
        self.control = wx.SearchCtrl(parent, -1, value=self.value, style=style)

        self.control.SetDescriptiveText(self.factory.text)
        self.control.ShowSearchButton(self.factory.search_button)
        self.control.ShowCancelButton(self.factory.cancel_button)

        if self.factory.auto_set:
            wx.EVT_TEXT(parent, self.control.GetId(), self.update_object)

        if self.factory.enter_set:
            wx.EVT_TEXT_ENTER(parent, self.control.GetId(), self.update_object)

        wx.EVT_SEARCHCTRL_SEARCH_BTN(
            parent, self.control.GetId(), self.update_object
        )
        wx.EVT_SEARCHCTRL_CANCEL_BTN(
            parent, self.control.GetId(), self.clear_text
        )
Example #6
0
    def __init__(self):
        res = wx.xrc.XmlResource.Get()
        self.dialog = res.LoadDialog(None, 'image_copy_dialog')
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('rename'), self.on_rename)
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('skip'), self.on_skip)
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('auto_skip'), self.on_skip_all)
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('overwrite'),
                      self.on_overwrite)
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('overwrite_all'),
                      self.on_overwrite_all)
        wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('cancel'), self.on_cancel)
        wx.EVT_TEXT(self.dialog, wx.xrc.XRCID('new_image_name'),
                    self.on_new_name)

        self.new_image = wx.xrc.XRCCTRL(self.dialog, 'new_image')
        self.old_image = wx.xrc.XRCCTRL(self.dialog, 'orig_image')
        self.new_image_info = wx.xrc.XRCCTRL(self.dialog, 'new_image_info')
        self.old_image_info = wx.xrc.XRCCTRL(self.dialog, 'orig_image_info')
        self.new_file_info = wx.xrc.XRCCTRL(self.dialog, 'new_file_info')
        self.old_file_info = wx.xrc.XRCCTRL(self.dialog, 'orig_file_info')
        self.rename_button = wx.xrc.XRCCTRL(self.dialog, 'rename')
        self.new_image_name = wx.xrc.XRCCTRL(self.dialog, 'new_image_name')

        self.new_name = None
        self.dstdir = None
Example #7
0
    def __init__(self, parent, wxId, id):
        base.Widget.__init__(self, wx.TextCtrl(parent, wxId))
        self.widgetId = id

        # The default font looks the best.
        self.getWxWidget().SetFont(wx.NORMAL_FONT)

        # We want focus notifications.
        self.setFocusId(id)

        # Listen for content changes.
        wx.EVT_TEXT(parent, wxId, self.onTextChange)

        # This must be set to True when notifications need to be sent.
        self.willNotify = True

        # If True, a value-changed notification will be immediately
        # reflected in the text field.
        self.reactToNotify = True

        # The default validator accepts anything.
        self.validator = lambda text: True
        
        # Listen to value changes.
        self.addValueChangeListener()
        self.addProfileChangeListener()
Example #8
0
    def __init__(self, underlying_control, carriage_return_bug=1, **args):
        """wraps underlying wx.Python wx.TextCtrl

        **INPUTS**

        *wx.TextCtrl* underlying_control -- underlying text control - a wx.Python
        text control object
    
        **OUTPUTS**

        *none*
        """
        self.deep_construct(
            TextBufferWX, {
                'underlying': underlying_control,
                'program_initiated': 0,
                'contents_external': underlying_control.GetValue(),
                'contents_internal': '',
                'carriage_return_bug': carriage_return_bug,
                'nl': '\n',
                'crnl': '\015\n',
                'delta_width': 0
            }, args)

        if not self.carriage_return_bug:
            self.crnl = self.nl
        self.delta_width = len(self.crnl) - len(self.nl)
        self.contents_internal = string.replace(self.contents_external,
                                                self.nl, self.crnl)
        parent = self.underlying.GetParent()
        ID = self.underlying.GetId()
        #        wx.EVT_TEXT(self.underlying, ID, self._on_evt_text)
        wx.EVT_TEXT(parent, ID, self._on_evt_text)
Example #9
0
 def __init__(self, parent, val, values):
     wx.Panel.__init__(self, parent, -1)
     self.values = values
     self.sizer = wx.FlexGridSizer(1, 3, 2, 2)
     self.sizer.AddGrowableCol(1)
     self.edit = wx.SpinCtrl(self,
                             -1,
                             str(val),
                             style=wx.SP_WRAP | wx.SP_ARROW_KEYS,
                             min=0,
                             max=10000,
                             initial=val,
                             size=(200, -1))
     self.txt = wx.StaticText(self, -1, self.GetText(val))
     self.btn = wx.Button(self, -1, '...', style=wx.BU_EXACTFIT)
     self.sizer.AddMany([
         (self.edit, 0, wx.EXPAND),
         (self.txt, 1, wx.EXPAND),
         (self.btn, 0, wx.EXPAND),
     ])
     wx.EVT_TEXT(self.edit, self.edit.GetId(), self.OnChange)
     wx.EVT_BUTTON(self.btn, self.btn.GetId(), self.OnContacts)
     self.sizer.Fit(self)
     self.SetAutoLayout(True)
     self.SetSizer(self.sizer)
Example #10
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        if not self.factory.low_name:
            self.low = self.factory.low

        if not self.factory.high_name:
            self.high = self.factory.high

        self.sync_value(self.factory.low_name, 'low', 'from')
        self.sync_value(self.factory.high_name, 'high', 'from')

        if self.factory.enter_set:
            control = wx.TextCtrl(parent,
                                  -1,
                                  self.str_value,
                                  style=wx.TE_PROCESS_ENTER)
            wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_object)
        else:
            control = wx.TextCtrl(parent, -1, self.str_value)

        wx.EVT_KILL_FOCUS(control, self.update_object)

        if self.factory.auto_set:
            wx.EVT_TEXT(parent, control.GetId(), self.update_object)

        self.evaluate = self.factory.evaluate
        self.sync_value(self.factory.evaluate_name, 'evaluate', 'from')

        self.control = control
        self.set_tooltip()
Example #11
0
    def _create_report_panel(self, parent):
        import wx

        box = wx.StaticBox(parent, -1, "Report Information:")
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        # Add email info ...
        sizer.Add(self._create_email_info(parent), 0, wx.ALL | wx.EXPAND, 5)

        # Add priority combo:
        sizer.Add(self._create_priority_combo(parent), 0, wx.ALL | wx.RIGHT, 5)

        # Extra comments from the user:
        label3 = wx.StaticText(parent, -1, "Additional Comments:")
        sizer.Add(label3, 0, wx.LEFT | wx.TOP | wx.BOTTOM | wx.CLIP_CHILDREN,
                  5)

        comments_field = wx.TextCtrl(parent,
                                     -1,
                                     self.comments,
                                     size=(-1, 75),
                                     style=wx.TE_MULTILINE | wx.TE_RICH2
                                     | wx.CLIP_CHILDREN)
        comments_field.SetSizeHints(minW=-1, minH=75)
        font = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL)
        comments_field.SetStyle(0, len(self.comments), wx.TextAttr(font=font))
        sizer.Add(comments_field, 1, wx.ALL | wx.EXPAND | wx.CLIP_CHILDREN, 5)
        wx.EVT_TEXT(parent, comments_field.GetId(), self._on_comments)

        # Include the project combobox?
        if len(self.service.mail_files) > 0:
            sizer.Add(self._create_project_upload(parent), 0, wx.ALL, border=5)

        return sizer
Example #12
0
    def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        factory       = self.factory
        style         = self.base_style
        self.evaluate = factory.evaluate
        self.sync_value( factory.evaluate_name, 'evaluate', 'from' )

        if (not factory.multi_line) or factory.password:
            style &= ~wx.TE_MULTILINE

        if factory.password:
            style |= wx.TE_PASSWORD

        multi_line = ((style & wx.TE_MULTILINE) != 0)
        if multi_line:
            self.scrollable = True

        if factory.enter_set and (not multi_line):
            control = wx.TextCtrl( parent, -1, self.str_value,
                                   style = style | wx.TE_PROCESS_ENTER )
            wx.EVT_TEXT_ENTER( parent, control.GetId(), self.update_object )
        else:
            control = wx.TextCtrl( parent, -1, self.str_value, style = style )

        wx.EVT_KILL_FOCUS( control, self.update_object )

        if factory.auto_set:
            wx.EVT_TEXT( parent, control.GetId(), self.update_object )

        self.control = control
        self.set_error_state( False )
        self.set_tooltip()
Example #13
0
    def __init__(self, *args, **kwargs):
        super(TimeExpressionEntry, self).__init__(*args, **kwargs)

        self.__defaultColor = self.GetBackgroundColour()
        self.__invalidColor = wx.Colour(255, 128, 128)

        wx.EVT_TEXT(self, wx.ID_ANY, self._onTextChanged)
Example #14
0
    def _pop_up_text(self):
        """ Pop-up a text control to allow the user to enter a value using
            the keyboard.
        """
        control = self.control
        factory = self.factory
        style = (self.text_styles[self.alignment] | wx.TE_PROCESS_ENTER)
        if factory.password:
            style |= wx.TE_PASSWORD

        self._text = text = wx.TextCtrl(control,
                                        -1,
                                        self.str_value,
                                        style=style)
        slice = self.image_slice
        wdx, wdy = control.GetClientSize()
        tdx, tdy = text.GetSize()
        text.SetPosition(
            wx.Point(slice.xleft,
                     ((wdy + slice.xtop - slice.xbottom - tdy) / 2) + 1))
        text.SetSize(wx.Size(wdx - slice.xleft - slice.xright, tdy))
        text.SetSelection(-1, -1)
        text.SetFocus()

        wx.EVT_KILL_FOCUS(text, self._text_completed)
        wx.EVT_CHAR(text, self._key_entered)
        wx.EVT_TEXT_ENTER(control, text.GetId(), self.update_object)

        if factory.auto_set and (not factory.is_grid_cell):
            wx.EVT_TEXT(control, text.GetId(), self.update_object)
Example #15
0
    def __init__(self,owner,parent,pname,ptype,pvalue):
        if ptype in [2,4,5]:
            return
        wx.BoxSizer.__init__(self,wx.HORIZONTAL)
        self.owner = owner
        self.dataType = ptype
        self.parent = parent
        valid_types = [_('integer'),_('float'),_('string'),\
                                            _('object'),_('location')]
        self.control_memory = {self.dataType:pvalue}

        self.left_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.name_control = wx.TextCtrl(self.parent,-1)
        self.name_control.SetValue(pname)
        self.type_control = wx.Choice(self.parent,-1,\
                        choices=valid_types,style=wx.LB_SINGLE)
        self.type_control.SetSelection(self.dataType-1)
        
        self.left_sizer.Add(self.name_control,flag=wx.ALL,border=2)
        self.left_sizer.Add(self.type_control,\
                            flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL,border=2)

        wx.EVT_CHOICE(self.parent,self.type_control.GetId(),self.typeSelect)
        wx.EVT_TEXT(self.parent,self.name_control.GetId(),self.valueChanged)

        self.Add(self.left_sizer,wx.ALL,border=2)

        self.setDataControl()
Example #16
0
    def __init__(self, parent, label, text_obj):
        SettingBase.__init__(self, parent, label)
        text.AnimatedText.__init__(self, text_obj)
        self.text_obj = text_obj
        self.parent = parent
        self.mpl_figure = text_obj.get_figure()

        self.__bkgd_region = None

        self.tc = wx.TextCtrl(parent,
                              -1,
                              value=text_obj.get_text(),
                              style=wx.TE_PROCESS_ENTER)
        wx.EVT_TEXT(parent, self.tc.GetId(), self.on_text_change)
        self.Add(self.tc, 1, wx.ALIGN_CENTRE_VERTICAL)

        prop_bmp = wx.ArtProvider.GetBitmap("avoplot_text_prop", wx.ART_BUTTON)
        self.prop_button = wx.BitmapButton(parent, wx.ID_ANY, prop_bmp)
        self.prop_button.SetToolTip(wx.ToolTip("Edit font properties"))
        self.Add(self.prop_button, 0,
                 wx.ALIGN_CENTER_VERTICAL | wx.RESERVE_SPACE_EVEN_IF_HIDDEN)
        wx.EVT_BUTTON(parent, self.prop_button.GetId(),
                      self.on_text_prop_button)

        wx.EVT_SET_FOCUS(self.tc, self.on_focus)
        wx.EVT_KILL_FOCUS(self.tc, self.on_unfocus)

        #hide the button if it is an empty string
        if not self.text_obj.get_text():
            self.prop_button.Show(False)
Example #17
0
 def setDataControl(self):
     if self.dataType == 1:
         # integer, use wx.SpinCtrl
         self.data_control = wx.SpinCtrl(self.parent,-1)
         self.data_control.SetRange(-2147483648,2147483647)
         # full Int range and not 0-100
         
         if self.dataType in self.control_memory.keys():
             self.data_control.SetValue(self.control_memory[self.dataType])
         else:
             self.data_control.SetValue(0)
         
         wx.EVT_SPINCTRL(self.parent,self.data_control.GetId(),self.valueChanged)
         wx.EVT_TEXT(self.parent,self.data_control.GetId(),self.valueChanged)
     elif self.dataType in [2,3]:
         # string, use a TextCtrl
         self.data_control = wx.TextCtrl(self.parent,-1)
         if self.dataType in self.control_memory.keys():
             self.data_control.SetValue(self.control_memory[self.dataType])
     elif self.dataType in[4,5]:
         # object and location - unsupported
         self.data_control = wx.StaticText(self.parent,-1,'Uneditable Data')
         if self.dataType in self.control_memory.keys():
             self.data_control.SetValue(self.control_memory[self.dataType])
     if self.data_control:
         self.Add(self.data_control,flag=wx.ALL,border=2)
     self.Layout()
     self.parent.propGrid.Layout()
Example #18
0
 def getInfoPanel(self, parent):
     wx.StaticText(parent, -1, "Traffic ", wx.Point(5, 5))
     wx.StaticText(parent, -1, "   Name: " + self.getName(),
                   wx.Point(5, 20))
     wx.StaticText(parent, -1, "   Throughput: ", wx.Point(5, 35))
     wx.StaticText(parent, -1, "   Target: ", wx.Point(5, 64))
     tID = wx.NewId()
     choice = wx.Choice(parent,
                        tID,
                        wx.Point(100, 60),
                        size=wx.Size(105, 22),
                        choices=[])
     wx.EVT_CHOICE(parent, tID, self.assign)
     id = choice.Append(" <None> ")
     choice.SetClientData(id, None)
     choice.SetSelection(id)
     for item in self._ctrl.getClients():
         hostAssigned = self._ctrl.tree.GetPyData(
             self._ctrl.tree.GetItemParent(
                 self._ctrl.findTreeNode(self))).getAssignedClient()
         if hostAssigned == item[0]:
             continue
         id = choice.Append(str(item[1][1]))
         choice.SetClientData(id, item[0])
         if self._client == item[0]:
             choice.SetSelection(id)
     tID = wx.NewId()
     text = wx.TextCtrl(parent, tID, str(self._throughput),
                        wx.Point(100, 31), (105, -1))
     wx.EVT_TEXT(parent, text.GetId(), self.EvtText)
     wx.StaticText(parent, -1, "kb/s", wx.Point(210, 35))
Example #19
0
    def __init__(self, parent, window, controler):
        wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)

        self.ParentWindow = window
        self.parent = parent
        self.Controler = controler

        self.DefaultConfig = []
        self.cobeID = self.Controler.GetFullIEC_Channel()
        self.cobeID = self.cobeID[:-2].replace('.', '_')
        self.DefaultConfig.append({
            "Name": "Node_ID_{}".format(self.cobeID),
            "Address": "127",
            "Len": "",
            "Type": u"INT",
            "Initial": "",
            "Description": DESCRIPTION,
            "OnChange": "",
            "Value": "",
            "Options": ""
        })

        self.nodeIDsizer = wx.BoxSizer(wx.HORIZONTAL)
        nodeIDLbl = wx.StaticText(self, label='Node ID', size=TEAXLABEL_SIZE)
        self.nodeIDsizer.Add(nodeIDLbl, wx.ALIGN_CENTER_VERTICAL)
        self.nodeID = wx.lib.intctrl.IntCtrl(self,
                                             value=127,
                                             min=0,
                                             max=127,
                                             limited=True)
        wx.EVT_TEXT(self, self.nodeID.GetId(), self.OnChange)
        self.nodeIDsizer.Add(self.nodeID)
        self.SetSizer(self.nodeIDsizer)
Example #20
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        super(SimpleEditor, self).init(parent)

        factory = self.factory

        if factory.evaluate is None:
            self.control = control = wx.Choice(parent, -1, wx.Point(0, 0),
                                               wx.Size(-1, -1), self.names)
            wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object)
        else:
            self.control = control = wx.ComboBox(parent,
                                                 -1,
                                                 '',
                                                 wx.Point(0, 0),
                                                 wx.Size(-1, -1),
                                                 self.names,
                                                 style=wx.CB_DROPDOWN)
            wx.EVT_COMBOBOX(parent, control.GetId(), self.update_object)
            wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_text_object)
            wx.EVT_KILL_FOCUS(control, self.on_kill_focus)

            if (not factory.is_grid_cell) and factory.auto_set:
                wx.EVT_TEXT(parent, control.GetId(), self.update_text_object)

        self._no_enum_update = 0
        self.set_tooltip()
Example #21
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        factory = self.factory
        if not factory.low_name:
            self.low = factory.low

        if not factory.high_name:
            self.high = factory.high

        self.sync_value(factory.low_name, 'low', 'from')
        self.sync_value(factory.high_name, 'high', 'from')
        low = self.low
        high = self.high
        self.control = wx.SpinCtrl(parent,
                                   -1,
                                   self.str_value,
                                   min=low,
                                   max=high,
                                   initial=self.value)
        wx.EVT_SPINCTRL(parent, self.control.GetId(), self.update_object)
        if wx.VERSION < (3, 0):
            wx.EVT_TEXT(parent, self.control.GetId(), self.update_object)
        self.set_tooltip()
Example #22
0
        def populate(self, panel_sizer):
            sizer = wx.BoxSizer(wx.VERTICAL)

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            text = wx.StaticText(self.panel, -1, 'Adapter Type: ')
            sizer2.Add(text, 0, 0, 3)
            current_type = self.types_dict_rev[str(
                self.item._xml_item.attr.type)]
            if sys.platform == 'win32':
                style = 0
            else:
                style = wx.CB_READONLY
            comboctrl = wx.ComboBox(self.panel, -1, current_type, style=style)

            def type_combo_changed(event):
                self.load_adapter_list()
                self.changed(event)

            wx.EVT_COMBOBOX(comboctrl, -1, type_combo_changed)
            wx.EVT_TEXT(comboctrl, -1, type_combo_changed)
            [comboctrl.Append(typename) for typename in self.types_dict.keys()]
            sizer2.Add(comboctrl, 1, wx.EXPAND, 3)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)
            self.type_combo = comboctrl

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            text = wx.StaticText(self.panel, -1, 'Adapter Name: ')
            sizer2.Add(text, 0, 0, 3)
            comboctrl = wx.ComboBox(self.panel, -1)
            wx.EVT_COMBOBOX(comboctrl, -1, self.changed)
            wx.EVT_TEXT(comboctrl, -1, self.changed)
            sizer2.Add(comboctrl, 1, wx.EXPAND, 3)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)
            self.name_combo = comboctrl
            self.load_adapter_list(False)
            comboctrl.SetValue(str(self.item._xml_item.attr.name))

            sizer2 = wx.BoxSizer(wx.HORIZONTAL)
            text = wx.StaticText(self.panel, -1, 'Index: ')
            sizer2.Add(text, 0, 0, 3)
            self.index_text = textctrl = wx.TextCtrl(
                self.panel, -1, self.item._xml_item.attr.index)
            wx.EVT_TEXT(textctrl, -1, self.changed)
            sizer2.Add(textctrl, 0, 0, 3)
            sizer.Add(sizer2, 0, wx.EXPAND | wx.ALL, 3)

            panel_sizer.Add(sizer, 0, wx.EXPAND | wx.ALL)
Example #23
0
    def __init__(self, parent, autoCompletion):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           "Auto-completion",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.autoCompletion = autoCompletion

        vsizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.elementsCombo = wx.ComboBox(self,
                                         -1,
                                         style=wx.CB_READONLY | wx.EXPAND)

        for t in autoCompletion.types.itervalues():
            self.elementsCombo.Append(t.ti.name, t.ti.lt)

        wx.EVT_COMBOBOX(self, self.elementsCombo.GetId(), self.OnElementCombo)

        hsizer.Add(self.elementsCombo, 0)

        vsizer.Add(hsizer, 0, wx.EXPAND)

        vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM,
                   10)

        self.enabledCb = wx.CheckBox(self, -1, "Auto-completion Enabled")
        wx.EVT_CHECKBOX(self, self.enabledCb.GetId(), self.OnMisc)
        vsizer.Add(self.enabledCb, 0, wx.BOTTOM, 10)

        self.itemsEntry = wx.TextCtrl(self,
                                      -1,
                                      style=wx.TE_MULTILINE | wx.TE_DONTWRAP,
                                      size=(200, 250))
        wx.EVT_TEXT(self, self.itemsEntry.GetId(), self.OnMisc)
        vsizer.Add(self.itemsEntry, 1, wx.EXPAND)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        hsizer.Add((1, 1), 1)

        cancelBtn = gutil.createStockButton(self, "Cancel")
        hsizer.Add(cancelBtn, 0, wx.LEFT, 10)

        okBtn = gutil.createStockButton(self, "OK")
        hsizer.Add(okBtn, 0, wx.LEFT, 10)

        vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)

        util.finishWindow(self, vsizer)

        self.elementsCombo.SetSelection(0)
        self.OnElementCombo()

        wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
        wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
Example #24
0
 def makeResRefControl(self, typeSpec, prop, parent):
     if len(typeSpec) > 1:
         keyList, index = self.getResRefList(typeSpec, prop)
         control = wx.ComboBox(parent,
                               -1,
                               choices=keyList,
                               style=wx.CB_DROPDOWN)
         if len(prop.getValue()) > 0:
             control.SetSelection(index)
         else:
             control.SetSelection(0)
         wx.EVT_COMBOBOX(self, control.GetId(), self.controlUsed)
         wx.EVT_TEXT(self, control.GetId(), self.controlUsed)
     else:
         control = wx.TextCtrl(parent, -1, prop.getValue())
         wx.EVT_TEXT(self, control.GetId(), self.controlUsed)
     return control
Example #25
0
 def bind_event(self, function):
     def func_2(event):
         if self.is_active():
             function(event)
         event.Skip()
     wx.EVT_KILL_FOCUS(self.spin, func_2)
     if wx.Platform == '__WXMAC__' or self.immediate:
         wx.EVT_TEXT(self.spin, self.spin.GetId(), func_2)
         wx.EVT_SPINCTRL(self.spin, self.spin.GetId(), func_2)
Example #26
0
 def AddTextAndLabel(self, labelText, sizer):
     staticText = wx.StaticText(self, label=labelText)
     sizer.Add(staticText)
     newId = wx.NewId()
     # textCtrl = wx.TextCtrl(self, id=newId)
     textCtrl = IpAddrCtrl(self, id=newId)
     wx.EVT_TEXT(self, textCtrl.GetId(), self.OnChange)
     sizer.Add(textCtrl)
     return {"Label": staticText, "TextCtrl": textCtrl}
    def __init__(self, parent, title):
        TitledPage.__init__(self, parent, title)
        self.serviceId = wx.NewId()
        self.hostId = wx.NewId()
        self.emailId = wx.NewId()

        self.text = wx.StaticText(
            self, -1,
            "The e-mail address will be used for verification, please make sure it is valid."
        )
        self.serviceText = wx.StaticText(self, -1, "Service Type:")
        self.serviceDropdown = wx.ComboBox(
            self,
            -1,
            "",
            style=wx.CB_DROPDOWN | wx.CB_READONLY,
            choices=map(lambda x: x[0], ServiceTypes))
        self.hostText = wx.StaticText(self, -1, "Machine Name:")
        self.emailText = wx.StaticText(self, -1, "E-mail:")
        self.serviceCtrl = wx.TextCtrl(self, self.serviceId)
        self.serviceNameText = wx.StaticText(self, -1, "Service Name:")
        self.serviceCtrl.Enable(0)
        self.serviceNameText.Enable(0)

        self.serviceName = None
        self.userTyped = 0

        self.hostName = SystemConfig.instance().GetHostname()

        self.hostCtrl = wx.TextCtrl(self, self.hostId, self.hostName)
        self.emailCtrl = wx.TextCtrl(self, self.emailId)

        self.SetValidator(ServiceCertValidator())

        wx.EVT_COMBOBOX(self.serviceDropdown, self.serviceDropdown.GetId(),
                        self.OnServiceSelected)

        wx.EVT_TEXT(self.serviceCtrl, self.serviceId, self.OnServiceText)
        wx.EVT_TEXT(self.emailCtrl, self.emailId, self.EnterText)
        wx.EVT_TEXT(self.hostCtrl, self.hostId, self.EnterText)
        wx.EVT_CHAR(self.serviceCtrl, self.OnServiceChar)
        self.Layout()
Example #28
0
 def __init__(self, parent, name):
     pre = wx.PrePanel()
     g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP')
     self.PostCreate(pre)
     self.modified = self.freeze = False
     self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD')
     self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE')
     self.combo = xrc.XRCCTRL(self, 'COMBO_STD')
     self.text = xrc.XRCCTRL(self, 'TEXT_FILE')
     self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE')
     self.textModified = False
     self.SetAutoLayout(True)
     self.GetSizer().SetMinSize((260, -1))
     self.GetSizer().Fit(self)
     wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd)
     wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile)
     wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse)
     wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo)
     wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange)
     wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
Example #29
0
 def __init__(self, parent, id=-1, value=None, mois=False, *args, **kwargs):
     global DATECTRL_WIDTH
     self.mois = mois
     wx.TextCtrl.__init__(self, parent, id=-1, *args, **kwargs)
     if DATECTRL_WIDTH == 0:
         dc = wx.WindowDC(self)
         DATECTRL_WIDTH = dc.GetMultiLineTextExtent("00/00/0000 ", self.GetFont())[0]
     self.SetMinSize((DATECTRL_WIDTH + 10, -1))
     wx.EVT_TEXT(self, -1, self.checkSyntax)
     if value is not None:
         self.SetValue(value)
Example #30
0
    def AddMiscLongText(self, title, shortname, num):
        self.display_elements[shortname+"_text"] = wx.StaticText(self.panelMisc, -1, title,pos=(15,19+num*40))
        self.display_elements[shortname+"_panel"] = wx.Panel(self.panelMisc, -1, size=wx.Size(450,70),pos=(20,44+num*40))

        try:
            content = open(os.environ["POL_USER_ROOT"]+"/configurations/pre_shortcut/"+self.s_title,'r').read()
        except:
            content = ""

        self.display_elements[shortname] = wx.TextCtrl(self.display_elements[shortname+"_panel"], 400+num, content, size=wx.Size(448,68), pos=(2,2), style=Variables.widget_borders|wx.TE_MULTILINE)
        wx.EVT_TEXT(self, 405,  self.edit_shortcut)