我们从Python开源项目中,提取了以下37个代码示例,用于说明如何使用wx.TE_READONLY。
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) BodySizer = wx.BoxSizer( wx.VERTICAL ) self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) TextCtrlSizer = wx.BoxSizer( wx.VERTICAL ) self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY ) TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 ) self.m_panel4.SetSizer( TextCtrlSizer ) self.m_panel4.Layout() TextCtrlSizer.Fit( self.m_panel4 ) BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( BodySizer ) self.Layout() self.Centre( wx.BOTH )
def __init__(self, parent,start): wx.Panel.__init__(self, parent, -1) self.start = start panel = wx.Panel(self, -1) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.NumTxtCtrl = wx.TextCtrl(self, -1, " ?v0.1.4", style = wx.TE_PROCESS_ENTER|wx.TE_READONLY) self.severule = wx.Button(self, -1, "" ,(20,20)) self.btnClear = wx.Button(self, -1, "?" ,(20,20)) self.btnParseURL = wx.Button(self, -1, "URL" ,(20,20)) self.btnParseContent = wx.Button(self, -1, "?" ,(20,20)) #sizer hbox2.Add(self.NumTxtCtrl,1, wx.EXPAND) hbox2.Add(self.severule,0, wx.EXPAND) hbox2.Add(self.btnClear,0, wx.EXPAND) hbox2.Add(self.btnParseURL,0, wx.EXPAND) hbox2.Add(self.btnParseContent,0, wx.EXPAND) self.SetSizer(hbox2) ##?¼ self.Bind(wx.EVT_BUTTON, self.start.OnRemoveCache, self.btnClear) self.Bind(wx.EVT_BUTTON, self.start.OnSeveResult, self.severule) self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseURL) self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseContent)
def initFileControls(self): fileSizer = wx.BoxSizer(orient=wx.VERTICAL) fileControlBox = widgets.ControlBox(self, label='Data File', orient=wx.VERTICAL) self.fileTextCtrl = wx.TextCtrl(self, value=str('SAMPLE DATA'), style=wx.TE_READONLY) self.fileBrowseButton = wx.Button(self, label='Browse') fileControlBox.Add(self.fileTextCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) fileControlBox.Add(self.fileBrowseButton, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) fileSizer.Add(fileControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(fileSizer, proportion=1, flag=wx.EXPAND)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) # ????? self.response_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE) response_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response")) response_sizer.Add(self.response_text, 1, wx.EXPAND) # ??????? self.doc_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) doc_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Document")) doc_sizer.Add(self.doc_text, 1, wx.EXPAND) main_box = wx.BoxSizer(wx.VERTICAL) main_box.Add(response_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(doc_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.SetSizer(main_box) self.response_text.Bind(wx.EVT_CHAR, self.on_key_down) self.doc_text.Bind(wx.EVT_CHAR, self.on_key_down)
def __init__(self, parent, info): wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) if parent and parent.GetIcon(): self.SetIcon(parent.GetIcon()) self.SetMinSize((400, 300)) close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) ctrl.SetValue(info.License) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(close) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10) sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) self.SetSizer(sizer) self.Layout() self.Show() self.SetEscapeId(close.GetId()) close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
def __init__(self, *args, **kwds): # begin wxGlade: disclaimer_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, wx.ID_ANY, ("Disclaimer")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP) self.button_disagree = wx.Button(self, wx.ID_ANY, ("Disagree")) self.button_agree = wx.Button(self, wx.ID_ANY, ("I agree")) self.text=''' This SOFTWARE PRODUCT is a an open source free software distributed with GPL 3 License. Your are free to modify it subject to the conditions laid in the license. It is also stated that the software is provided "as is" and "with all faults." THE developer makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and and suits your needs. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.''' self.__set_properties() self.__do_layout() self.agree=False self.Bind(wx.EVT_BUTTON, self.on_disagree, self.button_disagree) self.Bind(wx.EVT_BUTTON, self.on_agree, self.button_agree) # end wxGlade
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) file_drop_target = MyFileDropTarget(self) lbl = wx.StaticText(self, label="Drag some files here:") self.fileTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.VSCROLL|wx.TE_READONLY) """Associates a drop target with this window. If the window already has a drop target, it is deleted.""" self.fileTextCtrl.SetDropTarget(file_drop_target) """add label and filetextctrl to boxsiser object with positioioning parameters""" sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 0, wx.ALL, 5) sizer.Add(self.fileTextCtrl, 1, wx.EXPAND|wx.ALL, 5) self.SetSizer(sizer) #----------------------------------------------------------------------
def createWidgets(self): sizer = wx.GridSizer(3,3,5,5) self.SIM.gatherInfo() sizer.Add(wx.Size(0,0), 10, 1, wx.LEFT, 10) # Spacer sizer.Add(wxskinStaticText(self, -1, "Activated"), 1, wx.LEFT | wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "Tries left"), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN1"), 1, wx.LEFT, 10) if self.SIM.chv1_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv1_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN2"), 1, wx.LEFT, 10) if self.SIM.chv2_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv2_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) self.SetSizer(sizer) self.SetAutoLayout(1) sizer.Fit(self) sizer.Layout()
def __init__(self, parent): wx.Dialog.__init__(self, parent, title="FestEngine Log", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) main_sizer = wx.BoxSizer(wx.VERTICAL) self.text_ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) main_sizer.Add(self.text_ctrl, 1, wx.EXPAND) self.pending_messages = list() self.timer = wx.Timer() self.timer.Bind(wx.EVT_TIMER, self.append_pending_messages) self.timer.Start(500) self.SetSizer(main_sizer)
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL ) bSizer111 = wx.BoxSizer( wx.VERTICAL ) self.m_textCtrlDocument = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY ) bSizer111.Add( self.m_textCtrlDocument, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 ) self.SetSizer( bSizer111 ) self.Layout() bSizer111.Fit( self )
def __init__(self, parent): wx.Panel.__init__(self, parent) self.ancestor = parent self.filename = "" self.dirname = '.' self.vbox = wx.BoxSizer(wx.VERTICAL) self.log= wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) self.vbox.Add(self.log, 1, wx.EXPAND | wx.ALL, 2) self.vbox.AddSpacer(2) self.hbox_ent = wx.BoxSizer(wx.HORIZONTAL) self.hbox_ent.AddSpacer(20) self.font = self.ancestor.GetParent().font self.label = wx.StaticText(self, -1,"Log Entry:", style=wx.ALIGN_CENTRE_HORIZONTAL, size=(160,-1) ) self.label.SetFont(self.font) self.hbox_ent.Add( self.label, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 2) self.entry = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER) self.entry.SetFont(self.font) self.entry.SetValue("") if IsNotWX4(): self.entry.SetToolTipString("Enter comments into the log here.") else: self.entry.SetToolTip("Enter comments into the log here.") self.entry.Bind(wx.EVT_TEXT_ENTER, self.OnEnterComments) self.hbox_ent.Add( self.entry, 1, wx.EXPAND | wx.LEFT | wx.RIGHT) self.vbox.Add(self.hbox_ent, 0, wx.EXPAND) self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL) self.hbox_btn.AddSpacer(20) self.button_save =wx.Button(self, label="Save Log") self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save) self.hbox_btn.Add(self.button_save) self.button_clear =wx.Button(self, label="Clear Log") self.Bind(wx.EVT_BUTTON, self.OnClickClearButton, self.button_clear) self.hbox_btn.Add(self.button_clear) self.vbox.Add(self.hbox_btn, 0, wx.EXPAND) self.SetSizerAndFit(self.vbox) self.redir=RedirectText(self.log) sys.stdout=self.redir self.data_poll_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.UpdateLog, self.data_poll_timer)
def InitUI(self): self.panel = wx.Panel(self, wx.ID_ANY) self.textbox = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY) self.textbox.SetValue(self.log) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.textbox, 1, wx.ALL | wx.EXPAND, 5) self.panel.SetSizerAndFit(self.sizer) self.Center() self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, parent, info): wx.Dialog.__init__(self, parent, title=_("Credits"), size=(475, 320), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) if parent and parent.GetIcon(): self.SetIcon(parent.GetIcon()) self.SetMinSize((300, 200)) notebook = wx.Notebook(self) close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) close.SetDefault() developer = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) translators = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) developer.SetValue(u'\n'.join(info.Developers)) translators.SetValue(u'\n'.join(info.Translators)) notebook.AddPage(developer, text=_("Written by")) notebook.AddPage(translators, text=_("Translated by")) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(close) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 10) sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) self.SetSizer(sizer) self.Layout() self.Show() self.SetEscapeId(close.GetId()) close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
def __init__(self, app): # First, call the base class' __init__ method to create the frame wx.Frame.__init__(self, None, -1, "wxPython/Autobahn WebSocket Demo") self._app = app # Associate some events with methods of this class self.Bind(wx.EVT_MOVE, self.OnMove) # Add a panel and some controls to display the size and position panel = wx.Panel(self, -1) label1 = wx.StaticText(panel, -1, "WebSocket messages received:") label2 = wx.StaticText(panel, -1, "Window position:") self.sizeCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY) self.posCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY) self.panel = panel # Use some sizers for layout of the widgets sizer = wx.FlexGridSizer(2, 2, 5, 5) sizer.Add(label1) sizer.Add(self.sizeCtrl) sizer.Add(label2) sizer.Add(self.posCtrl) border = wx.BoxSizer() border.Add(sizer, 0, wx.ALL, 15) panel.SetSizerAndFit(border) self.Fit() # This method is called by the System when the window is moved, # because of the association above.
def __init__(self, *args, **kwds): # begin wxGlade: Institution.__init__ kwds["style"] = wx.CAPTION | wx.MAXIMIZE|wx.CLOSE_BOX | wx.MINIMIZE_BOX # | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "Institution Settings") self.label_2 = wx.StaticText(self, -1, "School Name") self.text_ctrl_5 = wx.TextCtrl(self, -1, "")#,style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_4 = wx.StaticText(self, -1, "School Code") self.text_ctrl_6 = wx.TextCtrl(self, -1, "")#,style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_6 = wx.StaticText(self, -1, "E-Mail") self.text_ctrl_1 = wx.TextCtrl(self, -1, "")#, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.label_7 = wx.StaticText(self, -1, "Phone") self.text_ctrl_2 = wx.TextCtrl(self, -1, "")#, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.label_8 = wx.StaticText(self, -1, "Place") self.text_ctrl_3 = wx.TextCtrl(self, -1, "")#, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.button_1 = wx.Button(self, -1, "Cancel") self.button_2 = wx.Button(self, -1, "Save") self.DB=db_operations() self.__set_properties() self.__do_layout() self.OnLoad() self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_1) self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_2) self.Bind(wx.EVT_TEXT, self.Ontext, self.text_ctrl_3) self.Bind(wx.EVT_BUTTON, self.OnCancel, self.button_1) self.Bind(wx.EVT_BUTTON, self.OnOk, self.button_2) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: Institution.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "Institution Settings") self.label_2 = wx.StaticText(self, -1, "School Name") self.text_ctrl_5 = wx.TextCtrl(self, -1, "",style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_4 = wx.StaticText(self, -1, "School Code") self.text_ctrl_6 = wx.TextCtrl(self, -1, "",style=wx.TE_READONLY)#wx.StaticText(self, -1, "") self.label_6 = wx.StaticText(self, -1, "E-Mail") self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER ) self.label_7 = wx.StaticText(self, -1, "Contact") self.text_ctrl_2 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER ) self.label_8 = wx.StaticText(self, -1, "DEO") self.text_ctrl_3 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER) self.button_1 = wx.Button(self, -1, "Cancel") self.button_2 = wx.Button(self, -1, "OK") self.DB=db_operations() self.__set_properties() self.__do_layout() self.OnLoad() self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_1) self.Bind(wx.EVT_TEXT, self.OnText, self.text_ctrl_2) self.Bind(wx.EVT_TEXT, self.Ontext, self.text_ctrl_3) self.Bind(wx.EVT_BUTTON, self.OnCancel, self.button_1) self.Bind(wx.EVT_BUTTON, self.OnOk, self.button_2) self.Bind(wx.EVT_CLOSE, self.OnClose) # end wxGlade
def __init__(self, *args, **kwds): self.serial = serial.Serial() self.serial.timeout = 0.5 # make sure that the alive event can be checked from time to time self.settings = TerminalSetup() # placeholder for the settings self.thread = None self.alive = threading.Event() # begin wxGlade: TerminalFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.frame_terminal_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_CLEAR, "&Clear", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVEAS, "&Save Text As...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_TERM, "&Terminal Settings...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_EXIT, "&Exit", "", wx.ITEM_NORMAL) self.frame_terminal_menubar.Append(wxglade_tmp_menu, "&File") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_RTS, "RTS", "", wx.ITEM_CHECK) wxglade_tmp_menu.Append(ID_DTR, "&DTR", "", wx.ITEM_CHECK) wxglade_tmp_menu.Append(ID_SETTINGS, "&Port Settings...", "", wx.ITEM_NORMAL) self.frame_terminal_menubar.Append(wxglade_tmp_menu, "Serial Port") self.SetMenuBar(self.frame_terminal_menubar) # Menu Bar end self.text_ctrl_output = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.OnClear, id=ID_CLEAR) self.Bind(wx.EVT_MENU, self.OnSaveAs, id=ID_SAVEAS) self.Bind(wx.EVT_MENU, self.OnTermSettings, id=ID_TERM) self.Bind(wx.EVT_MENU, self.OnExit, id=ID_EXIT) self.Bind(wx.EVT_MENU, self.OnRTS, id=ID_RTS) self.Bind(wx.EVT_MENU, self.OnDTR, id=ID_DTR) self.Bind(wx.EVT_MENU, self.OnPortSettings, id=ID_SETTINGS) # end wxGlade self.__attach_events() # register events self.OnPortSettings(None) # call setup dialog on startup, opens port if not self.alive.isSet(): self.Close()
def __init__(self, parent): wx.Panel.__init__(self, parent = parent) file_drop_target = FileDropTarget(self) lbl = wx.StaticText(self, label="Drag Transactions File here:") self.fileTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.VSCROLL|wx.TE_READONLY) self.fileTextCtrl.SetDropTarget(file_drop_target) button = wx.Button(self, label = "Process File") button.Bind(wx.EVT_LEFT_DOWN, self.process_file) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 1, wx.ALL, 5) sizer.Add(self.fileTextCtrl, 10, wx.EXPAND|wx.ALL, 10) sizer.Add(button, 1, wx.ALIGN_CENTER, 5) self.SetSizer(sizer) self.text = ""
def __init__(self, parent): style = wx.TE_MULTILINE | wx.TE_READONLY super(MyLog, self).__init__(parent, style=style) colour_menu = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENU) self.SetBackgroundColour(colour_menu)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) lbl = wx.StaticText(self, label="Drag some text here:") self.myTextCtrl = wx.TextCtrl( self, style=wx.TE_MULTILINE|wx.HSCROLL|wx.TE_READONLY) text_dt = MyTextDropTarget(self.myTextCtrl) self.myTextCtrl.SetDropTarget(text_dt) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.myTextCtrl, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) file_drop_target = MyFileDropTarget(self) lbl = wx.StaticText(self, label="Drag some files here:") self.fileTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.HSCROLL|wx.TE_READONLY) self.fileTextCtrl.SetDropTarget(file_drop_target) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 0, wx.ALL, 5) sizer.Add(self.fileTextCtrl, 1, wx.EXPAND|wx.ALL, 5) self.SetSizer(sizer)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False) # create and setup first set of widgets lbl = wx.StaticText(self, label="Drag some URLS from your browser here:") lbl.SetFont(font) self.dropText = wx.TextCtrl( self, size=(200,200), style=wx.TE_MULTILINE|wx.HSCROLL|wx.TE_READONLY) dt = MyURLDropTarget(self.dropText) self.dropText.SetDropTarget(dt) firstSizer = self.addWidgetsToSizer([lbl, self.dropText]) # create and setup second set of widgets lbl = wx.StaticText(self, label="Drag this URL to your browser:") lbl.SetFont(font) self.draggableURLText = wx.TextCtrl(self, value="http://www.mousevspython.com") self.draggableURLText.Bind(wx.EVT_MOTION, self.OnStartDrag) secondSizer = self.addWidgetsToSizer([lbl, self.draggableURLText]) # Add sizers to main sizer mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(firstSizer, 0, wx.EXPAND) mainSizer.Add(secondSizer, 0, wx.EXPAND) self.SetSizer(mainSizer)
def createLayout(self): """ Create widgets and lay them out """ choices = ["is.gd"] if bitlyFlag: choices.append("bit.ly") if tinyURLFlag: choices.append("tinyURL") choices.sort() # create the widgets self.URLCbo = wx.ComboBox(self, wx.ID_ANY, "is.gd", choices=choices, size=wx.DefaultSize, style=wx.CB_DROPDOWN) self.inputURLTxt = wx.TextCtrl(self, value="Paste long URL here") self.inputURLTxt.Bind(wx.EVT_SET_FOCUS, self.onFocus) self.outputURLTxt = wx.TextCtrl(self, style=wx.TE_READONLY) shortenBtn = wx.Button(self, label="Shorten URL") shortenBtn.Bind(wx.EVT_BUTTON, self.onShorten) copyBtn = wx.Button(self, label="Copy to Clipboard") copyBtn.Bind(wx.EVT_BUTTON, self.onCopy) # create the sizers mainSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) # layout the widgets mainSizer.Add(self.URLCbo, 0, wx.ALL, 5) mainSizer.Add(self.inputURLTxt, 0, wx.ALL|wx.EXPAND, 5) mainSizer.Add(self.outputURLTxt, 0, wx.ALL|wx.EXPAND, 5) btnSizer.Add(shortenBtn, 0, wx.ALL|wx.CENTER, 5) btnSizer.Add(copyBtn, 0, wx.ALL|wx.CENTER, 5) mainSizer.Add(btnSizer, 0, wx.ALL|wx.CENTER, 5) self.SetSizer(mainSizer)
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) ## add a button: theButton1 = wx.Button(self, label="Push Me") theButton1.Bind(wx.EVT_BUTTON, self.onButton) ## add a static text lable: label1 = wx.StaticText(self, label="Input Box:") ## add a text control: self.inTextControl = wx.TextCtrl(self) ## add another button: theButton2 = wx.Button(self, label="GetData") theButton2.Bind(wx.EVT_BUTTON, self.onGetData) ## add a static text lable: label2 = wx.StaticText(self, label="Output Box:") ## and another text control: self.outTextControl = wx.TextCtrl(self, style=wx.TE_READONLY) ## do the layout buttonSizer = wx.BoxSizer(wx.VERTICAL) buttonSizer.Add(theButton1, 0, wx.GROW | wx.ALL, 4) buttonSizer.Add(label1, 0, wx.ALIGN_LEFT | wx.TOP, 4) buttonSizer.Add(self.inTextControl, 0, wx.GROW | wx.ALL, 4) buttonSizer.Add((150, 10)) buttonSizer.Add(theButton2, 0, wx.GROW | wx.ALL, 4) buttonSizer.Add(label2, 0, wx.ALIGN_LEFT | wx.TOP, 4) buttonSizer.Add(self.outTextControl, 0, wx.GROW | wx.ALL, 4) ## need another sizer to get the horizonal placement right: mainSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add((1,1), 1) # stretchable space mainSizer.Add(buttonSizer, 0, wx.ALIGN_TOP) # the sizer with the buttons in it mainSizer.Add((1,1), 1) # stretchable space self.SetSizer(mainSizer)
def __init__(self, parent, sms): wxskinDialog.__init__(self, parent, -1, "SMS edit") self.SetAutoLayout(False) self.sms = sms # Main window resizer object sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.FlexGridSizer(4,1) self.smsLabel = wx.StaticText(self, -1, "Message Text (%d / 160)" % len(sms.message)) sizer.Add(self.smsLabel, 1, wx.ALIGN_CENTER | wx.ALL, 5) smsTextId = wx.NewId() self.smsText = wx.TextCtrl(self, smsTextId, sms.message, size=(300,100), style=wx.TE_MULTILINE | wx.TE_LINEWRAP, validator = pySIMvalidator(None, None, 160)) sizer.Add(self.smsText, 1, wx.ALIGN_CENTER | wx.ALL, 5) hsizer = wx.FlexGridSizer(2,3) label = wx.StaticText(self, -1, "Date: ") hsizer.Add(label, 1, wx.ALL, 5) label = wx.StaticText(self, -1, "From: ") hsizer.Add(label, 1, wx.ALL, 5) label = wx.StaticText(self, -1, "Status: ") hsizer.Add(label, 1, wx.ALL, 5) text = wx.TextCtrl(self, -1, self.sms.timestamp, style=wx.TE_READONLY) hsizer.Add(text, 1, wx.ALL, 5) self.numberCtrl = wx.TextCtrl(self, -1, self.sms.number, validator = pySIMvalidator("+*#pw0123456789", None, 20)) hsizer.Add(self.numberCtrl, 1, wx.ALL, 5) choiceList = ['Read', 'Unread', 'Deleted'] self.ch = wx.Choice(self, -1, (80, 50), choices = choiceList) for i in range(len(choiceList)): if sms.status == choiceList[i]: self.ch.SetSelection(i) break hsizer.Add(self.ch, 1, wx.ALL, 5) sizer.Add(hsizer, 1, wx.ALL, 5) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OK, "Save"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) sizer.Add(buttons, 1, wx.ALIGN_CENTER | wx.ALL, 5) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK) wx.EVT_TEXT(self.smsText, smsTextId, self.smsTextChange) self.SetAutoLayout(1); self.SetSizer(sizer) sizer.Fit(self) self.Layout()
def createWidgets(self): # Main window resizer object border = wx.BoxSizer(wx.VERTICAL) label = wxskinStaticText(self, -1, "Your old and new PIN must be exactly 4 digits in length.") border.Add(label, 1, wx.ALL, 10) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wxskinStaticText(self, -1, "Current PIN: ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) if self.SIM.chv1_enabled: self.textCtrlOldPin = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD) else: self.textCtrlOldPin = wx.TextCtrl(self, -1, '(Not set)', style=wx.TE_READONLY) fgs.Add(self.textCtrlOldPin, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wxskinStaticText(self, -1, "New PIN: ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.textCtrlNewPin1 = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD) fgs.Add(self.textCtrlNewPin1, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wxskinStaticText(self, -1, "New PIN (verify): ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.textCtrlNewPin2 = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD) fgs.Add(self.textCtrlNewPin2, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) border.Add(buttons, 1, wx.ALL) wx.EVT_BUTTON(self, ID_BUTTON_CHANGE_PIN, self.onOK) self.SetAutoLayout(1); self.SetSizer(border) border.Fit(self) self.Layout()
def initMessageArea(self): """Initialize the message log area. """ # font for messages msgFont = wx.Font(pointSize=11, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False) # font for CEBL introduction message helloFont = wx.Font(pointSize=24, family=wx.FONTFAMILY_ROMAN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD, underline=True) # the message log messageControlBox = widgets.ControlBox(self.scrolledPanel, label='Message Log', orient=wx.VERTICAL) self.messageArea = wx.TextCtrl(self.scrolledPanel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH) self.messageArea.SetMinSize((150,150)) messageControlBox.Add(self.messageArea, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) # intro message self.messageArea.SetDefaultStyle( #wx.TextAttr(colText=wx.Colour('black'), font=helloFont)) # wxpython3 wx.TextAttr(font=helloFont)) self.messageArea.AppendText('Welcome to CEBL!\n\n') # setup message style self.messageArea.SetDefaultStyle(wx.TextAttr()) #self.messageArea.SetDefaultStyle(wx.TextAttr(colText=wx.Colour('black'), font=msgFont)) # wxpython3 self.messageArea.SetDefaultStyle(wx.TextAttr(font=msgFont)) # add the message area text ctrl widget as a log target self.mgr.logger.addTextCtrl(self.messageArea) messageControlSizer = wx.BoxSizer(orient=wx.HORIZONTAL) # button for saving the message log to a file self.saveMessagesButton = wx.Button(self.scrolledPanel, label='Save') messageControlSizer.Add(self.saveMessagesButton, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT, border=10) self.Bind(wx.EVT_BUTTON, self.saveMessages, self.saveMessagesButton) # button for clearing the message log self.clearMessagesButton = wx.Button(self.scrolledPanel, label='Clear') messageControlSizer.Add(self.clearMessagesButton, proportion=0, flag=wx.BOTTOM | wx.RIGHT, border=10) self.Bind(wx.EVT_BUTTON, self.clearMessages, self.clearMessagesButton) # set up verbose logging self.verboseMessagesCheckBox = wx.CheckBox(self.scrolledPanel, label='Verbose') messageControlSizer.Add(self.verboseMessagesCheckBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT, border=10) messageControlBox.Add(messageControlSizer, proportion=0, flag=wx.EXPAND) # sizer for message log area self.messageSizer = wx.BoxSizer(orient=wx.VERTICAL) self.messageSizer.Add(messageControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
def __init__(self, parent, raw_header_str, caption, pos=wx.DefaultPosition, size=(500,300), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): self.parent = parent wx.Dialog.__init__(self, parent, -1, caption, pos, size, style) x, y = pos if x == -1 and y == -1: self.CenterOnScreen(wx.BOTH) self.cur_selection = (0, 0) self.raw_header_str = raw_header_str self.raw_header_str_lower = raw_header_str.lower() self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY) font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False) self.text.SetFont(font1) self.text.SetInitialSize((600,400)) main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5) ok = wx.Button(self, wx.ID_OK, "OK") ok.SetDefault() ok.Bind(wx.EVT_BUTTON, self.on_close) buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER) self.search.ShowSearchButton(True) self.search.ShowCancelButton(True) # TODO: make layout of search & OK button prettier (OK should be right-aligned properly) buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND) buttons_sizer.Add((315, 0), 1, wx.EXPAND) buttons_sizer.Add(ok, 0, wx.ALL) main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4) self.SetSizerAndFit(main_sizer) self.set_cur_selection() self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search) self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search) self.last_search_str = '' self.last_find_index = 0 self.is_dialog_still_open = True self.Bind(wx.EVT_CLOSE, self.on_close) new_id = wx.NewId() self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id) self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
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, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.Size( 800,512 ), style = wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) Sizer = wx.BoxSizer( wx.VERTICAL ) self.Panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) SizerC1 = wx.BoxSizer( wx.VERTICAL ) SizerText = wx.BoxSizer( wx.VERTICAL ) self.AppName = wx.StaticText( self.Panel, wx.ID_ANY, u"Turrican 2 Editor", wx.DefaultPosition, wx.DefaultSize, 0 ) self.AppName.Wrap( -1 ) self.AppName.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) ) SizerText.Add( self.AppName, 0, wx.LEFT|wx.RIGHT|wx.TOP, 8 ) self.AppVersion = wx.StaticText( self.Panel, wx.ID_ANY, u"Version 1.0.2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.AppVersion.Wrap( -1 ) SizerText.Add( self.AppVersion, 0, wx.BOTTOM|wx.LEFT|wx.RIGHT, 8 ) self.License = wx.TextCtrl( self.Panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY|wx.NO_BORDER ) self.License.SetFont( wx.Font( 9, 75, 90, 90, False, "Courier New" ) ) self.License.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) SizerText.Add( self.License, 1, wx.ALL|wx.EXPAND, 8 ) SizerC1.Add( SizerText, 1, wx.EXPAND, 5 ) SizerButton = wx.BoxSizer( wx.HORIZONTAL ) SizerButton.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.Ok = wx.Button( self.Panel, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 ) self.Ok.SetDefault() SizerButton.Add( self.Ok, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) SizerC1.Add( SizerButton, 0, wx.EXPAND, 5 ) self.Panel.SetSizer( SizerC1 ) self.Panel.Layout() SizerC1.Fit( self.Panel ) Sizer.Add( self.Panel, 1, wx.EXPAND |wx.ALL, 8 ) self.SetSizer( Sizer ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.Ok.Bind( wx.EVT_BUTTON, self.ok )
def GenerateSearchResultsTreeBranch(self, root, infos): to_delete = [] if infos["name"] == "body": item_name = "%d:" % infos["data"][1][0] else: item_name = infos["name"] self.SearchResultsTree.SetItemText(root, item_name) self.SearchResultsTree.SetPyData(root, infos["data"]) self.SearchResultsTree.SetItemBackgroundColour(root, wx.WHITE) self.SearchResultsTree.SetItemTextColour(root, wx.BLACK) if infos["type"] is not None: if infos["type"] == ITEM_POU: self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[self.ParentWindow.Controler.GetPouType(infos["name"])]) else: self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[infos["type"]]) text = None if infos["text"] is not None: text = infos["text"] start, end = infos["data"][1:3] text_lines = infos["text"].splitlines() start_idx = start[1] end_idx = reduce(lambda x, y: x + y, map(lambda x: len(x) + 1, text_lines[:end[0] - start[0]]), end[1] + 1) style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247)) elif infos["type"] is not None and infos["matches"] > 1: text = _("(%d matches)") % infos["matches"] start_idx, end_idx = 0, len(text) style = wx.TextAttr(wx.Colour(0, 127, 174)) if text is not None: text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2 if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1: text_ctrl_style |= wx.TE_MULTILINE text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0), value=text, style=text_ctrl_style) width, height = text_ctrl.GetTextExtent(text) text_ctrl.SetClientSize(wx.Size(width + 1, height)) text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour()) text_ctrl.Bind(wx.EVT_LEFT_DOWN, self.GetTextCtrlClickFunction(root)) text_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.GetTextCtrlDClickFunction(root)) text_ctrl.SetInsertionPoint(0) text_ctrl.SetStyle(start_idx, end_idx, style) self.SearchResultsTree.SetItemWindow(root, text_ctrl) if wx.VERSION >= (2, 6, 0): item, root_cookie = self.SearchResultsTree.GetFirstChild(root) else: item, root_cookie = self.SearchResultsTree.GetFirstChild(root, 0) for child in infos["children"]: if item is None: item = self.SearchResultsTree.AppendItem(root, "") item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie) self.GenerateSearchResultsTreeBranch(item, child) item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0) self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY) self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, _("Warning: Always backup your database before you proceed to avoid potential data loss !!!")) self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("This software does not save Sampoorna credentials. It is used for one time login")) self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Username")) self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Password")) self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER) self.button_next = wx.Button(self.panel_login, wx.ID_ANY, _("Next >>")) self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("8 Standard")) self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("9 Standard")) self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("10 Standard")) self.button_next_copy_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("<<Previous")) self.button_next_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("Proceed >>")) self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, _("Progress")) self.progresss_total = wx.TextCtrl(self.panel_2, wx.ID_ANY, "") self.progress_each = wx.TextCtrl(self.panel_2, wx.ID_ANY, "") self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, _("Status")) self.text_ctrl_1 = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER) self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, _("Finished")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT_ENTER, self.on_password_enter, self.text_ctrl_passw) self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10) self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_next_copy_copy) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_next_copy) self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Dialog.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0) self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY) self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, ("Warning: Always backup your database before you proceed to avoid potential data loss !!!")) self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, ("This software does not save Sampoorna credentials. It is used for one time login")) self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Username")) self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Password")) self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER) self.button_next = wx.Button(self.panel_login, wx.ID_ANY, ("Next >>")) self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("8 Standard")) self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("9 Standard")) self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("10 Standard")) self.button_previous = wx.Button(self.standard_pane, wx.ID_ANY, ("<<Previous")) self.button_proceed = wx.Button(self.standard_pane, wx.ID_ANY, ("Proceed >>")) self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, ("Progress")) self.progresss_total = wx.Gauge(self.panel_2, wx.ID_ANY, range=100) self.label_progress_perc = wx.StaticText(self.panel_2, wx.ID_ANY, ("")) self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, ("Status")) #self.list_ctrl_1 = wx.ListCtrl(self.panel_2, wx.ID_ANY, style=wx.LC_REPORT | wx.LC_ALIGN_LEFT | wx.SUNKEN_BORDER | wx.NO_BORDER) self.text_ctrl_report = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER) self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, ("Abort")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_passw) self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_user) self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10) self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_previous) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished) # create a pubsub receiver Publisher().subscribe(self.update_display, "update") Publisher().subscribe(self.final_report, "report") Publisher().subscribe(self.update_progress_bar, "progress_bar") Publisher().subscribe(self.update_current_class, "change_class") # end wxGlade
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_TFRAME, name='TFrame', parent=prnt, pos=wx.Point(254, 241), size=wx.Size(829, 786), style=wx.DEFAULT_FRAME_STYLE, title=u'PAWS Terminal') self._init_utils() self.SetClientSize(wx.Size(821, 748)) self.SetMenuBar(self.TMenuBar) self.SetAutoLayout(True) self.SetToolTipString('TFrame') self.SetMinSize(wx.Size(-1, 21)) self.TStatusBar = wx.StatusBar(id=wxID_TFRAMETSTATUSBAR, name='TStatusBar', parent=self, style=0) self.TStatusBar.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False, u'Courier New')) self._init_coll_TStatusBar_Fields(self.TStatusBar) self.SetStatusBar(self.TStatusBar) self.TInput = wx.TextCtrl(id=wxID_TFRAMETINPUT, name='TInput', parent=self, pos=wx.Point(1, 728), size=wx.Size(819, 20), style=wx.SIMPLE_BORDER | wx.TE_PROCESS_ENTER, value="''") self.TInput.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False, u'Courier')) self.TInput.SetToolTipString(u'Type command here.') self.TInput.SetAutoLayout(False) self.TInput.SetEditable(True) self.TInput.Enable(False) self.TInput.Bind(wx.EVT_TEXT_ENTER, self.OnTInputTextEnter, id=wxID_TFRAMETINPUT) self.TDisplay = wx.TextCtrl(id=wxID_TFRAMETDISPLAY, name='TDisplay', parent=self, pos=wx.Point(0, 0), size=wx.Size(821, 728), style=wx.TE_RICH2 | wx.TE_MULTILINE | wx.TE_READONLY, value=u'To run a game, choose File ? Pick Game … then choose a game from the list.') self.TDisplay.SetMinSize(wx.Size(517, 440)) self.TDisplay.SetEditable(False) self.TDisplay.SetToolTipString(u"Game's output displays here.") self.TDisplay.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial')) self.TDisplay.Enable(True) self._init_sizers()