def MakeLogWindow(self, container): log = wx.TextCtrl(container, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) wx.Log_SetActiveTarget(wx.LogTextCtrl(log)) wx.LogMessage('window handle: %s' % self.GetHandle()) return log
def __init__(self, parent, manager): wx.Panel.__init__(self, parent) cmdrui.ControllerHandler.__init__(self) sizer = wx.BoxSizer(wx.VERTICAL) self.textCtrl = wx.TextCtrl(self, \ style = wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) sizer.Add(self.textCtrl, 0, wx.EXPAND) self.listBox = wx.ListBox(self, style=wx.LB_SINGLE) sizer.Add(self.listBox, 1, wx.EXPAND) if 0: self.logWnd = wx.TextCtrl(self, size=(0, 150), style=wx.TE_MULTILINE) wx.Log_SetActiveTarget(wx.LogTextCtrl(self.logWnd)) sizer.Add(self.logWnd, 1, wx.EXPAND) font = self.textCtrl.GetFont() font.SetPointSize(14) self.textCtrl.SetFont(font) self.listBox.SetFont(font) self.SetSizer(sizer) sizer.SetSizeHints(self)
def _create_log_view(self): self._log = wx.TextCtrl(self.main_panel, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) wx.Log_SetActiveTarget(wx.LogTextCtrl(self._log)) pass
def main(): conn, cur = check_and_setup() if len(sys.argv) == 1: # no args, use curdir target_files = None else: target_files = sys.argv[1:] if (target_files is None): # use cwd as target_files files_with_data, files_wo_data = process_dir(u'.', conn, cur) else: files_with_data = [] files_wo_data = [] #target_files should be in cwd #make all target_files non_absolute for i in range(len(target_files)): target_files[i] = unicode(os.path.basename(target_files[i]), 'utf-8') for fil in target_files: if os.path.isdir(fil): f_with, f_wo = process_dir(fil, conn, cur) files_with_data.extend(f_with) files_wo_data.extend(f_wo) else: if is_movie_file(fil): if is_in_db(conn, cur, fil): files_with_data.append(fil) else: files_wo_data.append(fil) print 'files_with_data', files_with_data print 'files_wo_data', files_wo_data #spawn threads if (config.platform == 'windows' and config.config['debug']): app = wx.App(redirect=True) else: app = wx.App(redirect=False) if (not config.config['debug']): wx.Log_SetActiveTarget(wx.LogStderr()) frame = MyFrame(None, conn, cur) check_for_updates(frame) app.SetTopWindow(frame) frame.Maximize() for f in files_with_data: frame.add_row(f) if len(files_wo_data) > 0: start_dbbuilder(frame, files_wo_data) frame.Show() frame.Layout() app.MainLoop()
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) wx.InitAllImageHandlers() frame = MainFrame(None) frame.Show(True) self.SetTopWindow(frame) return True
def OnInit(self): try: self.SetAppName('nsqrCommander') global appDataFolder appDataFolder = '../data/' cmdr.Manager.commandsFolder = './cmdr/commands/' sys.stdout = MsgRedirector() sys.stderr = ErrorRedirector() ui.logWindow = wx.Frame(None, -1, 'pepper - Log Window') ui.logWindow.Bind(wx.EVT_CLOSE, self.__onClosingLogWindow) logWnd = wx.TextCtrl(ui.logWindow, size=(0, 150), style=wx.TE_MULTILINE) wx.Log_SetActiveTarget(wx.LogTextCtrl(logWnd)) ui.logWindow.SetSize((600, 400)) ui.logWindow.Show() print 'log window is activated' self.__tbIcon = wx.TaskBarIcon() iconFile = appDataFolder + 'app_icon.ico' icon = wx.Icon(iconFile, wx.BITMAP_TYPE_ICO) if not self.__tbIcon.SetIcon(icon, 'nsqrCommander'): print 'Could not set icon.' self.Bind(wx.EVT_TASKBAR_LEFT_UP, self.__onEvtTaskbarLeftUp) self.__frame = SimplePanelFrame() self.__frame.Hide() except: self.__frame = wx.Frame(None, -1, 'FAILED!') logWnd = wx.TextCtrl(self.__frame, size=(0, 150), style=wx.TE_MULTILINE) wx.Log_SetActiveTarget(wx.LogTextCtrl(logWnd)) #nsqrPy.printException() self.__frame.Show() if self.__frame: self.SetTopWindow(self.__frame) return True
def LogBottom(parent, log): """Show log at the bottom""" parent.menu_options.Check(parent.mnuLogBottomID, 1) parent.text_ctrl_log = log parent.text_ctrl_log.Reparent(parent.splitter) wx.Log_SetActiveTarget(MyLog(parent.text_ctrl_log)) parent.splitter.SplitHorizontally(parent.nb, parent.text_ctrl_log, 400) parent.splitter.SetMinimumPaneSize(20) parent.text_ctrl_log.Show(True) parent.pref['log'] = 'bottom'
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) # wx.Log_SetActiveTarget(wx.LogBuffer()) self.SetAppName(appconstants.AppName) self.SetVendorName(appconstants.VendorName) frame = mainframe.HPPFrame(parent=None) title = appconstants.AppTitle + ' - ' + appconstants.AppVersion frame.SetTitle(title) self.SetTopWindow(frame) frame.Show(True) return True
def main(): init_path() init_logging() import wx import ipc import controller container, message = ipc.init() if not container: return app = wx.PySimpleApp() #redirect=True, filename='log.txt') wx.Log_SetActiveTarget(wx.LogStderr()) ctrl = controller.Controller() container.callback = ctrl.parse_args container(message) app.MainLoop()
def __init__(self, parent, id=-1): wx.Notebook.__init__(self, parent, id, style=wx.NB_TOP) # Set up a log on the View Log Notebook page self.log = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) wx.Log_SetActiveTarget(MyLog(self.log)) self.AddPage(self.log, "Log") self.shell = py.shell.Shell(self, -1, introText="MoM Shell") self.AddPage(self.shell, "Shell")
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) self.SetAssertMode(assertMode) # Resolve resource locations ed_glob.CONFIG['CONFIG_DIR'] = self.curr_dir ed_glob.CONFIG['INSTALL_DIR'] = self.curr_dir ed_glob.CONFIG['KEYPROF_DIR'] = os.path.join(self.curr_dir, u"ekeys") ed_glob.CONFIG['SYSPIX_DIR'] = os.path.join(self.curr_dir, u"pixmaps") ed_glob.CONFIG['PLUGIN_DIR'] = os.path.join(self.curr_dir, u"plugins") ed_glob.CONFIG['THEME_DIR'] = os.path.join(self.curr_dir, u"pixmaps", u"theme") ed_glob.CONFIG['LANG_DIR'] = os.path.join(self.curr_dir, u"locale") ed_glob.CONFIG['STYLES_DIR'] = os.path.join(self.curr_dir, u"styles") ed_glob.CONFIG['SYS_PLUGIN_DIR'] = os.path.join( self.curr_dir, u"plugins") ed_glob.CONFIG['SYS_STYLES_DIR'] = os.path.join( self.curr_dir, u"styles") ed_glob.CONFIG['TEST_DIR'] = os.path.join(self.curr_dir, u"tests", u"syntax") ed_glob.CONFIG['ISLOCAL'] = True ed_glob.CONFIG['PROFILE_DIR'] = os.path.join(self.curr_dir, u"profiles") ed_glob.CONFIG['GLOBAL_PROFILE_DIR'] = os.path.join( self.curr_dir, u"profiles") Deca.CreateWorld() profiler.TheProfile.Load( os.path.join(ed_glob.CONFIG['PROFILE_DIR'], "default.ppb")) profiler.TheProfile.Update() self._pluginmgr = plugin.PluginManager() self.ReloadTranslation() ogl.OGLInitialize() frame = PyAUIFrame(None, _("Sampo Framework"), size=(750, 570)) frame.Show(True) self.SetTopWindow(frame) self.frame = frame return True
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) self.frame = wx.Frame(None, -1, "test1", pos=(50, 50), size=(200, 100), style=wx.DEFAULT_FRAME_STYLE, name="test2") self.frame.Show() self.SetTopWindow(self.frame) self.panel1 = TestPanel(self.frame, Log()) self.frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame) self.frame.Show(True) self.frame.SetSize((640, 480)) return True
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) self.SetAssertMode(wx.PYAPP_ASSERT_DIALOG) frame = wx.Frame(None, -1, self.name, pos=(50, 50), size=(640, 480), style=wx.DEFAULT_FRAME_STYLE) frame.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() item = menu.Append(-1, "E&xit\tAlt-X", "Exit demo") self.Bind(wx.EVT_MENU, self.OnExitApp, item) menuBar.Append(menu, "&File") frame.SetMenuBar(menuBar) frame.Show(True) frame.SetSize((640, 480)) win = CubeCanvas(frame) win.SetFocus() self.SetTopWindow(frame) self.frame = frame return True
def __init__(self, parent, menuData, size=None, pos=None): wx.Frame.__init__(self, parent, -1, "GeniControl", size=size, pos=pos) self.initStatusBar() createMenuBar(self, menuData) self.locale = None #self.updateLanguage(wx.LANGUAGE_ITALIAN) ## ## self.log = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) ## if wx.Platform == "__WXMAC__": ## self.log.MacCheckSpelling(False) ## # Set the wxWindows log target to be this textctrl #wx.Log_SetActiveTarget(wx.LogTextCtrl(self.log)) # for serious debugging wx.Log_SetActiveTarget(wx.LogStderr()) #wx.Log_SetTraceMask(wx.TraceMessages self.notebook = TestNB(self, wx.NewId()) if not pos: self.Center()
def OnInit(self): wx.Log_SetActiveTarget(wx.LogStderr()) self.SetAssertMode(assertMode) self.InitInspection() # for the InspectionMixin base class frame = wx.Frame(None, -1, "RunDemo: " + self.name, pos=(50, 50), size=(200, 100), style=wx.DEFAULT_FRAME_STYLE, name="run a sample") frame.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() item = menu.Append(-1, "&Widget Inspector\tF6", "Show the wxPython Widget Inspection Tool") self.Bind(wx.EVT_MENU, self.OnWidgetInspector, item) item = menu.Append(-1, "E&xit\tCtrl-Q", "Exit demo") self.Bind(wx.EVT_MENU, self.OnExitApp, item) menuBar.Append(menu, "&File") ns = {} ns['wx'] = wx ns['app'] = self ns['module'] = self.demoModule ns['frame'] = frame frame.SetMenuBar(menuBar) frame.Show(True) frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame) win = self.demoModule.runTest(frame, frame, Log()) # a window will be returned if the demo does not create # its own top-level window if win: # so set the frame to a good size for showing stuff frame.SetSize((640, 480)) win.SetFocus() self.window = win ns['win'] = win frect = frame.GetRect() else: # It was probably a dialog or something that is already # gone, so we're done. frame.Destroy() return True self.SetTopWindow(frame) self.frame = frame #wx.Log_SetActiveTarget(wx.LogStderr()) #wx.Log_SetTraceMask(wx.TraceMessages) if self.useShell: # Make a PyShell window, and position it below our test window from wx import py shell = py.shell.ShellFrame(None, locals=ns) frect.OffsetXY(0, frect.height) frect.height = 400 shell.SetRect(frect) shell.Show() # Hook the close event of the test window so that we close # the shell at the same time def CloseShell(evt): if shell: shell.Close() evt.Skip() frame.Bind(wx.EVT_CLOSE, CloseShell) return True
def __init__(self, parent): # Variables ------------------------------------------------------------ self.log_switch = False # When log lenght is reached self.log_lenght = 33 # Lenght of log entries to show # self.isrunning = False # Bool switch for RUN self.findData = wx.FindReplaceData() self.threads = [] self.emailData = None # Email Settings Dialog Data Dict self.eventCount = 0 self.logData = None self.cmdData = None # ---------------------------------------------------------------------- wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=__application__ + " " + __version__, pos=wx.DefaultPosition, size=wx.Size(640, 800), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) # Menu bar ------------------------------------------------------------- self.menubar = wx.MenuBar(0) self.menu_dir = wx.Menu() # Directory self.menu_log = wx.Menu() # Log self.menu_pref = wx.Menu() # Preferences self.menu_about = wx.Menu() # About # Menu Directory > Add self.mnuAddDir = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Add", wx.EmptyString, wx.ITEM_NORMAL) self.menu_dir.AppendItem(self.mnuAddDir) # Menu Directory > Remove self.mnuRemDir = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Remove", wx.EmptyString, wx.ITEM_NORMAL) self.menu_dir.AppendItem(self.mnuRemDir) # Menu Log > Clear self.mnuLogClear = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Clear", wx.EmptyString, wx.ITEM_NORMAL) self.menu_log.AppendItem(self.mnuLogClear) # Menu Log > Save self.mnuLogSave = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Save", wx.EmptyString, wx.ITEM_NORMAL) self.menu_log.AppendItem(self.mnuLogSave) # Menu Log > Load self.mnuLogLoad = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Load", wx.EmptyString, wx.ITEM_NORMAL) self.menu_log.AppendItem(self.mnuLogLoad) # Menu Log > Find self.mnuLogFind = wx.MenuItem(self.menu_dir, wx.ID_ANY, u"Find", wx.EmptyString, wx.ITEM_NORMAL) self.menu_log.AppendItem(self.mnuLogFind) # Menu Preferences > Log self.mnuLogPref = wx.MenuItem(self.menu_pref, wx.ID_ANY, u"Log", wx.EmptyString, wx.ITEM_NORMAL) self.menu_pref.AppendItem(self.mnuLogPref) # Menu Preferences > Email self.mnuEmailPref = wx.MenuItem(self.menu_pref, wx.ID_ANY, u"Email", wx.EmptyString, wx.ITEM_NORMAL) self.menu_pref.AppendItem(self.mnuEmailPref) # Menu Preferences > Command self.mnuCmdPref = wx.MenuItem(self.menu_pref, wx.ID_ANY, u"Command", wx.EmptyString, wx.ITEM_NORMAL) self.menu_pref.AppendItem(self.mnuCmdPref) # Menu About > TheWatcher self.mnuAbout = wx.MenuItem(self.menu_about, wx.ID_ANY, u"TheWatcher", wx.EmptyString, wx.ITEM_NORMAL) self.menu_about.AppendItem(self.mnuAbout) self.menubar.Append(self.menu_dir, u"Directory") self.menubar.Append(self.menu_log, u"Log") self.menubar.Append(self.menu_pref, u"Preferences") self.menubar.Append(self.menu_about, u"About") self.SetMenuBar(self.menubar) # ---------------------------------------------------------------------- rowSizer_a = wx.BoxSizer(wx.VERTICAL) colSizer_ab = wx.FlexGridSizer(0, 5, 0, 0) colSizer_ab.AddGrowableCol(1) colSizer_ab.SetFlexibleDirection(wx.BOTH) colSizer_ab.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) # Label Control -------------------------------------------------------- self.lblPath = wx.StaticText(self, wx.ID_ANY, u" Directory Path ", wx.DefaultPosition, wx.Size(-1, -1), 0) self.lblPath.Wrap(-1) self.lblPath.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) colSizer_ab.Add(self.lblPath, 1, wx.EXPAND, 5) # Directory Picker Control --------------------------------------------- self.dirPicker = wx.DirPickerCtrl(self, wx.ID_ANY, u"Please enter a valid path...", u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE) colSizer_ab.Add(self.dirPicker, 1, wx.EXPAND, 5) # Button Add ----------------------------------------------------------- self.btnAdd = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.Size(50, -1), 0) colSizer_ab.Add(self.btnAdd, 0, 0, 5) # Button Run ----------------------------------------------------------- self.btnRun = wx.ToggleButton(self, wx.ID_ANY, u"RUN", wx.DefaultPosition, wx.Size(60, -1), 0) #self.btnRun.SetValue(True) colSizer_ab.Add(self.btnRun, 0, 0, 5) rowSizer_a.Add(colSizer_ab, 0, wx.EXPAND, 5) # Data View List Control ----------------------------------------------- self.lstPath = dv.DataViewListCtrl(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, 150)) rowSizer_a.Add(self.lstPath, 0, wx.EXPAND, 5) # List Control Columns self.lstPath.AppendTextColumn('No', width=30) self.lstPath.AppendTextColumn('Directory', width=200) self.lstPath.AppendTextColumn('Events', width=100) self.lstPath.AppendToggleColumn('Subdirectories') self.lstPath.AppendTextColumn('Types', width=100) self.lstPath.AppendTextColumn('Ignore Patterns', width=100, mode=dv.DATAVIEW_CELL_EDITABLE) self.lstPath.AppendTextColumn('Watch Patterns', width=100, mode=dv.DATAVIEW_CELL_EDITABLE) # Tab Control ---------------------------------------------------------- self.tabCtrl = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) # Log Panel self.tabLog = wx.Panel(self.tabCtrl, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) rowSizer_ab = wx.BoxSizer(wx.VERTICAL) # Text Box (Log) ------------------------------------------------------- self.txtLog = wx.TextCtrl( self.tabLog, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP | wx.TE_MULTILINE | wx.TE_RICH) # Custom wx.Log class self.log = MyLog(self.txtLog) # Link to textCtrl wx.Log_SetActiveTarget(self.log) # Redirect Log to textCtrl self.log.SetTimestamp("%d/%m/%Y %I:%M:%S %p") self.log.SetLogLevel(5) # self.log.SetVerbose(True) rowSizer_ab.Add(self.txtLog, 1, wx.EXPAND, 5) self.tabLog.SetSizer(rowSizer_ab) self.tabLog.Layout() rowSizer_ab.Fit(self.tabLog) self.tabCtrl.AddPage(self.tabLog, u"Log", False) rowSizer_a.Add(self.tabCtrl, 1, wx.EXPAND, 5) self.SetSizer(rowSizer_a) self.Layout() # Status Bar ----------------------------------------------------------- self.statusBar = self.CreateStatusBar(1, wx.ST_SIZEGRIP, wx.ID_ANY) # ------------------------------------------------------ Binding Events self.Bind(wx.EVT_MENU, self.addDirectory, self.mnuAddDir) self.Bind(wx.EVT_MENU, self.remDirectory, self.mnuRemDir) self.Bind(wx.EVT_TEXT, self.onGuiLogUpdate) self.Bind(wx.EVT_MENU, self.clearLog, self.mnuLogClear) self.Bind(wx.EVT_MENU, self.findInLog, self.mnuLogFind) self.Bind(wx.EVT_MENU, self.saveLog, self.mnuLogSave) self.Bind(wx.EVT_MENU, self.loadLog, self.mnuLogLoad) self.Bind(wx.EVT_MENU, self.emailSettings, self.mnuEmailPref) self.Bind(wx.EVT_MENU, self.logSettings, self.mnuLogPref) self.Bind(wx.EVT_MENU, self.cmdSettings, self.mnuCmdPref) self.Bind(wx.EVT_MENU, self.onAbout, self.mnuAbout) self.lstPath.Bind(dv.EVT_DATAVIEW_COLUMN_HEADER_CLICK, self.remDirectory) self.btnAdd.Bind(wx.EVT_BUTTON, self.quickAdd) # self.Bind(wx.EVT_TOGGLEBUTTON, self.run, self.btnRun) self.Bind(wx.EVT_TOGGLEBUTTON, self.run_watchdog, self.btnRun) self.Bind(EVT_UPDATE_LOG, self.onUpdate)
Inspiration: - http://offkilterengineering.com/using-python-and-wxpython-to-display-a-motion-jpeg-from-the-trendnet-wireless-internet-camera/ ''' import wx from GUI.wxCameraPanel import CameraPanel from Surveyor.SrvThread import SrvControl #from DummyBot.DummyBot import DummyBot from Controller.JoystickController import JoystickController if __name__ == '__main__': app = wx.App(0) wx.Log_SetActiveTarget(wx.LogStderr()) frame = wx.Frame(parent=None, id=wx.ID_ANY, title='UpCam.py', style=wx.DEFAULT_FRAME_STYLE & ~wx.RESIZE_BORDER) robot = SrvControl("/dev/ttyUSB0") #robot = DummyBot() ctrl = JoystickController(robot) # visual stuff campanel = CameraPanel(frame, robot) campanel.SetSize(robot.image.size) # main frame
def write(self, message): # print message # wx.LogMessage(message) self.DoLogString(message) def redirect_outputs(self): self.oldstdout = sys.stdout sys.stdout = self def restore_outputs(self): sys.stdout = self.oldstdout _log = ArtubLog() wx.Log_SetActiveTarget(_log) def set_text_ctrl(textCtrl): _log.tc = textCtrl _log.redirect_outputs() def log(*args): global _log s = "" for i in args: s = s + str(i) + ' ' _log.write(s)
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) self.SetIcon(GetMondrianIcon()) self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) self.statusbar.SetStatusWidths([-2, -1]) # statusbar fields statusbar_fields = [ ("ThumbnailCtrl Demo, Andrea Gavana @ 10 Dec 2005"), ("Welcome To wxPython!") ] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i) self.SetMenuBar(self.CreateMenuBar()) splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN | wx.SP_3D | wx.WANTS_CHARS) splitter2 = wx.SplitterWindow(splitter, -1, style=wx.CLIP_CHILDREN | wx.SP_3D) self.panel_1 = wx.Panel(splitter2, -1) sizer = wx.BoxSizer(wx.HORIZONTAL) scroll = TC.ThumbnailCtrl(splitter, -1) scroll.ShowFileNames() scroll.ShowDir(os.getcwd()) self.seqTC = scroll self.thumbsizer_staticbox = wx.StaticBox(self.panel_1, -1, "Thumb Style") self.customsizer_staticbox = wx.StaticBox(self.panel_1, -1, "Thumb Customization") self.optionsizer_staticbox = wx.StaticBox(self.panel_1, -1, "More Options") self.dirsizer_staticbox = wx.StaticBox(self.panel_1, -1, "Directory Selection") self.dirbutton = wx.Button(self.panel_1, -1, "Change Directory") self.radiostyle1 = wx.RadioButton(self.panel_1, -1, "THUMB_OUTLINE_NONE", style=wx.RB_GROUP) self.radiostyle2 = wx.RadioButton(self.panel_1, -1, "THUMB_OUTLINE_FULL") self.radiostyle3 = wx.RadioButton(self.panel_1, -1, "THUMB_OUTLINE_RECT") self.radiostyle4 = wx.RadioButton(self.panel_1, -1, "THUMB_OUTLINE_IMAGE") self.highlight = wx.CheckBox(self.panel_1, -1, "Highlight On Pointing") self.showfiles = wx.CheckBox(self.panel_1, -1, "Show Filenames") self.enabledragging = wx.CheckBox(self.panel_1, -1, "Enable Drag And Drop") self.setpopup = wx.CheckBox(self.panel_1, -1, "Set Popup Menu On Thumbs") self.setgpopup = wx.CheckBox(self.panel_1, -1, "Set Global Popup Menu") self.showcombo = wx.CheckBox(self.panel_1, -1, "Show Folder ComboBox") self.enabletooltip = wx.CheckBox(self.panel_1, -1, "Enable Thumb ToolTips") self.textzoom = wx.TextCtrl(self.panel_1, -1, "1.4") self.zoombutton = wx.Button(self.panel_1, -1, "Set Zoom Factor") self.fontbutton = wx.Button(self.panel_1, -1, "Set Caption Font") self.colourbutton = wx.Button(self.panel_1, -1, "Set Selection Colour") self.radios = [ self.radiostyle1, self.radiostyle2, self.radiostyle3, self.radiostyle4 ] self.thumbstyles = [ "THUMB_OUTLINE_NONE", "THUMB_OUTLINE_FULL", "THUMB_OUTLINE_RECT", "THUMB_OUTLINE_IMAGE" ] self.__set_properties() self.__do_layout() self.panel_1.SetSizer(sizer) sizer.Layout() self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle1) self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle2) self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle3) self.Bind(wx.EVT_RADIOBUTTON, self.OnChangeOutline, self.radiostyle4) self.Bind(wx.EVT_CHECKBOX, self.OnHighlight, self.highlight) self.Bind(wx.EVT_CHECKBOX, self.OnShowFiles, self.showfiles) self.Bind(wx.EVT_CHECKBOX, self.OnEnableDragging, self.enabledragging) self.Bind(wx.EVT_CHECKBOX, self.OnSetPopup, self.setpopup) self.Bind(wx.EVT_CHECKBOX, self.OnSetGlobalPopup, self.setgpopup) self.Bind(wx.EVT_CHECKBOX, self.OnShowComboBox, self.showcombo) self.Bind(wx.EVT_CHECKBOX, self.OnEnableToolTips, self.enabletooltip) self.Bind(wx.EVT_BUTTON, self.OnSetZoom, self.zoombutton) self.Bind(wx.EVT_BUTTON, self.OnSetFont, self.fontbutton) self.Bind(wx.EVT_BUTTON, self.OnSetColour, self.colourbutton) self.Bind(wx.EVT_BUTTON, self.OnSetDirectory, self.dirbutton) # end wxGlade self.seqTC.Bind(TC.EVT_THUMBNAILS_SEL_CHANGED, self.OnSelChanged) self.seqTC.Bind(TC.EVT_THUMBNAILS_POINTED, self.OnPointed) self.seqTC.Bind(TC.EVT_THUMBNAILS_DCLICK, self.OnDClick) # Set up a log window self.log = wx.TextCtrl(splitter2, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) # But instead of the above we want to show how to use our own wx.Log class wx.Log_SetActiveTarget(MyLog(self.log)) # add the windows to the splitter and split it. splitter2.SplitHorizontally(self.panel_1, self.log, -100) splitter.SplitVertically(scroll, splitter2, 180) splitter.SetMinimumPaneSize(140) splitter2.SetMinimumPaneSize(60) # Make the splitter on the right expand the top window when resized def SplitterOnSize(evt): splitter = evt.GetEventObject() sz = splitter.GetSize() splitter.SetSashPosition(sz.height - 100, False) evt.Skip() splitter2.Bind(wx.EVT_SIZE, SplitterOnSize) self.SetMinSize((700, 590)) self.CenterOnScreen()
def OnInit(self): wx.InitAllImageHandlers() wx.Log_SetActiveTarget(wx.LogStderr()) self.SetAssertMode(assertMode) frame = wx.Frame(None, -1, "RunDemo: " + self.name, pos=(50, 50), size=(200, 100), style=wx.NO_FULL_REPAINT_ON_RESIZE | wx.DEFAULT_FRAME_STYLE) frame.CreateStatusBar() menuBar = wx.MenuBar() menu = wx.Menu() item = menu.Append(-1, "E&xit\tAlt-X", "Exit demo") self.Bind(wx.EVT_MENU, self.OnButton, item) menuBar.Append(menu, "&File") ns = {} ns['wx'] = wx ns['app'] = self ns['module'] = self.demoModule ns['frame'] = frame frame.SetMenuBar(menuBar) frame.Show(True) frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame) win = self.demoModule.runTest(frame, frame, Log()) # a window will be returned if the demo does not create # its own top-level window if win: # so set the frame to a good size for showing stuff frame.SetSize((640, 480)) win.SetFocus() self.window = win ns['win'] = win frect = frame.GetRect() else: # otherwise the demo made its own frame, so just put a # button in this one if hasattr(frame, 'otherWin'): ns['win'] = frame.otherWin frect = frame.otherWin.GetRect() p = wx.Panel(frame, -1) b = wx.Button(p, -1, " Exit ", (10, 10)) wx.CallAfter(frame.SetClientSize, (200, 100)) frame.Bind(wx.EVT_BUTTON, self.OnButton, b) else: # It was probably a dialog or something that is already # gone, so we're done. frame.Destroy() return True self.SetTopWindow(frame) self.frame = frame #wx.Log_SetActiveTarget(wx.LogStderr()) #wx.Log_SetTraceMask(wx.TraceMessages) if self.useShell: # Make a PyShell window, and position it below our test window from wx import py shell = py.shell.ShellFrame(None, locals=ns) frect.OffsetXY(0, frect.height) frect.height = 400 shell.SetRect(frect) shell.Show() # Hook the close event of the test window so that we close # the shell at the same time def CloseShell(evt): if shell: shell.Close() evt.Skip() frame.Bind(wx.EVT_CLOSE, CloseShell) return True
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size=(800, 600)) # Private variables self._scenarioInProgress = False self._currId = 0 self._clients = {} self._statuses = ['idle', 'running'] self._status = 0 # Screen & status bar self.CenterOnScreen() self.CreateStatusBar() self.statusBar(0) # Menu menuBar = wx.MenuBar() menu1 = wx.Menu() menu1.Append(104, "&Exit", "Exit the TFW") menuBar.Append(menu1, "&File") self.SetMenuBar(menuBar) wx.EVT_MENU(self, 104, self.CloseWindow) # Notebook self.nb = wx.Notebook(self, -1) # Scenario page splitter = wx.SplitterWindow(self.nb, -1) panel = wx.Panel(splitter, -1, style=wx.CLIP_CHILDREN) tID = wx.NewId() self.tree = wx.TreeCtrl(panel, tID, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz)) self.tree.SetImageList(il) self.il = il self.createNewScenario() self.tree.Expand(self.root) def EmptyHandler(evt): pass def OnSelChanged(event): self.selectionPanel() event.Skip() def OnTreeOvrSize(evt, ovr=self.tree): ovr.SetSize(evt.GetSize()) def OnRightClick(event): pt = event.GetPosition() item, flags = self.tree.HitTest(pt) self.tree.SelectItem(item) win = Popup(self.tree, wx.SIMPLE_BORDER, self, item) btn = self.tree.GetBoundingRect(item, False) if btn is not None: pos = self.tree.ClientToScreen(btn.GetPosition()) sz = btn.GetSize() win.Position(pos, (0, sz.height)) win.Popup() def OnLeftDClick(event): pt = event.GetPosition() item, flags = self.tree.HitTest(pt) self.tree.EditLabel(item) def OnEndEdit(event): selItem = self.tree.GetSelection() if selItem is not None: self.tree.GetPyData(selItem).setName( self.tree.GetItemText(selItem)) self.selectionPanel() wx.EVT_SIZE(panel, OnTreeOvrSize) wx.EVT_TREE_SEL_CHANGED(self, tID, OnSelChanged) wx.EVT_TREE_END_LABEL_EDIT(self, tID, OnEndEdit) wx.EVT_LEFT_DCLICK(self.tree, OnLeftDClick) wx.EVT_RIGHT_DOWN(self.tree, OnRightClick) self._panel2 = wx.Panel(splitter, -1, style=wx.CLIP_CHILDREN) self.selectionPanel() splitter.SetMinimumPaneSize(150) splitter.SplitVertically(panel, self._panel2, 150) self.nb.AddPage(splitter, "Scenario") # Clients page panel = wx.Panel(self.nb, -1, style=wx.CLIP_CHILDREN) self.txt = wx.StaticText(panel, -1, "Connected clients:", wx.Point(5, 5), wx.Size(200, -1)) tID = wx.NewId() self.list = wx.ListCtrl(panel, tID, pos=wx.Point(5, 22), style=wx.LC_REPORT | wx.SUNKEN_BORDER) def OnOvrSize(evt, ovr=self.list): ovr.SetSize(evt.GetSize()) wx.EVT_SIZE(panel, OnOvrSize) wx.EVT_ERASE_BACKGROUND(panel, EmptyHandler) self.populateList() self.nb.AddPage(panel, "Clients") # Logs page panel = wx.Panel(self.nb, -1, style=wx.CLIP_CHILDREN) self.log = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) def OnLogOvrSize(evt, ovr=self.log): ovr.SetSize(evt.GetSize()) wx.EVT_SIZE(panel, OnLogOvrSize) wx.EVT_ERASE_BACKGROUND(panel, EmptyHandler) self.nb.AddPage(panel, "Logs") wx.Log_SetActiveTarget(MyLog(self.log, True)) wx.EVT_CLOSE(self, self.OnCloseWindow) # Start listening thread thread = threading.Thread(target=listen4cli, args=([self])) thread.start()
def __init__(self, parent, id, title): wx.Frame.__init__( self, parent, id, title, \ pos = wx.DefaultPosition,\ size = (1024,768),\ style = wx.DEFAULT_FRAME_STYLE,\ name = 'frame' ) Frame.mainFrame = self self.__InitXRC() self.SetMinSize((800, 600)) self.haveFocus = False # pnl = wx.Panel(self) # self.pnl = pnl self.mgr = aui.AuiManager() self.mgr.SetManagedWindow(self) icon = wx.Icon(name='res/Python.ico', type=wx.BITMAP_TYPE_ICO) self.SetIcon(icon) if sys.version_info.major == 2: self.statusBar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) elif sys.version_info.major == 3: self.statusBar = self.CreateStatusBar(2, wx.STB_SIZEGRIP) self.statusBar.SetStatusWidths([-2, -1]) statusText = u'MicroChat use wxPython %s' % wx.version() self.statusBar.SetStatusText(statusText, 0) if platform.system() == 'Windows': ctrl_style = wx.TE_RICH | wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER else: ctrl_style = wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER # self.log = rt.RichTextCtrl( self, style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|rt.RE_READONLY ) self.log = wx.TextCtrl(self, wx.ID_ANY, style=ctrl_style) if sys.version_info.major == 2: wx.Log_SetActiveTarget(MyLog(self.log)) elif sys.version_info.major == 3: wx.Log.SetActiveTarget(MyLog(self.log)) # self.mgr.AddPane( ConfigurePanel(self, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN, log=self.log), # aui.AuiPaneInfo(). # Centre().Layer(2).BestSize((240,-1)). # MinSize((160,-1)). # Floatable(ALLOW_AUI_FLOATING).FloatingSize((240,700)). # Caption(u'Configure'). # CloseButton(False). # Name(u'A2')) s = aui.AUI_NB_SCROLL_BUTTONS | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_FIXED_WIDTH | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_TOP | aui.AUI_NB_WINDOWLIST_BUTTON # | aui.AUI_NB_LEFT # | aui.AUI_NB_RIGHT # | aui.AUI_NB_TAB_MOVE # | aui.AUI_NB_BOTTOM self.nb = aui.AuiNotebook(self, style=s) page = MicroChatPanel(self, style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN, log=self.log) stockPanel = page # DataMngr().ob_ui.panels.append( page ) # page.draw() self.nb.AddPage(page, u'MicroChat') self.mgr.AddPane( self.nb, aui.AuiPaneInfo().Centre().Layer(2).BestSize((240, -1)).MinSize( (160, -1)).Floatable(ALLOW_AUI_FLOATING).FloatingSize( (240, 700)).Caption(u'Configure').CloseButton( False).MaximizeButton(True).Name(u'A2')) self.mgr.AddPane( self.log, aui.AuiPaneInfo().Caption(u'Log Messages').Right().Layer(1). Position(1).BestSize((-1, 80)).Dockable(False).MinSize( (-1, 80)).Floatable(ALLOW_AUI_FLOATING).FloatingSize( (500, 160)).CloseButton(True).MaximizeButton(True).Name(u'A3')) self.mgr.Update() if sys.version_info.major == 2: self.mgr.SetFlags(self.mgr.GetFlags() ^ aui.AUI_MGR_TRANSPARENT_DRAG) # 绑定事件处理 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(EVT_TASK_FINISH, self.OnTaskFinish) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGING, self.OnPageChangeine) self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) # self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_CHAR, self.OnChar) self.Bind(wx.EVT_MOVE, self.OnMove) # LOG self.Bind(EVT_WX_LOG_EVENT, self.OnLogEvent) self.uilog = wxLogHandler(self) if g_log is not None: g_log.AddHandler(self.uilog) self.SetFocus() # self.searchDlg = wx.Dialog(self, -1, 'test dlg') self.nb.SetSelection(0) # self.nb.ChangeSelection(1) # wx.LogError('test log error') # wx.LogWarning('test log warning') # wx.LogDebug('test log debug') # stockPanel.LoadDataFromHDF5( 'sz002487' ) # stockPanel.LoadDataFromHDF5( 'sh000001' ) # stockPanel.LoadDataFromHDF5( 'sz000666' ) # stockPanel.LoadDataFromHDF5( Config.stock, Config.kType ) # stockPanel.LoadDataFromHDF5( 'sz300315' ) # Start Work Thread def RunOtherThread(*args): pass # print( 'RunOtherThread', *args ) # start = -1 # end = -1 # pipeline, code, ktype, rtype = args # df = DataMngr.GetKBarDF( code, ktype, start, end, rtype=rtype ) # if df is not None: # wx.CallAfter( stockPanel.OnDFLoaded, df ) # core.taskMng.SubmitTask( core.tid, None, RunOtherThread, 1 ) # Test new thread task pipline. task = Task() task.phase = 0 task.process = RunOtherThread # task.params = (Config.stock, Config.kType, Config.rtype) task.params = () core.taskMng.SubmitTask(task)
def OnInit(self): global ACTIVEGRID_BASE_IDE global USE_OLD_PROJECTS args = sys.argv #init ide logger log_mode = logger.LOG_MODE_IDE # Suppress non-fatal errors that might prompt the user even in cases # when the error does not impact them. #the log will redirect to NovalIDE.exe.log when convert into windows exe with py2exe wx.Log_SetActiveTarget(AppLog()) if "-h" in args or "-help" in args or "--help" in args\ or (wx.Platform == "__WXMSW__" and "/help" in args): print "Usage: ActiveGridAppBuilder.py [options] [filenames]\n" # Mac doesn't really support multiple instances for GUI apps # and since we haven't got time to test this thoroughly I'm # disabling it for now. if wx.Platform != "__WXMAC__": print " option " + printArg( "multiple" ) + " to allow multiple instances of application." print " option " + printArg("debug") + " for debug mode." print " option '-h' or " + printArg( "help") + " to show usage information for command." print " option " + printArg("baseide") + " for base IDE mode." print " [filenames] is an optional list of files you want to open when application starts." return False elif isInArgs("dev", args): self.SetAppName(_("NovalBuilderDev")) self.SetDebug(False) elif isInArgs("debug", args): self.SetAppName(_("NovalBuilderDebug")) self.SetDebug(True) ACTIVEGRID_BASE_IDE = True log_mode = logger.LOG_MODE_TESTRUN self.SetSingleInstance(False) elif isInArgs("baseide", args): self.SetAppName(_("NovalIDE")) ACTIVEGRID_BASE_IDE = True elif isInArgs("tools", args): USE_OLD_PROJECTS = True else: self.SetAppName(_("NovalBuilder")) self.SetDebug(False) if isInArgs("multiple", args) and wx.Platform != "__WXMAC__": self.SetSingleInstance(False) logger.initLogging(log_mode) if not wx.lib.pydocview.DocApp.OnInit(self): return False self.ShowSplash(getIDESplashBitmap()) import STCTextEditor import TextService import FindInDirService import MarkerService import project as projectlib import ProjectEditor import PythonEditor import OutlineService import XmlEditor import HtmlEditor import TabbedView import MessageService ## import OutputService import Service import ImageEditor import PerlEditor import PHPEditor import wx.lib.ogl as ogl import DebuggerService import AboutDialog import SVNService import ExtensionService import CompletionService import GeneralOption import NavigationService import TabbedFrame ## import UpdateLogIniService _EDIT_LAYOUTS = True self._open_project_path = None # This creates some pens and brushes that the OGL library uses. # It should be called after the app object has been created, but # before OGL is used. ogl.OGLInitialize() config = wx.Config(self.GetAppName(), style=wx.CONFIG_USE_LOCAL_FILE) if not config.Exists( "MDIFrameMaximized" ): # Make the initial MDI frame maximize as default config.WriteInt("MDIFrameMaximized", True) if not config.Exists( "MDIEmbedRightVisible" ): # Make the properties embedded window hidden as default config.WriteInt("MDIEmbedRightVisible", False) ##my_locale must be set as app member property,otherwise it will only workable when app start up ##it will not workable after app start up,the translation also will not work lang_id = GeneralOption.GetLangId(config.Read("Language", "")) if wx.Locale.IsAvailable(lang_id): self.my_locale = wx.Locale(lang_id) if self.my_locale.IsOk(): self.my_locale.AddCatalogLookupPathPrefix( os.path.join(sysutilslib.mainModuleDir, 'noval', 'locale')) ibRet = self.my_locale.AddCatalog(self.GetAppName().lower()) ibRet = self.my_locale.AddCatalog("wxstd") self.my_locale.AddCatalog("wxstock") docManager = IDEDocManager(flags=self.GetDefaultDocManagerFlags()) self.SetDocumentManager(docManager) # Note: These templates must be initialized in display order for the "Files of type" dropdown for the "File | Open..." dialog defaultTemplate = wx.lib.docview.DocTemplate( docManager, _("Any"), "*.*", _("Any"), _(".txt"), _("Text Document"), _("Text View"), STCTextEditor.TextDocument, STCTextEditor.TextView, wx.lib.docview.TEMPLATE_INVISIBLE, icon=STCTextEditor.getTextIcon()) docManager.AssociateTemplate(defaultTemplate) htmlTemplate = wx.lib.docview.DocTemplate( docManager, _("HTML"), "*.html;*.htm", _("HTML"), _(".html"), _("HTML Document"), _("HTML View"), HtmlEditor.HtmlDocument, HtmlEditor.HtmlView, icon=HtmlEditor.getHTMLIcon()) docManager.AssociateTemplate(htmlTemplate) imageTemplate = wx.lib.docview.DocTemplate( docManager, _("Image"), "*.bmp;*.ico;*.gif;*.jpg;*.jpeg;*.png", _("Image"), _(".png"), _("Image Document"), _("Image View"), ImageEditor.ImageDocument, ImageEditor.ImageView, wx.lib.docview.TEMPLATE_NO_CREATE, icon=ImageEditor.getImageIcon()) docManager.AssociateTemplate(imageTemplate) perlTemplate = wx.lib.docview.DocTemplate( docManager, _("Perl"), "*.pl", _("Perl"), _(".pl"), _("Perl Document"), _("Perl View"), PerlEditor.PerlDocument, PerlEditor.PerlView, icon=PerlEditor.getPerlIcon()) docManager.AssociateTemplate(perlTemplate) phpTemplate = wx.lib.docview.DocTemplate(docManager, _("PHP"), "*.php", _("PHP"), _(".php"), _("PHP Document"), _("PHP View"), PHPEditor.PHPDocument, PHPEditor.PHPView, icon=PHPEditor.getPHPIcon()) docManager.AssociateTemplate(phpTemplate) projectTemplate = ProjectEditor.ProjectTemplate( docManager, _("Project"), "*%s" % PROJECT_EXTENSION, _("Project"), _(PROJECT_EXTENSION), _("Project Document"), _("Project View"), ProjectEditor.ProjectDocument, ProjectEditor.ProjectView, ### wx.lib.docview.TEMPLATE_NO_CREATE, icon=ProjectEditor.getProjectIcon()) docManager.AssociateTemplate(projectTemplate) pythonTemplate = wx.lib.docview.DocTemplate( docManager, _("Python"), "*.py;*.pyw", _("Python"), _(".py"), _("Python Document"), _("Python View"), PythonEditor.PythonDocument, PythonEditor.PythonView, icon=PythonEditor.getPythonIcon()) docManager.AssociateTemplate(pythonTemplate) textTemplate = wx.lib.docview.DocTemplate( docManager, _("Text"), "*.text;*.txt", _("Text"), _(".txt"), _("Text Document"), _("Text View"), STCTextEditor.TextDocument, STCTextEditor.TextView, icon=STCTextEditor.getTextIcon()) docManager.AssociateTemplate(textTemplate) xmlTemplate = wx.lib.docview.DocTemplate(docManager, _("XML"), "*.xml", _("XML"), _(".xml"), _("XML Document"), _("XML View"), XmlEditor.XmlDocument, XmlEditor.XmlView, icon=XmlEditor.getXMLIcon()) docManager.AssociateTemplate(xmlTemplate) pythonService = self.InstallService( PythonEditor.PythonService(_("Python Interpreter"), embeddedWindowLocation=wx.lib.pydocview. EMBEDDED_WINDOW_BOTTOM)) if not ACTIVEGRID_BASE_IDE: propertyService = self.InstallService( PropertyService.PropertyService( "Properties", embeddedWindowLocation=wx.lib.pydocview. EMBEDDED_WINDOW_RIGHT)) projectService = self.InstallService( ProjectEditor.ProjectService(_("Projects/Resources View"), embeddedWindowLocation=wx.lib. pydocview.EMBEDDED_WINDOW_TOPLEFT)) findService = self.InstallService(FindInDirService.FindInDirService()) if not ACTIVEGRID_BASE_IDE: webBrowserService = self.InstallService( WebBrowserService.WebBrowserService() ) # this must be before webServerService since it sets the proxy environment variable that is needed by the webServerService. webServerService = self.InstallService( WebServerService.WebServerService() ) # this must be after webBrowserService since that service sets the proxy environment variables. outlineService = self.InstallService( OutlineService.OutlineService( _("Outline"), embeddedWindowLocation=wx.lib.pydocview. EMBEDDED_WINDOW_BOTTOMLEFT)) filePropertiesService = self.InstallService( wx.lib.pydocview.FilePropertiesService()) markerService = self.InstallService(MarkerService.MarkerService()) textService = self.InstallService(TextService.TextService()) perlService = self.InstallService(PerlEditor.PerlService()) phpService = self.InstallService(PHPEditor.PHPService()) comletionService = self.InstallService( CompletionService.CompletionService()) navigationService = self.InstallService( NavigationService.NavigationService()) messageService = self.InstallService( MessageService.MessageService(_("Search Results"), embeddedWindowLocation=wx.lib. pydocview.EMBEDDED_WINDOW_BOTTOM)) ## outputService = self.InstallService(OutputService.OutputService("Output", embeddedWindowLocation = wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM)) debuggerService = self.InstallService( DebuggerService.DebuggerService("Debugger", embeddedWindowLocation=wx.lib. pydocview.EMBEDDED_WINDOW_BOTTOM)) extensionService = self.InstallService( ExtensionService.ExtensionService()) ###optionsService = self.InstallService(wx.lib.pydocview.DocOptionsService(supportedModes=wx.lib.docview.DOC_MDI)) optionsService = self.InstallService( GeneralOption.GeneralOptionsService()) aboutService = self.InstallService( wx.lib.pydocview.AboutService(AboutDialog.AboutDialog)) ### svnService = self.InstallService(SVNService.SVNService()) if not ACTIVEGRID_BASE_IDE: helpPath = os.path.join(sysutilslib.mainModuleDir, "activegrid", "tool", "data", "AGDeveloperGuideWebHelp", "AGDeveloperGuideWebHelp.hhp") helpService = self.InstallService( HelpService.HelpService(helpPath)) if self.GetUseTabbedMDI(): windowService = self.InstallService( wx.lib.pydocview.WindowMenuService()) # order of these added determines display order of Options Panels optionsService.AddOptionsPanel(ProjectEditor.ProjectOptionsPanel) ## optionsService.AddOptionsPanel(DebuggerService.DebuggerOptionsPanel) optionsService.AddOptionsPanel(PythonEditor.PythonOptionsPanel) ## optionsService.AddOptionsPanel(PHPEditor.PHPOptionsPanel) ## optionsService.AddOptionsPanel(PerlEditor.PerlOptionsPanel) optionsService.AddOptionsPanel(XmlEditor.XmlOptionsPanel) optionsService.AddOptionsPanel(HtmlEditor.HtmlOptionsPanel) optionsService.AddOptionsPanel(STCTextEditor.TextOptionsPanel) ## optionsService.AddOptionsPanel(SVNService.SVNOptionsPanel) optionsService.AddOptionsPanel(ExtensionService.ExtensionOptionsPanel) filePropertiesService.AddCustomEventHandler(projectService) outlineService.AddViewTypeForBackgroundHandler(PythonEditor.PythonView) ###outlineService.AddViewTypeForBackgroundHandler(PHPEditor.PHPView) outlineService.AddViewTypeForBackgroundHandler( ProjectEditor.ProjectView ) # special case, don't clear outline if in project outlineService.AddViewTypeForBackgroundHandler( MessageService.MessageView ) # special case, don't clear outline if in message window if not ACTIVEGRID_BASE_IDE: outlineService.AddViewTypeForBackgroundHandler( DataModelEditor.DataModelView) outlineService.AddViewTypeForBackgroundHandler( ProcessModelEditor.ProcessModelView) outlineService.AddViewTypeForBackgroundHandler( PropertyService.PropertyView ) # special case, don't clear outline if in property window outlineService.StartBackgroundTimer() ## projectService.AddLogicalViewFolderDefault(".agp", _("Projects")) ## projectService.AddLogicalViewFolderDefault(".wsdlag", _("Services")) ## projectService.AddLogicalViewFolderDefault(".wsdl", _("Services")) ## projectService.AddLogicalViewFolderDefault(".xsd", _("Data Models")) ## projectService.AddLogicalViewFolderDefault(".bpel", _("Page Flows")) ## projectService.AddLogicalViewFolderDefault(".xform", _("Pages")) ## projectService.AddLogicalViewFolderDefault(".xacml", _("Security")) ## projectService.AddLogicalViewFolderDefault(".lyt", _("Presentation/Layouts")) ## projectService.AddLogicalViewFolderDefault(".skn", _("Presentation/Skins")) ## projectService.AddLogicalViewFolderDefault(".css", _("Presentation/Stylesheets")) ## projectService.AddLogicalViewFolderDefault(".js", _("Presentation/Javascript")) ## projectService.AddLogicalViewFolderDefault(".html", _("Presentation/Static")) ## projectService.AddLogicalViewFolderDefault(".htm", _("Presentation/Static")) ## projectService.AddLogicalViewFolderDefault(".gif", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".jpeg", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".jpg", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".png", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".ico", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".bmp", _("Presentation/Images")) ## projectService.AddLogicalViewFolderDefault(".py", _("Code")) ## projectService.AddLogicalViewFolderDefault(".php", _("Code")) ## projectService.AddLogicalViewFolderDefault(".pl", _("Code")) ## projectService.AddLogicalViewFolderDefault(".sql", _("Code")) ## projectService.AddLogicalViewFolderDefault(".xml", _("Code")) ## projectService.AddLogicalViewFolderDefault(".dpl", _("Code")) ## ## projectService.AddLogicalViewFolderCollapsedDefault(_("Page Flows"), False) ## projectService.AddLogicalViewFolderCollapsedDefault(_("Pages"), False) iconPath = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "noval.ico") self.SetDefaultIcon(wx.Icon(iconPath, wx.BITMAP_TYPE_ICO)) if not ACTIVEGRID_BASE_IDE: embeddedWindows = wx.lib.pydocview.EMBEDDED_WINDOW_TOPLEFT | wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOMLEFT | wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM | wx.lib.pydocview.EMBEDDED_WINDOW_RIGHT else: embeddedWindows = wx.lib.pydocview.EMBEDDED_WINDOW_TOPLEFT | wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOMLEFT | wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM if self.GetUseTabbedMDI(): self.frame = TabbedFrame.IDEDocTabbedParentFrame( docManager, None, -1, wx.GetApp().GetAppName(), embeddedWindows=embeddedWindows, minSize=150) else: self.frame = TabbedFrame.IDEMDIParentFrame( docManager, None, -1, wx.GetApp().GetAppName(), embeddedWindows=embeddedWindows, minSize=150) self.frame.Show(True) self.toolbar = self.frame.GetToolBar() self.toolbar_combox = self.toolbar.FindControl( DebuggerService.DebuggerService.COMBO_INTERPRETERS_ID) wx.lib.pydocview.DocApp.CloseSplash(self) self.OpenCommandLineArgs() if not projectService.LoadSavedProjects( ) and not docManager.GetDocuments() and self.IsSDI( ): # Have to open something if it's SDI and there are no projects... projectTemplate.CreateDocument( '', wx.lib.docview.DOC_NEW).OnNewDocument() interpretermanager.InterpreterManager().LoadDefaultInterpreter() self.AddInterpreters() projectService.SetCurrentProject() intellisence.IntellisenceManager().generate_default_intellisence_data() self.ShowTipfOfDay() wx.CallAfter(self.CheckUpdate, extensionService) wx.UpdateUIEvent.SetUpdateInterval( 1000 ) # Overhead of updating menus was too much. Change to update every n milliseconds. return True
def __init__(self, parent): self.shouldGenerateTempFiles = False wx.Frame.__init__(self, parent, -1, "MS Simulator") self.contentPanel = wx.Panel(self, -1) _cp = self.contentPanel self.inputText = wx.TextCtrl(_cp, -1, style=wx.TE_MULTILINE | wx.HSCROLL) self.outputText = wx.TextCtrl(_cp, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) self.inputLabel = wx.StaticText(parent=_cp) self.inputLabel.SetLabel(label='Paste worklist here') self.outputLabel = wx.StaticText(parent=_cp) self.outputLabel.SetLabel(label='Log') self.genButton = wx.Button(_cp, ID_GENERATEFILES_BUTTON) self.genButton.SetLabel("Generate Files") self.genButton.Bind(wx.EVT_BUTTON, self.OnGenerate) self.clearButton = wx.Button(_cp, ID_CLEARINPUT_BUTTON) self.clearButton.SetLabel("Clear") self.clearButton.Bind(wx.EVT_BUTTON, self.OnClear) self.tempGenerationCheckBox = wx.CheckBox(_cp, -1, 'Generate temp files') self.tempGenerationCheckBox.Bind(wx.EVT_CHECKBOX, self.toggleTempFiles) self.filectrl = filebrowse.DirBrowseButton(_cp, -1, size=(450, -1), changeCallback=None, labelText='Choose Dir', startDirectory=str('.')) #ctrl.SetValue(str(self.config.getValue(key)) ) self.panelSizer = wx.BoxSizer(wx.VERTICAL) self.log = Log(self.outputText) logger.setLevel(logging.DEBUG) logger.addHandler(self.log) wx.Log_SetActiveTarget(self.log) if wx.Platform == "__WXMAC__": self.inputText.MacCheckSpelling(False) self.outputText.MacCheckSpelling(False) _p = self.panelSizer #tsizer.Add(self.inputText, 1, flag=wx.ALL, border=2) _p.Add(self.inputLabel, 0, flag=wx.ALL, border=2) _p.Add(self.inputText, 1, flag=wx.ALL | wx.GROW, border=2) _p.Add(self.clearButton, 0, flag=wx.ALL, border=2) _p.Add(self.filectrl, 1, flag=wx.ALL | wx.GROW, border=2) _p.Add(self.tempGenerationCheckBox, 0, flag=wx.ALL, border=2) _p.Add(self.genButton, 0, flag=wx.ALL, border=2) _p.Add(self.outputLabel, 0, flag=wx.ALL, border=2) _p.Add(self.outputText, 1, flag=wx.ALL | wx.GROW, border=2) self.contentPanel.SetSizerAndFit(_p) self.panelSizer.Fit(self)