def __init__(self, parent): super(LaunchWindow, self).__init__(parent) # Attributes self._log = wx.GetApp().GetLog() self._mw = ed_basewin.FindMainWindow(self) self._buffer = OutputDisplay(self) self._fnames = list() self._run = None # Created in __DoLayout self._pbtn = None # Created in __DoLayout self._clear = None # Created in __DoLayout self._lockFile = None # Created in __DoLayout self._chFiles = None # Created in __DoLayout self._worker = None self._busy = False self._isready = False self._state = dict(file='', lang=0, cfile='', clang=0, last='', lastlang=0, prelang=0, largs='', lcmd='') # Setup self.__DoLayout() if not handlers.InitCustomHandlers(ed_glob.CONFIG['CACHE_DIR']): util.Log(u"[launch][warn] failed to load launch extensions") # Ensure preferences have been initialized cfgdlg.InitConfig() self.UpdateBufferColors() cbuffer = GetTextBuffer(self.MainWindow) self.SetupControlBar(cbuffer) self.State['lang'] = GetLangIdFromMW(self.MainWindow) self.UpdateCurrentFiles(self.State['lang']) self.SetFile(cbuffer.GetFileName()) # Setup filetype settings self.RefreshControlBar() # Event Handlers self.Bind(wx.EVT_BUTTON, self.OnButton) self.Bind(wx.EVT_CHOICE, self.OnChoice) self.Bind(wx.EVT_CHECKBOX, self.OnCheck) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self) ed_msg.Subscribe(self.OnPageChanged, ed_msg.EDMSG_UI_NB_CHANGED) ed_msg.Subscribe(self.OnFileOpened, ed_msg.EDMSG_FILE_OPENED) ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED) ed_msg.Subscribe(self.OnLexerChange, ed_msg.EDMSG_UI_STC_LEXER) ed_msg.Subscribe(self.OnConfigChange, ed_msg.EDMSG_PROFILE_CHANGE + (handlers.CONFIG_KEY, )) ed_msg.Subscribe(self.OnRunMsg, MSG_RUN_LAUNCH) ed_msg.Subscribe(self.OnRunLastMsg, MSG_RUN_LAST) ed_msg.RegisterCallback(self._CanLaunch, REQUEST_ACTIVE) ed_msg.RegisterCallback(self._CanReLaunch, REQUEST_RELAUNCH)
def __init__(self, parent): """Initialize the window""" super(ShelfWindow, self).__init__(parent) # Attributes # Parent is ed_shelf.EdShelfBook self._mw = ed_basewin.FindMainWindow(self) self._log = wx.GetApp().GetLog() self._listCtrl = CheckResultsList(self, style=wx.LC_REPORT|wx.BORDER_NONE) self._jobtimer = wx.Timer(self) self._checker = None self._curfile = u"" self._hasrun = False # Setup self._listCtrl.set_mainwindow(self._mw) ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT) ctrlbar.SetVMargin(2, 2) if wx.Platform == '__WXGTK__': ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT) rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU) if rbmp.IsNull() or not rbmp.IsOk(): rbmp = None self.cfgbtn = eclib.PlateButton(ctrlbar, wx.ID_ANY, bmp=rbmp, style=eclib.PB_STYLE_NOBG) self.cfgbtn.SetToolTipString(_("Configure")) ctrlbar.AddControl(self.cfgbtn, wx.ALIGN_LEFT) self._lbl = wx.StaticText(ctrlbar) ctrlbar.AddControl(self._lbl) ctrlbar.AddStretchSpacer() rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_BIN_FILE), wx.ART_MENU) if rbmp.IsNull() or not rbmp.IsOk(): rbmp = None self.runbtn = eclib.PlateButton(ctrlbar, wx.ID_ANY, _("Lint"), rbmp, style=eclib.PB_STYLE_NOBG) ctrlbar.AddControl(self.runbtn, wx.ALIGN_RIGHT) # Layout self.SetWindow(self._listCtrl) self.SetControlBar(ctrlbar, wx.TOP) # Event Handlers self.Bind(wx.EVT_TIMER, self.OnJobTimer, self._jobtimer) self.Bind(wx.EVT_BUTTON, self.OnShowConfig, self.cfgbtn) self.Bind(wx.EVT_BUTTON, self.OnRunLint, self.runbtn) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self) # Editra Message Handlers ed_msg.Subscribe(self.OnFileLoad, ed_msg.EDMSG_FILE_OPENED) ed_msg.Subscribe(self.OnFileSave, ed_msg.EDMSG_FILE_SAVED) ed_msg.Subscribe(self.OnPageChanged, ed_msg.EDMSG_UI_NB_CHANGED) ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED)
def __init__(self, *args, **kwargs): wx.ListCtrl.__init__(self, *args, **kwargs) mixins.ListCtrlAutoWidthMixin.__init__(self) elistmix.ListRowHighlighter.__init__(self) # Attributes self._mainw = ed_basewin.FindMainWindow(self) self._charWidth = self.GetCharWidth() # Setup self.InsertColumn(0, _("Type")) self.InsertColumn(1, _("Error")) self.InsertColumn(2, _("File")) self.InsertColumn(3, _("Line")) # Auto-resize file self.setResizeColumn(3) # Event Handlers self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivate)
def __init__(self, parent): """Initialize the window""" super(BaseShelfWindow, self).__init__(parent) # Attributes # Parent is ed_shelf.EdShelfBook self._mw = ed_basewin.FindMainWindow(self) self._log = wx.GetApp().GetLog() self.ctrlbar = None self.taskbtn = None self.cfgbtn = None self._listCtrl = None self._imglst = list() self._curfile = u"" self._hasrun = False self._jobtimer = None self.destroyfn = lambda: None # PyStudio specific messages ed_msg.Subscribe(self.OnProjectLoaded, PyStudioMessages.PYSTUDIO_PROJECT_LOADED)
def __init__(self, parent, id_=wx.ID_ANY): super(FtpWindow, self).__init__(parent, id_) # Attributes self._mw = ed_basewin.FindMainWindow(self) self._config = ftpconfig.ConfigData self._config.SetData(Profile_Get(CONFIG_KEY, default=dict())) self._connected = False self._client = ftpclient.FtpClient(self) self._files = list() self._select = None self._open = list() # Open ftpfile objects # Ui controls self._cbar = None # ControlBar self._list = None # FtpList self._sites = None # wx.Choice self.prefbtn = None self._username = None # wx.TextCtrl self._password = None # wx.TextCtrl # Layout self.__DoLayout() self.EnableControls(bool(self._config.GetCount())) self.RefreshControlBar() # Event Handlers self.Bind(wx.EVT_BUTTON, self.OnButton, self.prefbtn) self.Bind(wx.EVT_BUTTON, self.OnButton, self.cbtn) self.Bind(wx.EVT_CHOICE, self.OnChoice, id=ID_SITES) self.Bind(wx.EVT_MENU, self.OnMenu) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.Bind(ftpclient.EVT_FTP_REFRESH, self.OnRefresh) self.Bind(ftpclient.EVT_FTP_DOWNLOAD, self.OnDownload) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self) # Editra Message Handlers ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED) ed_msg.Subscribe(self.OnCfgUpdated, ftpconfig.EDMSG_FTPCFG_UPDATED)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, menu=None): """ Initializes the CBrowserPane class""" eclib.ControlBox.__init__(self, parent, id, pos, size, style) #---- private attr ----# self._mainwin = ed_basewin.FindMainWindow(self) self._mi = menu self.__log = wx.GetApp().GetLog() self._timer = wx.Timer(self, ID_TIMER) self._intervall = 500 # milli seconds self._taskChoices = TASK_CHOICES #---- Gui ----# ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT) if wx.Platform == '__WXGTK__': ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT) self.SetControlBar(ctrlbar) self._listctrl = CustomListCtrl(self) self.SetWindow(self._listctrl) tasklbl = wx.StaticText(ctrlbar, label=_("Taskfilter: ")) ctrlbar.AddControl(tasklbl, wx.ALIGN_LEFT) self._taskFilter = wx.Choice(ctrlbar, choices=self._taskChoices) self._taskFilter.SetStringSelection(self._taskChoices[0]) ctrlbar.AddControl(self._taskFilter, wx.ALIGN_LEFT) ctrlbar.AddStretchSpacer() self._checkBoxAllFiles = wx.CheckBox(ctrlbar, label=_("All opened files")) ctrlbar.AddControl(self._checkBoxAllFiles, wx.ALIGN_RIGHT) self._checkBoxAfterKey = wx.CheckBox(ctrlbar, label=_("After key")) self._checkBoxAfterKey.SetToolTipString(_("Update as you type")) ctrlbar.AddControl(self._checkBoxAfterKey, wx.ALIGN_RIGHT) btn = wx.Button(ctrlbar, wx.ID_REFRESH, label=_("Refresh")) ctrlbar.AddControl(btn, wx.ALIGN_RIGHT) #---- Bind events ----# self.Bind(wx.EVT_TIMER, lambda evt: self.UpdateCurrent(), self._timer) self.Bind(wx.EVT_BUTTON, lambda evt: self.UpdateCurrent(), btn) self.Bind(wx.EVT_CHOICE, lambda evt: self.UpdateCurrent(), self._taskFilter) # Main notebook events ed_msg.Subscribe(self.OnPageClose, ed_msg.EDMSG_UI_NB_CLOSED) ed_msg.Subscribe(self.OnPageChange, ed_msg.EDMSG_UI_NB_CHANGED) self.Bind(wx.EVT_CHECKBOX, lambda evt: self.UpdateCurrent(), self._checkBoxAllFiles) # File action messages ed_msg.Subscribe(self.OnListUpdate, ed_msg.EDMSG_FILE_SAVED) ed_msg.Subscribe(self.OnListUpdate, ed_msg.EDMSG_FILE_OPENED) ed_msg.Subscribe(self.OnKey, ed_msg.EDMSG_UI_STC_KEYUP)