我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.TE_MULTILINE。
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): wx.Panel.__init__(self, parent) imageFile = 'Tile.bmp' self.bmp = wx.Bitmap(imageFile) # react to a resize event and redraw image parent.Bind(wx.EVT_SIZE, self.canvasCallback) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
def __init__(self, parent): wx.Panel.__init__(self, parent) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
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 AddNewComment(self, bbox): dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), "", wx.OK | wx.CANCEL | wx.TE_MULTILINE) dialog.SetClientSize(wx.Size(400, 200)) if dialog.ShowModal() == wx.ID_OK: value = dialog.GetValue() id = self.GetNewId() comment = Comment(self, value, id) comment.SetPosition(bbox.x, bbox.y) min_width, min_height = comment.GetMinSize() comment.SetSize(*self.GetScaledSize(max(min_width, bbox.width), max(min_height, bbox.height))) self.AddComment(comment) self.Controler.AddEditedElementComment(self.TagName, id) self.RefreshCommentModel(comment) self.RefreshBuffer() self.RefreshScrollBars() self.RefreshVisibleElements() comment.Refresh() dialog.Destroy()
def EditCommentContent(self, comment): dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), comment.GetContent(), wx.OK | wx.CANCEL | wx.TE_MULTILINE) width, height = comment.GetSize() dialogSize = wx.Size(max(width + 30, 400), max(height + 60, 200)) dialog.SetClientSize(dialogSize) if dialog.ShowModal() == wx.ID_OK: value = dialog.GetValue() rect = comment.GetRedrawRect(1, 1) comment.SetContent(value) comment.SetSize(*self.GetScaledSize(*comment.GetSize())) rect = rect.Union(comment.GetRedrawRect()) self.RefreshCommentModel(comment) self.RefreshBuffer() self.RefreshScrollBars() self.RefreshVisibleElements() comment.Refresh(rect) dialog.Destroy() # ------------------------------------------------------------------------------- # Model update functions # -------------------------------------------------------------------------------
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 place(self, e): if not hasattr(self, "brackets"): errortext = "Make bracket before doing that" w = wx.MessageDialog(self.parent, errortext, "Error", wx.ICON_ERROR) w.ShowModal() w.Destroy() return placel = bracketfuncs.placing(self.brackets) d = wx.Dialog(None) d.SetTitle("Results") a = wx.TextCtrl(d, style=wx.TE_MULTILINE) a.SetEditable(False) ptxt = "" for p in placel: if not p.isbye(): ptxt += str(placel[p]) + ". " + p.tag + "\n" a.SetValue(ptxt) d.SetSize((250, 320)) d.Show(True)
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 __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) self.logger = logging.getLogger("wxApp") self.logger.info("Test from MyPanel __init__") logText = wx.TextCtrl( self, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) btn = wx.Button(self, label="Press Me") btn.Bind(wx.EVT_BUTTON, self.onPress) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(logText, 1, wx.EXPAND|wx.ALL, 5) sizer.Add(btn, 0, wx.ALL, 5) self.SetSizer(sizer) txtHandler = CustomConsoleHandler(logText) self.logger.addHandler(txtHandler)
def __init__(self): wx.Frame.__init__(self, None, title="wxPython Redirect Tutorial") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) btn = wx.Button(panel, wx.ID_ANY, 'Push me!') self.Bind(wx.EVT_BUTTON, self.onButton, btn) # Add widgets to a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer) # redirect text here redir = RedirectText(log) sys.stdout = redir
def __init__(self): wx.Frame.__init__(self, None, title="wxPython Redirect Tutorial") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style=style) btn = wx.Button(panel, wx.ID_ANY, 'Push me!') self.Bind(wx.EVT_BUTTON, self.onButton, btn) # Add widgets to a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer) # redirect text here sys.stdout = log
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) lbl = wx.StaticText(self, label="Enter text to copy to clipboard:") self.text = wx.TextCtrl(self, style=wx.TE_MULTILINE) copyBtn = wx.Button(self, label="Copy") copyBtn.Bind(wx.EVT_BUTTON, self.onCopy) copyFlushBtn = wx.Button(self, label="Copy and Flush") copyFlushBtn.Bind(wx.EVT_BUTTON, self.onCopyAndFlush) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 0, wx.ALL, 5) sizer.Add(self.text, 1, wx.EXPAND) sizer.Add(copyBtn, 0, wx.ALL|wx.CENTER, 5) sizer.Add(copyFlushBtn, 0, wx.ALL|wx.CENTER, 5) self.SetSizer(sizer)
def __init__(self, *args, **kwargs): super(Panel, self).__init__(*args, **kwargs) nb = wx.Notebook(self) self.version_panel = _LASSectionPanel(nb) self.well_panel = _LASSectionPanel(nb) self.curve_panel = _LASSectionPanel(nb) self.parameter_panel = _LASSectionPanel(nb) other_panel = wx.Panel(nb) self.other_textctrl = wx.TextCtrl(other_panel, -1, style=wx.TE_MULTILINE) box = wx.BoxSizer() box.Add(self.other_textctrl, 1, wx.EXPAND) other_panel.SetSizer(box) nb.AddPage(self.version_panel, "~VERSION INFORMATION") nb.AddPage(self.well_panel, "~WELL INFORMATION") nb.AddPage(self.curve_panel, "~CURVE INFORMATION") nb.AddPage(self.parameter_panel, "~PARAMETER INFORMATION") nb.AddPage(other_panel, "~OTHER INFORMATION") sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, *args, **kwds): # begin wxGlade: ChatFrameGui.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_2 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL) self.panel_1 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL) self.panel_3 = wx.Panel(self.panel_1, -1) self.panel_4 = wx.Panel(self.panel_1, -1) self.frmMain_statusbar = self.CreateStatusBar(1) self.lblIpAddress = wx.StaticText(self.panel_4, -1, "IP &Address") self.edtIPAddress = wx.TextCtrl(self.panel_4, -1, "127.0.0.1") self.spnConnectPort = wx.SpinCtrl(self.panel_4, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP) self.btnConnect = wx.ToggleButton(self.panel_4, -1, "&Connect") self.lblListenPort = wx.StaticText(self.panel_3, -1, "Listen &on port") self.spnListenPort = wx.SpinCtrl(self.panel_3, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP) self.btnListen = wx.ToggleButton(self.panel_3, -1, "Lis&ten") self.lblReceived = wx.StaticText(self.panel_1, -1, "Received") self.edtReceived = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL) self.lblSent = wx.StaticText(self.panel_1, -1, "Sent:") self.edtSent = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL) self.edtToSend = wx.TextCtrl(self.panel_2, -1, "") self.btnSend = wx.Button(self.panel_2, -1, "&Send") self.btnClose = wx.Button(self.panel_2, -1, "&Close") self.__set_properties() self.__do_layout() # end wxGlade
def addTextCtrl(self): boxSizerH = wx.BoxSizer(wx.HORIZONTAL) boxSizerH.Add(wx.TextCtrl(self.panel, size=(275, -1), style= wx.TE_MULTILINE)) self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL ) #----------------------------------------------------------
def __init__(self, parent): wx.Panel.__init__(self, parent) parent.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) button = wx.Button(self, label="Print", pos=(0,60)) self.Bind(wx.EVT_BUTTON, self.writeToSharedQueue, button) self.textBox = wx.TextCtrl(self, size=(280,50), style=wx.TE_MULTILINE) #-----------------------------------------------------------------
def __init__(self, title, pos, size): # Initialize some flags self.IsEtotRead = False wx.Frame.__init__(self, None, -1, title, pos, size) panel = wx.Panel(self, -1) panel.SetBackgroundColour("White") text = wx.TextCtrl(self, wx.ID_ANY, size=size, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 1, wx.EXPAND) self.SetSizer(sizer) self.Fit() self.Bind(wx.EVT_CLOSE, self.OnQuit) self.createMenuBar() self.CreateStatusBar() self.SetStatusText("Welcome to pyQHA") # Redirect stout to the TextCtrl in the main panel self.redir=RedirectText(text) sys.stdout=self.redir sys.stderr=self.redir ############################################################################ # # Menu functions #
def __init__(self, parent=None,id=-1,title="Checking Spelling..."): wx.Dialog.__init__(self, parent, id, title, size=wxSpellCheckerDialog.sz, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) self._numContext = 40 self._checker = None self._buttonsEnabled = True self.error_text = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH) self.replace_text = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER) self.replace_list = wx.ListBox(self, -1, style=wx.LB_SINGLE) self.InitLayout() wx.EVT_LISTBOX(self,self.replace_list.GetId(),self.OnReplSelect) wx.EVT_LISTBOX_DCLICK(self,self.replace_list.GetId(),self.OnReplace)
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, *args, **kwds): # begin wxGlade: Dialogo_texto.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.salida_texto = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.bnt_salida_ok = wx.Button(self, wx.ID_OK, "OK", style=wx.BU_BOTTOM) self.sizer_1_staticbox = wx.StaticBox(self, wx.ID_ANY, "Information") self.__set_properties() self.__do_layout() # end wxGlade
def __init__(self,parent): wx.TextCtrl.__init__(self,parent,-1,style = wx.TE_MULTILINE) sys.stdout = self self.Bind(EVT_PRINT, self.OnPrint)
def __init__(self, parent,ancestor): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Pipeline Comments:") title.SetToolTipNew("Pipeline Comments.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.txt = wx.TextCtrl(self, style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.txt.Enable(True) vbox.Add(self.txt, 1, wx.EXPAND | wx.ALL, 2) self.SetAutoLayout(True) self.SetSizer( vbox )
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, title='ImagePy TexLog'): wx.Frame.__init__(self, IPy.curapp,title=title,size=(500,300)) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.title = title TextLogManager.add(title, self) self.file='' ### Create menus (name:event) k-v pairs menus = [ ## File ('File(&F)',[('Open', self.OnOpen), ('Save', self.OnSave), ('Save as', self.OnSaveAs), ('-'), ('Exit', self.OnClose) ]), ## Edit ('Edit(&E)', [ ('Undo', self.OnUndo), ('Redo', self.OnRedo), ('-'), ('Cut', self.OnCut), ('Copy', self.OnCopy), ('Paste', self.OnPaste), ('-'), ('All', self.OnSelectAll) ]), ## Help ('Help(&H)', [('About', self.OnAbout)]) ] ### Bind menus with the corresponding events self.menuBar=wx.MenuBar() for menu in menus: m = wx.Menu() for item in menu[1]: if item[0]=='-': m.AppendSeparator() else: i = m.Append(-1, item[0]) self.Bind(wx.EVT_MENU,item[1], i) self.menuBar.Append(m,menu[0]) self.SetMenuBar(self.menuBar) self.Bind(wx.EVT_CLOSE, self.OnClosing) sizer = wx.BoxSizer( wx.VERTICAL ) self.text= wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) sizer.Add( self.text, 1, wx.ALL|wx.EXPAND, 1 ) self.SetSizer( sizer ) self.Bind(wx.EVT_RIGHT_DOWN,self.OnRClick)
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, *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) self.text_ctrl_output = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY) # Menu Bar self.frame_terminal_menubar = wx.MenuBar() self.SetMenuBar(self.frame_terminal_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_SETTINGS, "&Port Settings...", "", wx.ITEM_NORMAL) 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") # Menu Bar end self.__set_properties() self.__do_layout() # 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 __init__(self, parent): self.us_to_jp_map = {} self.monster_data = {} wx.Panel.__init__(self, parent) grid = wx.GridBagSizer(hgap=5, vgap=10) config = wx.ConfigBase.Get() host = config.Read("host") or socket.gethostbyname(socket.gethostname()) start_instructions = wx.StaticText(self, label="Just the first time, you need to add the HTTPS certificate to your iOS/Android device. To do this, go to your wifi settings and set up a manual HTTP proxy. Set the server to '%s' and the port to 8080. Then visit http://mitm.it in Safari/Chrome, click the link for your device, and install the configuration profile when asked. After this is done, turn off the HTTP proxy." % host) start_instructions.Wrap(580) grid.Add(start_instructions, pos=(0,0)) dns_instructions = wx.StaticText(self, label="To synchronize your box with padherder, enter your padherder username and password in Settings. Then go to your wifi settings and change your DNS server to '%s'. Then press the home button. If you switch to the DNS Proxy Log tab, you should see a bunch of log lines. Make sure Puzzle and Dragons is completely closed, and re-open it. Once you get in game, close PAD completely again and restore your DNS settings." % host) dns_instructions.Wrap(580) grid.Add(dns_instructions, pos=(1,0)) status_label = wx.StaticText(self, label="Status:") grid.Add(status_label, pos=(2,0)) self.status_ctrl = wx.TextCtrl(self, wx.ID_ANY, size=(400,300), style = wx.TE_MULTILINE|wx.TE_READONLY) self.Bind(custom_events.EVT_STATUS_EVENT, self.onStatusEvent) if not config.Read("username"): self.status_ctrl.AppendText("You need to set your padherder username in Settings\n") if not config.Read("password"): self.status_ctrl.AppendText("You need to set your padherder password in Settings\n") grid.Add(self.status_ctrl, pos=(3,0), span=(1,2)) if is_out_of_date(self): updateCtrl = HyperLinkCtrl(self, wx.ID_ANY, label="An updated version is available", URL="https://github.com/jgoldshlag/padherder_proxy") grid.Add(updateCtrl, pos=(4,0), span=(1,2)) self.SetSizer(grid)
def __init__(self, parent): wx.Panel.__init__(self, parent) self.Bind(custom_events.EVT_WX_LOG_EVENT, self.onLogEvent) self.log = wx.TextCtrl(self, wx.ID_ANY, size=(-1,500), style = wx.TE_MULTILINE|wx.TE_READONLY) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.log, 0, wx.EXPAND) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self)
def __init__(self, *args, **kwargs): super(Panel, self).__init__(*args, **kwargs) nb = wx.Notebook(self) self.version_panel = _ODTSectionPanel(nb) self.well_panel = _ODTSectionPanel(nb) self.curve_panel = _ODTSectionPanel(nb) self.parameter_panel = _ODTSectionPanel(nb) other_panel = wx.Panel(nb) self.other_textctrl = wx.TextCtrl(other_panel, -1, style=wx.TE_MULTILINE) box = wx.BoxSizer() box.Add(self.other_textctrl, 1, wx.EXPAND) other_panel.SetSizer(box) print '\nno panel', self.version_panel nb.AddPage(self.version_panel, "~VERSION INFORMATION") print '\nno panel' nb.AddPage(self.well_panel, "~WELL INFORMATION") nb.AddPage(self.curve_panel, "~CURVE INFORMATION") nb.AddPage(self.parameter_panel, "~PARAMETER INFORMATION") nb.AddPage(other_panel, "~OTHER INFORMATION") sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.EXPAND) self.SetSizer(sizer)
def _build(self): """ Building widgets and setting static widget data. """ parent = wx.Panel(self, -1) sizer0 = wx.BoxSizer(wx.VERTICAL) sizer0.Add(self._buildTopBar(parent), 0, wx.ALIGN_LEFT|wx.GROW, 5) splitter = wx.SplitterWindow(parent, -1) #- TOP PART --------------------------------------------------------# topParent = wx.Panel(splitter, -1) topSizer = wx.BoxSizer(wx.VERTICAL) self.treeCtrlItems = wx.TreeCtrl(topParent, -1, style = wx.TR_TWIST_BUTTONS|wx.TR_LINES_AT_ROOT|wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_MULTIPLE) topSizer.Add(self.treeCtrlItems, 1, wx.EXPAND, 5) topParent.SetAutoLayout( True ) topParent.SetSizer(topSizer ) topSizer.Fit(topParent) topSizer.SetSizeHints(topParent) #-------------------------------------------------------------------# #- BOTTOM PART -----------------------------------------------------# bottomParent = wx.Panel(splitter,-1) bottomSizer = wx.BoxSizer(wx.VERTICAL) self.txtCtrlLog=wx_StdoutLog(bottomParent, -1, "", size= wx.Size(-1, 10), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH) bottomSizer.Add(self.txtCtrlLog, 1, wx.EXPAND, 5) bottomParent.SetAutoLayout( True ) bottomParent.SetSizer(bottomSizer ) bottomSizer.Fit(bottomParent) bottomSizer.SetSizeHints(bottomParent) #-------------------------------------------------------------------# splitter.SplitHorizontally(topParent,bottomParent, -100) sizer0.Add(splitter, 1, wx.EXPAND|wx.ALIGN_CENTRE, 5) self.buttonClose = wx.Button(parent, -1, 'Close') # buttonClose sizer0.Add(self.buttonClose, 0, wx.ALIGN_CENTRE|wx.ALL, 5) parent.SetAutoLayout( True ) parent.SetSizer( sizer0 ) sizer0.Fit( parent) sizer0.SetSizeHints( parent)
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 UIinit(self): # UI????? bkg = wx.Panel(self) # ???? self.help_info = wx.Button(bkg, -1, u'????') # ???? self.show_all_course = wx.Button(bkg, -1, u'????') self.reset_course = wx.Button(bkg, -1, u'????') self.add_course = wx.Button(bkg, -1, u'????') self.exit_program = wx.Button(bkg, -1, u'? ?') self.course_calc = wx.Button(bkg, -1, u'????') self.content = (wx.TextCtrl(bkg, style=wx.TE_MULTILINE)) # ????? self.course_name = wx.TextCtrl(bkg, -1, u'????') self.course_credit = wx.TextCtrl(bkg, -1, u'??') self.course_grade = wx.TextCtrl(bkg, -1, u'??') self.course_optional = wx.CheckBox(bkg, -1, u'??') self.course_delete = wx.TextCtrl(bkg, -1, u'????') self.course_delete_button = wx.Button(bkg, -1, u'????') self.author = wx.StaticText(bkg,-1,'Created by James') box = wx.BoxSizer(wx.VERTICAL) box.Add(self.help_info, proportion=1, flag=wx.ALL, border=2) # ??????? box.Add(self.show_all_course, proportion=1, flag=wx.ALL, border=2) box.Add(self.course_calc, proportion=1, flag=wx.ALL, border=2) box.Add(self.reset_course, proportion=1, flag=wx.ALL, border=2) box.Add(self.exit_program, proportion=1, flag=wx.ALL, border=2) info_box = wx.BoxSizer(wx.HORIZONTAL) info_box.Add(self.course_name, proportion=5, flag=wx.Centre | wx.ALL, border=2) info_box.Add(self.course_credit, proportion=2, flag=wx.Centre | wx.ALL, border=2) info_box.Add(self.course_grade, proportion=2, flag=wx.Centre | wx.ALL, border=2) info_box.Add(self.course_optional, proportion=1, flag=wx.Centre | wx.ALL, border=2) info_box.Add(self.add_course, proportion=2, flag=wx.Centre | wx.ALL, border=2) delete_box = wx.BoxSizer(wx.HORIZONTAL) delete_box.Add(self.course_delete, proportion=4, flag=wx.Centre | wx.ALL, border=2) delete_box.Add(self.course_delete_button, proportion=2, flag=wx.Centre | wx.ALL, border=2) delete_box.Add(self.author,proportion = 2,flag = wx.TOP|wx.LEFT,border=20) right_box = wx.BoxSizer(wx.VERTICAL) right_box.Add(info_box, proportion=0, flag=wx.TOP | wx.ALL, border=2) right_box.Add(delete_box, proportion=0, flag=wx.TOP | wx.ALL, border=2) right_box.Add(self.content, proportion=10, flag=wx.EXPAND | wx.ALL, border=2) vbox = wx.BoxSizer(wx.HORIZONTAL) vbox.Add(box, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) vbox.Add(right_box, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) bkg.SetSizer(vbox)
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 __init__(self, parent): wx.Panel.__init__(self, parent, -1) # URL??? self.method_choice = wx.Choice(self, -1, size=(80, -1), choices=[u'GET', u'POST']) self.method_choice.SetSelection(0) self.url_text = wx.TextCtrl(self, -1) url_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "URL")) url_sizer.Add(self.method_choice, 0) url_sizer.Add(self.url_text, 1, wx.EXPAND | wx.LEFT, 2) # ?? self.post_params_text = wx.TextCtrl(self, -1, size=(-1, 150), style=wx.TE_MULTILINE | wx.HSCROLL) post_params_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Post Params"), wx.VERTICAL) post_params_sizer.Add(self.post_params_text, 1, wx.EXPAND | wx.TOP, 5) # ??? self.headers_text = wx.TextCtrl(self, -1, size=(-1, 150), style=wx.TE_MULTILINE | wx.HSCROLL) headers_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Headers")) headers_sizer.Add(self.headers_text, 1, wx.EXPAND) # ???? self.template_choice = wx.Choice(self, -1, size=(150, -1), choices=[]) template_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Template")) template_sizer.Add(self.template_choice, 1, wx.EXPAND) # ????????? self.slice_text = wx.TextCtrl(self, -1) slice_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response slice startswith")) slice_sizer.Add(self.slice_text, 1, wx.EXPAND) # ?? self.transform_button = wx.Button(self, -1, u'Only Transform', size=(130, 30)) self.request_transform_button = wx.Button(self, -1, u'Request And Transform', size=(170, 30)) button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add((0, 0), 1) button_sizer.Add(self.transform_button, 0) button_sizer.Add(self.request_transform_button, 0) main_box = wx.BoxSizer(wx.VERTICAL) main_box.Add(url_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(post_params_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(headers_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(template_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(slice_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(button_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.SetSizer(main_box) self.preload_templates() self.Bind(wx.EVT_BUTTON, self.on_request_transform_button_click, self.request_transform_button) self.Bind(wx.EVT_BUTTON, self.on_transform_button_click, self.transform_button)
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, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Plugins Tree", pos = wx.DefaultPosition, size = wx.Size( 452,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) ) bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) bSizer4 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Plugin Infomation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 ) bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 ) self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run ) self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select ) self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source ) self.plg = None self.load()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Tools Tree", pos = wx.DefaultPosition, size = wx.Size( 452,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) ) bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) bSizer4 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Tool Infomation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 ) bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 ) self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run ) self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select ) self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source ) self.plg = None self.load()
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