Python wx.TE_PROCESS_ENTER Examples

The following are 23 code examples of wx.TE_PROCESS_ENTER(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: daily.py    From Bruno with MIT License 6 votes vote down vote up
def __init__(self):
        wx.Frame.__init__(self, None,
                          pos=wx.DefaultPosition, size=wx.Size(450, 100),
                          style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |
                          wx.CLOSE_BOX | wx.CLIP_CHILDREN,
                          title="BRUNO")
        panel = wx.Panel(self)

        ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO)
        self.SetIcon(ico)

        my_sizer = wx.BoxSizer(wx.VERTICAL)
        lbl = wx.StaticText(panel,
                            label="Bienvenido Sir. How can I help you?")
        my_sizer.Add(lbl, 0, wx.ALL, 5)
        self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER,
                               size=(400, 30))
        self.txt.SetFocus()
        self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
        my_sizer.Add(self.txt, 0, wx.ALL, 5)
        panel.SetSizer(my_sizer)
        self.Show()
        speak.Speak('''Welcome back Sir, Broono at your service.''') 
Example #2
Source File: CellEditor.py    From bookhub with MIT License 6 votes vote down vote up
def __init__(self, olv, subItemIndex, **kwargs):
        style = wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB
        # Allow for odd case where parent isn't an ObjectListView
        if hasattr(olv, "columns"):
            if olv.HasFlag(wx.LC_ICON):
                style |= (wx.TE_CENTRE | wx.TE_MULTILINE)
            else:
                style |= olv.columns[subItemIndex].GetAlignmentForText()
        wx.TextCtrl.__init__(self, olv, style=style, size=(0,0), **kwargs)

        # With the MULTILINE flag, the text control always has a vertical
        # scrollbar, which looks stupid. I don't know how to get rid of it.
        # This doesn't do it:
        # self.ToggleWindowStyle(wx.VSCROLL)

#---------------------------------------------------------------------------- 
Example #3
Source File: DurationCellEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        wx.PyControl.__init__(self, parent)

        main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        # create location text control
        self.Duration = wx.TextCtrl(self, size=wx.Size(0, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.Duration.Bind(wx.EVT_KEY_DOWN, self.OnDurationChar)
        main_sizer.AddWindow(self.Duration, flag=wx.GROW)

        # create browse button
        self.EditButton = wx.Button(self, label='...', size=wx.Size(30, -1))
        self.Bind(wx.EVT_BUTTON, self.OnEditButtonClick, self.EditButton)
        main_sizer.AddWindow(self.EditButton, flag=wx.GROW)

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSizer(main_sizer)

        self.Default = None 
Example #4
Source File: Terminal.py    From meerk40t with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: Terminal.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((581, 410))
        self.text_main = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_BESTWRAP | wx.TE_MULTILINE | wx.TE_READONLY)
        self.text_entry = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        self.__set_properties()
        self.__do_layout()
        # self.Bind(wx.EVT_TEXT, self.on_key_down, self.text_entry)
        self.Bind(wx.EVT_CHAR_HOOK, self.on_key_down, self.text_entry)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_entry, self.text_entry)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.pipe = None
        self.command_log = []
        self.command_position = 0 
Example #5
Source File: UsbConnect.py    From meerk40t with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: Terminal.__init__
        kwds["style"] = kwds.get("style",
                                 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((915, 424))
        self.text_main = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_BESTWRAP | wx.TE_MULTILINE | wx.TE_READONLY)
        self.text_entry = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT_ENTER, self.on_entry, self.text_entry)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.pipe = None 
Example #6
Source File: dialog_dllog.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"控制台日志", pos=wx.DefaultPosition, size=wx.Size(500, 500),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sizer_global = wx.BoxSizer(wx.VERTICAL)
        self.textctrl_log = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(427, 381),
                                           wx.TE_AUTO_URL | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        # self.listctrl_log = ListCtrl_DLLog(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        sizer_global.Add(self.textctrl_log, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_global)
        self.Layout()

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose) 
Example #7
Source File: wx_mpl_dynamic_graph.py    From code-for-blog with The Unlicense 6 votes vote down vote up
def __init__(self, parent, ID, label, initval):
        wx.Panel.__init__(self, parent, ID)
        
        self.value = initval
        
        box = wx.StaticBox(self, -1, label)
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        
        self.radio_auto = wx.RadioButton(self, -1, 
            label="Auto", style=wx.RB_GROUP)
        self.radio_manual = wx.RadioButton(self, -1,
            label="Manual")
        self.manual_text = wx.TextCtrl(self, -1, 
            size=(35,-1),
            value=str(initval),
            style=wx.TE_PROCESS_ENTER)
        
        self.Bind(wx.EVT_UPDATE_UI, self.on_update_manual_text, self.manual_text)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_enter, self.manual_text)
        
        manual_box = wx.BoxSizer(wx.HORIZONTAL)
        manual_box.Add(self.radio_manual, flag=wx.ALIGN_CENTER_VERTICAL)
        manual_box.Add(self.manual_text, flag=wx.ALIGN_CENTER_VERTICAL)
        
        sizer.Add(self.radio_auto, 0, wx.ALL, 10)
        sizer.Add(manual_box, 0, wx.ALL, 10)
        
        self.SetSizer(sizer)
        sizer.Fit(self) 
Example #8
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def create_text_ctrl(self, panel, value):
        style = 0
        if self.readonly:               style = wx.TE_READONLY
        if self.multiline:              style |= wx.TE_MULTILINE
        else:                           style |= wx.TE_PROCESS_ENTER
        if not self._HORIZONTAL_LAYOUT: style |= wx.HSCROLL

        if self.multiline=="grow":
            text = ExpandoTextCtrl( panel, -1, value or "", style=style )
            #text.Bind(EVT_ETC_LAYOUT_NEEDED, self.on_layout_needed)
            text.SetWindowStyle(wx.TE_MULTILINE | wx.TE_RICH2)
            text.SetMaxHeight(200)
        else:
            text = wx.TextCtrl( panel, -1, value or "", style=style )
        # bind KILL_FOCUS and Enter for non-multilines
        text.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
        text.Bind(wx.EVT_SET_FOCUS, self.on_focus)
        # XXX
        text.Bind(wx.EVT_CHAR, self.on_char)
        text.Bind(wx.EVT_TEXT, self._on_text)
        return text 
Example #9
Source File: DownloadManager.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, default_text, visit_url_func):
        wx.TextCtrl.__init__(self, parent, size=(150,-1), style=wx.TE_PROCESS_ENTER|wx.TE_RICH)
        self.default_text = default_text
        self.visit_url_func = visit_url_func
        self.reset_text(force=True)
        self._task = TaskSingleton()

        event = wx.SizeEvent((150, -1), self.GetId())
        wx.PostEvent(self, event)

        self.old = self.GetValue()
        self.Bind(wx.EVT_TEXT, self.begin_edit)
        self.Bind(wx.EVT_SET_FOCUS, self.begin_edit)
        def focus_lost(event):
            gui_wrap(self.reset_text)
        self.Bind(wx.EVT_KILL_FOCUS, focus_lost)
        self.Bind(wx.EVT_TEXT_ENTER, self.search) 
Example #10
Source File: fourier_demo_wx_sgskip.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, parent, label, param):
        self.sliderLabel = wx.StaticText(parent, label=label)
        self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER)
        self.slider = wx.Slider(parent, -1)
        # self.slider.SetMax(param.maximum*1000)
        self.slider.SetRange(0, param.maximum * 1000)
        self.setKnob(param.value)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.sliderLabel, 0,
                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
                  border=2)
        sizer.Add(self.sliderText, 0,
                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
                  border=2)
        sizer.Add(self.slider, 1, wx.EXPAND)
        self.sizer = sizer

        self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler)
        self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler)

        self.param = param
        self.param.attach(self) 
Example #11
Source File: new_properties.py    From wxGlade with MIT License 5 votes vote down vote up
def create_editor(self, panel, sizer):
        if not _is_gridbag(self.owner.parent): return
        max_rows, max_cols = self.owner.parent.check_span_range(self.owner.index, *self.value)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        # label
        self.label_ctrl = label = self._get_label(self._find_label(), panel)
        hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3)
        # checkbox, if applicable
        self.enabler = None

        style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS
        self.rowspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_rows)  # don't set size here as the
        self.colspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_cols)  # combination withe SetSelection fails
        val = self.value
        self.rowspin.SetValue(val and val[0] or 1)
        self.colspin.SetValue(val and val[1] or 1)
        self.rowspin.Enable(max_rows!=1)
        self.colspin.Enable(max_cols!=1)
        self.rowspin.SetSelection(-1, -1)
        self.colspin.SetSelection(-1, -1)

        # layout of the controls / sizers; when adding the spins, set min size as well
        hsizer.Add(wx.StaticText(panel, -1, _("Rows:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3)
        si = hsizer.Add(self.rowspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) )
        hsizer.Add(wx.StaticText(panel, -1, _("Cols:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3)
        hsizer.Add(self.colspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) )
        sizer.Add(hsizer, 0, wx.EXPAND)

        self._set_tooltip(label, self.rowspin, self.colspin)

        self.rowspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost
        self.colspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
        self.rowspin.Bind(wx.EVT_SET_FOCUS, self.on_focus)
        self.colspin.Bind(wx.EVT_SET_FOCUS, self.on_focus)
        if self.immediate:
            self.rowspin.Bind(wx.EVT_SPINCTRL, self.on_spin)
            self.rowspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin)   # we want the enter key (see style above)
            self.colspin.Bind(wx.EVT_SPINCTRL, self.on_spin)
            self.colspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin)
        self.editing = True 
Example #12
Source File: new_properties.py    From wxGlade with MIT License 5 votes vote down vote up
def create_spin_ctrl(self, panel):
        style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS
        spin = wx.SpinCtrlDouble( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] )
        spin.SetDigits(3)
        spin.SetValue(self.value)
        range_ = abs(self.val_range[1]-self.val_range[0])
        if range_<=1.0:
            spin.SetIncrement(0.1)
        else:
            spin.SetIncrement(1.0)
        return spin 
Example #13
Source File: new_properties.py    From wxGlade with MIT License 5 votes vote down vote up
def _create_spin_ctrl(self, panel):
        style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS
        self.spin = wx.SpinCtrl( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] )
        val = self.value
        if not val: self.spin.SetValue(1)  # needed for GTK to display a '0'
        self.spin.SetValue(val) 
Example #14
Source File: guicontrols.py    From wfuzz with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, interpreter):
        # begin wxGlade: MyFrame.__init__
        wx.Panel.__init__(self, parent, -1)

        self.history = []
        self.index = 0

        self.prompt = ">>"
        self.textctrl = wx.TextCtrl(self, -1, '', style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_RICH, size=(-1, 250))
        self.textctrl.SetForegroundColour(wx.WHITE)
        self.textctrl.SetBackgroundColour(wx.BLACK)

        self.textctrl.AppendText(self.prompt)

        self.textctrl.Bind(wx.EVT_CHAR, self.__bind_events)

        sizer = wx.BoxSizer()
        sizer.Add(self.textctrl, 1, wx.EXPAND)
        self.SetSizer(sizer)

        self._interp = interpreter
        redir = RedirectText(self.textctrl)

        import sys

        # Create a replacement for stdin.
        # self.reader = PseudoFileIn(self.readline, self.readlines)
        # self.reader.input = ''
        # self.reader.isreading = False

        # sys.stdin=self.reader
        sys.stdout = redir
        sys.stderr = redir 
Example #15
Source File: TextCtrlAutoComplete.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, choices=None, dropDownClick=True,
                 element_path=None, **therest):
        """
        Constructor works just like wx.TextCtrl except you can pass in a
        list of choices.  You can also change the choice list at any time
        by calling setChoices.
        """

        therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0)

        wx.TextCtrl.__init__(self, parent, **therest)

        # Some variables
        self._dropDownClick = dropDownClick
        self._lastinsertionpoint = None
        self._hasfocus = False

        self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
        self.element_path = element_path

        self.listbox = None

        self.SetChoices(choices)

        # gp = self
        # while ( gp != None ) :
        #    gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp )
        #    gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp )
        #    gp = gp.GetParent()

        self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT, self.OnEnteredText)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        # If need drop down on left click
        if dropDownClick:
            self.Bind(wx.EVT_LEFT_DOWN, self.OnClickToggleDown)
            self.Bind(wx.EVT_LEFT_UP, self.OnClickToggleUp) 
Example #16
Source File: LocationCellEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):
        wx.PyControl.__init__(self, parent)

        main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        # create location text control
        self.Location = wx.TextCtrl(self, size=wx.Size(0, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.Location.Bind(wx.EVT_KEY_DOWN, self.OnLocationChar)
        main_sizer.AddWindow(self.Location, flag=wx.GROW)

        # create browse button
        self.BrowseButton = wx.Button(self, label='...', size=wx.Size(30, -1))
        self.BrowseButton.Bind(wx.EVT_BUTTON, self.OnBrowseButtonClick)
        main_sizer.AddWindow(self.BrowseButton, flag=wx.GROW)

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSizer(main_sizer)

        self.Controller = None
        self.VarType = None
        self.Default = False
        self.VariableName = None 
Example #17
Source File: frame_connect.py    From bookhub with MIT License 5 votes vote down vote up
def LabelText(label, default_value, parent=None):
    return (wx.StaticText(parent, label=label),  # Label
            wx.TextCtrl(parent, size=(150, -1),  # Panel
                        value=default_value, style=wx.TE_PROCESS_ENTER)
            ) 
Example #18
Source File: misc.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, text, title, validateFunc = None):
        wx.Dialog.__init__(self, parent, -1, title,
                           style = wx.DEFAULT_DIALOG_STYLE | wx.WANTS_CHARS)

        # function to call to validate the input string on OK. can be
        # None, in which case it is not called. if it returns "", the
        # input is valid, otherwise the string it returns is displayed in
        # a message box and the dialog is not closed.
        self.validateFunc = validateFunc

        vsizer = wx.BoxSizer(wx.VERTICAL)

        vsizer.Add(wx.StaticText(self, -1, text), 1, wx.EXPAND | wx.BOTTOM, 5)

        self.tc = wx.TextCtrl(self, -1, style = wx.TE_PROCESS_ENTER)
        vsizer.Add(self.tc, 1, wx.EXPAND);

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

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        cancelBtn = gutil.createStockButton(self, "Cancel")
        hsizer.Add(cancelBtn)

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

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

        util.finishWindow(self, vsizer)

        wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
        wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)

        wx.EVT_TEXT_ENTER(self, self.tc.GetId(), self.OnOK)

        wx.EVT_CHAR(self.tc, self.OnCharEntry)
        wx.EVT_CHAR(cancelBtn, self.OnCharButton)
        wx.EVT_CHAR(okBtn, self.OnCharButton)

        self.tc.SetFocus() 
Example #19
Source File: CellEditor.py    From bookhub with MIT License 5 votes vote down vote up
def MakeAutoCompleteComboBox(olv, columnIndex, maxObjectsToConsider=10000):
    """
    Return a ComboBox that lets the user choose from all existing values in this column.
    Do not call for large lists
    """
    col = olv.columns[columnIndex]
    maxObjectsToConsider = min(maxObjectsToConsider, olv.GetItemCount())
    options = set(col.GetStringValue(olv.GetObjectAt(i)) for i in range(maxObjectsToConsider))
    cb = wx.ComboBox(olv, choices=list(options),
                     style=wx.CB_DROPDOWN|wx.CB_SORT|wx.TE_PROCESS_ENTER)
    AutoCompleteHelper(cb)
    return cb


#------------------------------------------------------------------------- 
Example #20
Source File: new_properties.py    From wxGlade with MIT License 4 votes vote down vote up
def create_spin_ctrl(self, panel):
        style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS
        spin = wx.SpinCtrl( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] )
        val = self.value
        if not val: spin.SetValue(1)  # needed for GTK to display a '0'
        spin.SetValue(val)
        spin.SetSelection(-1,-1)
        return spin 
Example #21
Source File: frame_merger.py    From iqiyi-parser with MIT License 4 votes vote down vote up
def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u'FFMPEG 输出窗口', pos=wx.DefaultPosition,
                           size=wx.Size(427, 450), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.Size(427, 381), wx.DefaultSize)
        self.SetBackgroundColour(wx.Colour(240, 240, 240))

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.textctrl_output = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(427, 381),
                                  wx.TE_AUTO_URL | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        self.textctrl_output.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "宋体"))

        self.staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)

        self.text_remain = wx.StaticText(self, wx.ID_ANY, u"估计还剩 00:00:00", wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_RIGHT)
        self.text_remain.Wrap(-1)

        self.gauge_progress = wx.Gauge(self, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL)
        self.gauge_progress.SetValue(0)

        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)

        self.text_percent = wx.StaticText(self, wx.ID_ANY, u"0.0%", wx.DefaultPosition, wx.DefaultSize, 0)
        self.text_percent.Wrap(-1)

        self.text_size = wx.StaticText(self, wx.ID_ANY, u"0kb", wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_RIGHT)
        self.text_size.Wrap(-1)

        sizer_1.Add(self.text_percent, 1, wx.ALL | wx.EXPAND, 2)
        sizer_1.Add(self.text_size, 1, wx.ALL | wx.EXPAND, 2)

        sizer.Add(self.textctrl_output, 1, wx.ALL | wx.EXPAND, 2)
        sizer.Add(self.staticline, 0, wx.EXPAND | wx.ALL, 5)
        sizer.Add(self.text_remain, 0, wx.ALL | wx.EXPAND, 2)
        sizer.Add(self.gauge_progress, 0, wx.ALL | wx.EXPAND, 2)
        sizer.Add(sizer_1, 0, wx.ALL | wx.EXPAND, 3)

        self.menu_bar = MergerMenuBar(0)
        self.SetMenuBar(self.menu_bar)


        self.SetSizer(sizer)
        self.Layout()

        self.Centre(wx.BOTH)

        self.textctrl_output.Connect(-1, -1, EVT_OUTPUT_APPEND, self.AppendText)
        self.gauge_progress.Connect(-1, -1, EVT_OUTPUT_UPDATE, self.update) 
Example #22
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, controler, position_column=False):
        wx.FlexGridSizer.__init__(self, cols=1, hgap=0, rows=2, vgap=5)
        self.AddGrowableCol(0)
        self.AddGrowableRow(1)

        self.Controler = controler
        self.PositionColumn = position_column

        self.VariablesFilter = wx.ComboBox(parent, style=wx.TE_PROCESS_ENTER)
        self.VariablesFilter.Bind(wx.EVT_COMBOBOX, self.OnVariablesFilterChanged)
        self.VariablesFilter.Bind(wx.EVT_TEXT_ENTER, self.OnVariablesFilterChanged)
        self.VariablesFilter.Bind(wx.EVT_CHAR, self.OnVariablesFilterKeyDown)
        self.AddWindow(self.VariablesFilter, flag=wx.GROW)

        self.VariablesGrid = wx.gizmos.TreeListCtrl(parent,
                                                    style=wx.TR_DEFAULT_STYLE |
                                                    wx.TR_ROW_LINES |
                                                    wx.TR_COLUMN_LINES |
                                                    wx.TR_HIDE_ROOT |
                                                    wx.TR_FULL_ROW_HIGHLIGHT)
        self.VariablesGrid.GetMainWindow().Bind(wx.EVT_LEFT_DOWN,
                                                self.OnVariablesGridLeftClick)
        self.AddWindow(self.VariablesGrid, flag=wx.GROW)

        self.Filters = []
        for desc, value in VARIABLES_FILTERS:
            self.VariablesFilter.Append(desc)
            self.Filters.append(value)

        self.VariablesFilter.SetSelection(0)
        self.CurrentFilter = self.Filters[0]
        self.VariablesFilterFirstCharacter = True

        if position_column:
            for colname, colsize, colalign in zip(GetVariablesTableColnames(position_column),
                                                  [40, 80, 350, 80, 100, 80, 150],
                                                  [wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT,
                                                   wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT,
                                                   wx.ALIGN_LEFT]):
                self.VariablesGrid.AddColumn(_(colname), colsize, colalign)
            self.VariablesGrid.SetMainColumn(2)
        else:
            for colname, colsize, colalign in zip(GetVariablesTableColnames(),
                                                  [40, 350, 80, 100, 80, 150],
                                                  [wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT,
                                                   wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]):
                self.VariablesGrid.AddColumn(_(colname), colsize, colalign)
            self.VariablesGrid.SetMainColumn(1) 
Example #23
Source File: DurationEditorDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title=_('Edit Duration'))

        CONTROLS = [
            ("Days", _('Days:')),
            ("Hours", _('Hours:')),
            ("Minutes", _('Minutes:')),
            ("Seconds", _('Seconds:')),
            ("Milliseconds", _('Milliseconds:')),
            ("Microseconds", _('Microseconds:')),
        ]

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        controls_sizer = wx.FlexGridSizer(cols=len(CONTROLS), hgap=10, rows=2, vgap=10)
        main_sizer.AddSizer(controls_sizer, border=20,
                            flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)

        controls = []
        for i, (name, label) in enumerate(CONTROLS):
            controls_sizer.AddGrowableCol(i)

            st = wx.StaticText(self, label=label)
            txtctrl = wx.TextCtrl(self, value='0', style=wx.TE_PROCESS_ENTER)
            self.Bind(wx.EVT_TEXT_ENTER,
                      self.GetControlValueTestFunction(txtctrl),
                      txtctrl)
            setattr(self, name, txtctrl)

            controls.append((st, txtctrl))

        for st, txtctrl in controls:
            controls_sizer.AddWindow(st, flag=wx.GROW)

        for st, txtctrl in controls:
            controls_sizer.AddWindow(txtctrl, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)
        self.Fit()
        self.Days.SetFocus()