def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.explorer = ProjectExplorerWidget( self, name_filters=self.get_option('name_filters'), show_all=self.get_option('show_all'), show_hscrollbar=self.get_option('show_hscrollbar'), options_button=self.options_button, single_click_to_open=CONF.get('explorer', 'single_click_to_open'), ) layout = QVBoxLayout() layout.addWidget(self.explorer) self.setLayout(layout) self.recent_projects = self.get_option('recent_projects', default=[]) self.current_active_project = None self.latest_project = None self.watcher = WorkspaceWatcher(self) # Initialize plugin self.initialize_plugin() self.explorer.setup_project(self.get_active_project_path()) self.watcher.connect_signals(self)
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) show_fullpath = self.get_option('show_fullpath') show_all_files = self.get_option('show_all_files') group_cells = self.get_option('group_cells') show_comments = self.get_option('show_comments') sort_files_alphabetically = self.get_option( 'sort_files_alphabetically') follow_cursor = self.get_option('follow_cursor') display_variables = self.get_option('display_variables') self.explorer = OutlineExplorerWidget( self, show_fullpath=show_fullpath, show_all_files=show_all_files, group_cells=group_cells, show_comments=show_comments, sort_files_alphabetically=sort_files_alphabetically, display_variables=display_variables, follow_cursor=follow_cursor, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.explorer) self.setLayout(layout) # Menu as corner widget self.explorer.treewidget.header().hide() self.load_config()
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.pylint = PylintWidget(self, max_entries=max_entries, options_button=self.options_button, text_color=MAIN_TEXT_COLOR, prevrate_color=MAIN_PREVRATE_COLOR) layout = QVBoxLayout() layout.addWidget(self.pylint) self.setLayout(layout) # Add history_action to treewidget context menu history_action = create_action(self, _("History..."), None, ima.icon('history'), _("Set history maximum entries"), triggered=self.change_history_depth) self.pylint.treewidget.common_actions += (None, history_action) # Follow editorstacks tab change self.main.editor.sig_editor_focus_changed.connect(self.set_filename) # Used by Analyze button to check if file should be saved and start # analysis self.pylint.start_analysis.connect(self.run_pylint_from_analyze_button)
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) show_fullpath = self.get_option('show_fullpath') show_all_files = self.get_option('show_all_files') group_cells = self.get_option('group_cells') show_comments = self.get_option('show_comments') self.explorer = OutlineExplorerWidget( self, show_fullpath=show_fullpath, show_all_files=show_all_files, group_cells=group_cells, show_comments=show_comments, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.explorer) self.setLayout(layout) # Menu as corner widget self.explorer.treewidget.header().hide() self.load_config() # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): """ Initialize main widget. Create a basic layout and add ReportWidget. """ SpyderPluginWidget.__init__(self, parent) self.main = parent # Spyder 3 compatibility self.render_action = None self.save_action = None self.save_as_action = None # Initialize plugin self.initialize_plugin() # Create widget and add to dockwindow self.report_widget = ReportsWidget( self.main, [self.save_action, self.save_as_action]) layout = QVBoxLayout() layout.addWidget(self.report_widget) self.setLayout(layout) self.sig_render_started.connect(self.report_widget.render_started) self.sig_render_progress.connect(self.report_widget.update_progress) self.sig_render_finished.connect(self.report_widget.render_finished) self.report_widget.tabs.currentChanged.connect( self.update_actions_status) # This worker runs in a thread to avoid blocking when rendering # a report self._worker_manager = WorkerManager() # Dict to save reports information: self._reports = defaultdict(Report)
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) supported_encodings = self.get_option('supported_encodings') search_path = self.get_option('search_path', None) self.search_text_samples = self.get_option('search_text_samples') search_text = self.get_option('search_text') search_text = [txt for txt in search_text \ if txt not in self.search_text_samples] search_text += self.search_text_samples search_text_regexp = self.get_option('search_text_regexp') exclude = self.get_option('exclude') exclude_idx = self.get_option('exclude_idx', None) exclude_regexp = self.get_option('exclude_regexp') in_python_path = self.get_option('in_python_path') more_options = self.get_option('more_options') case_sensitive = self.get_option('case_sensitive') path_history = self.get_option('path_history', []) self.findinfiles = FindInFilesWidget( self, search_text, search_text_regexp, search_path, exclude, exclude_idx, exclude_regexp, supported_encodings, in_python_path, more_options, case_sensitive, path_history) layout = QVBoxLayout() layout.addWidget(self.findinfiles) self.setLayout(layout) # Initialize plugin self.initialize_plugin() self.toggle_visibility.connect(self.toggle)
def __init__(self, parent, testing=False): """Constructor.""" if testing: self.CONF_FILE = False SpyderPluginWidget.__init__(self, parent) self.testing = testing self.fileswitcher_dlg = None self.main = parent self.recent_notebooks = self.get_option('recent_notebooks', default=[]) self.recent_notebook_menu = QMenu(_("Open recent"), self) layout = QVBoxLayout() new_notebook_btn = create_toolbutton(self, icon=ima.icon('options_more'), tip=_('Open a new notebook'), triggered=self.create_new_client) menu_btn = create_toolbutton(self, icon=ima.icon('tooloptions'), tip=_('Options')) self.menu_actions = self.get_plugin_actions() menu_btn.setMenu(self._options_menu) menu_btn.setPopupMode(menu_btn.InstantPopup) corner_widgets = {Qt.TopRightCorner: [new_notebook_btn, menu_btn]} self.tabwidget = NotebookTabWidget( self, menu=self._options_menu, actions=self.menu_actions, corner_widgets=corner_widgets) self.tabwidget.currentChanged.connect(self.refresh_plugin) layout.addWidget(self.tabwidget) self.setLayout(layout)
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.explorer = ProjectExplorerWidget( self, name_filters=self.get_option('name_filters'), show_all=self.get_option('show_all'), show_hscrollbar=self.get_option('show_hscrollbar'), options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.explorer) self.setLayout(layout) self.recent_projects = self.get_option('recent_projects', default=[]) self.current_active_project = None self.latest_project = None self.editor = None self.workingdirectory = None # Initialize plugin self.initialize_plugin() self.explorer.setup_project(self.get_active_project_path())
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.pylint = PylintWidget(self, max_entries=max_entries, options_button=self.options_button, text_color=MAIN_TEXT_COLOR, prevrate_color=MAIN_PREVRATE_COLOR) layout = QVBoxLayout() layout.addWidget(self.pylint) self.setLayout(layout) # Add history_action to treewidget context menu history_action = create_action(self, _("History..."), None, ima.icon('history'), _("Set history maximum entries"), triggered=self.change_history_depth) self.pylint.treewidget.common_actions += (None, history_action) # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) # Create widget and add to dockwindow self.widget = LineProfilerWidget(self.main) layout = QVBoxLayout() layout.addWidget(self.widget) self.setLayout(layout)
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.gui = G.GUI(flags=["--noOutputpipe", "--noConsole"], startApplication=False, createMenu=False) G.gui = self.gui self.setLayout(ArrangeH(self.gui.mainWidget)) self.shellwidgets = {}
def __init__(self, parent): """Main plugin constructor.""" SpyderPluginWidget.__init__(self, parent) self.main = parent self.vim_cmd = VimWidget(self.main.editor, self.main) layout = QVBoxLayout() layout.addWidget(self.vim_cmd) self.setLayout(layout)
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.main = parent self.flowsheet_gui = FlowsheetWidget(flowsheet) # Graphical view layout = QVBoxLayout(self) layout.addWidget(self.flowsheet_gui) self.setLayout(layout)
def __init__(self, parent=None, namespace=None, commands=[], message=None, exitfunc=None, profile=False, multithreaded=False): SpyderPluginWidget.__init__(self, parent) debug_print(" ..internal console: initializing") self.dialog_manager = DialogManager() # Shell light_background = self.get_option('light_background') self.shell = InternalShell(parent, namespace, commands, message, self.get_option('max_line_count'), self.get_plugin_font(), exitfunc, profile, multithreaded, light_background=light_background) self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0)) self.shell.go_to_error.connect(self.go_to_error) self.shell.focus_changed.connect(lambda: self.focus_changed.emit()) # Redirecting some signals: self.shell.redirect_stdio.connect( lambda state: self.redirect_stdio.emit(state)) # Initialize plugin self.initialize_plugin() # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.set_editor(self.shell) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) # Main layout layout = QVBoxLayout() layout.addWidget(self.shell) layout.addWidget(self.find_widget) self.setLayout(layout) # Parameters self.shell.toggle_wrap_mode(self.get_option('wrap')) # Accepting drops self.setAcceptDrops(True) # Traceback MessageBox self.msgbox_traceback = None self.error_traceback = ""
def __init__(self, parent=None, testing=False): SpyderPluginWidget.__init__(self, parent) MxStackedMixin.__init__(self, parent) # Layout layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.stack) self.options_button.setVisible(False) self.setLayout(layout)
def __init__(self, parent=None, namespace=None, commands=[], message=None, exitfunc=None, profile=False, multithreaded=False): SpyderPluginWidget.__init__(self, parent) logger.info("Initializing...") self.dialog_manager = DialogManager() # Shell self.shell = InternalShell(parent, namespace, commands, message, self.get_option('max_line_count'), self.get_plugin_font(), exitfunc, profile, multithreaded) self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0)) self.shell.go_to_error.connect(self.go_to_error) self.shell.focus_changed.connect(lambda: self.focus_changed.emit()) # Redirecting some signals: self.shell.redirect_stdio.connect( lambda state: self.redirect_stdio.emit(state)) # Initialize plugin self.initialize_plugin() # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.set_editor(self.shell) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) # Main layout btn_layout = QHBoxLayout() btn_layout.setAlignment(Qt.AlignLeft) btn_layout.addStretch() btn_layout.addWidget(self.options_button, Qt.AlignRight) layout = create_plugin_layout(btn_layout) layout.addWidget(self.shell) layout.addWidget(self.find_widget) self.setLayout(layout) # Parameters self.shell.toggle_wrap_mode(self.get_option('wrap')) # Accepting drops self.setAcceptDrops(True) # Traceback MessageBox self.error_dlg = None self.error_traceback = "" self.dismiss_error = False
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) # Widgets self.stack = QStackedWidget(self) self.stack.setStyleSheet("QStackedWidget{padding: 0px; border: 0px}") self.shellwidgets = {} # Layout layout = QGridLayout(self) layout.addWidget(self.stack)
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.profiler = ProfilerWidget(self, max_entries, options_button=self.options_button, text_color=MAIN_TEXT_COLOR) layout = QVBoxLayout() layout.addWidget(self.profiler) self.setLayout(layout)
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.pylint = PylintWidget(self, max_entries=max_entries) layout = QVBoxLayout() layout.addWidget(self.pylint) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.profiler = ProfilerWidget(self, max_entries) layout = QVBoxLayout() layout.addWidget(self.profiler) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.breakpoints = BreakpointWidget(self, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.breakpoints) self.setLayout(layout) self.breakpoints.set_data()
def __init__(self, parent=None, css_path=CSS_PATH): SpyderPluginWidget.__init__(self, parent) self.shell = None self.var_info = [] # Object name layout_edit = QHBoxLayout() layout_edit.setContentsMargins(0, 0, 0, 0) pybutton = QPushButton('Select a File', self) pybutton.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) pybutton.clicked.connect(self.selectImageFile) pybutton1 = QPushButton('Color Conversion', self) pybutton1.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) pybutton1.clicked.connect(self.showdialog) pybutton2 = QPushButton('Thresholding', self) pybutton2.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) pybutton2.clicked.connect(self.showdialog2) pybutton3 = QPushButton('Blob Detection', self) pybutton3.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) pybutton3.clicked.connect(self.showdialog3) welcomeTitle = QLabel() welcomeTitle.setText("Welcome to Image Processr!") layout_edit.addWidget(pybutton) #layout_edit.addStretch() layout_edit.addWidget(pybutton1) #layout_edit.addStretch() layout_edit.addWidget(pybutton2) #layout_edit.addStretch() layout_edit.addWidget(pybutton3) # Main layout layout = create_plugin_layout(QVBoxLayout()) # we have two main widgets, but only one of them is shown at a time layout.addStretch() layout.addWidget(welcomeTitle) layout.addLayout(layout_edit) layout.addStretch() layout.addStretch() layout.addStretch() self.setLayout(layout) self._starting_up = True
def __init__(self, parent, testing=False): """Constructor.""" SpyderPluginWidget.__init__(self, parent) self.testing = testing self.fileswitcher_dlg = None self.tabwidget = None self.menu_actions = None self.main = parent self.clients = [] self.untitled_num = 0 self.recent_notebooks = self.get_option('recent_notebooks', default=[]) self.recent_notebook_menu = QMenu(_("Open recent"), self) self.options_menu = QMenu(self) # Initialize plugin self.initialize_plugin() layout = QVBoxLayout() new_notebook_btn = create_toolbutton(self, icon=ima.icon('project_expanded'), tip=_('Open a new notebook'), triggered=self.create_new_client) menu_btn = create_toolbutton(self, icon=ima.icon('tooloptions'), tip=_('Options')) menu_btn.setMenu(self.options_menu) menu_btn.setPopupMode(menu_btn.InstantPopup) add_actions(self.options_menu, self.menu_actions) corner_widgets = {Qt.TopRightCorner: [new_notebook_btn, menu_btn]} self.tabwidget = Tabs(self, menu=self.options_menu, actions=self.menu_actions, corner_widgets=corner_widgets) if hasattr(self.tabwidget, 'setDocumentMode') \ and not sys.platform == 'darwin': # Don't set document mode to true on OSX because it generates # a crash when the console is detached from the main window # Fixes Issue 561 self.tabwidget.setDocumentMode(True) self.tabwidget.currentChanged.connect(self.refresh_plugin) self.tabwidget.move_data.connect(self.move_tab) self.tabwidget.set_close_function(self.close_client) layout.addWidget(self.tabwidget) self.setLayout(layout)
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.breakpoints = BreakpointWidget(self) layout = QVBoxLayout() layout.addWidget(self.breakpoints) self.setLayout(layout) # Initialize plugin self.initialize_plugin() self.breakpoints.set_data()
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) # Widgets self.stack = QStackedWidget(self) self.shellwidgets = {} # Layout layout = QGridLayout(self) layout.addWidget(self.stack) # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.profiler = ProfilerWidget(self, max_entries, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.profiler) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.options_button.hide() self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} for option in CONF.options(self.CONF_SECTION): self.clients[option] = {'status': self.STOPPED, 'config': self.get_option(option), 'instance': None} self.register_queue[option] = []
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.pylint = PylintWidget(self, max_entries=max_entries, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.pylint) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None, namespace=None, commands=[], message=None, exitfunc=None, profile=False, multithreaded=False): SpyderPluginWidget.__init__(self, parent) logger.info("Initializing...") self.dialog_manager = DialogManager() # Shell light_background = self.get_option('light_background') self.shell = InternalShell(parent, namespace, commands, message, self.get_option('max_line_count'), self.get_plugin_font(), exitfunc, profile, multithreaded, light_background=light_background) self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0)) self.shell.go_to_error.connect(self.go_to_error) self.shell.focus_changed.connect(lambda: self.focus_changed.emit()) # Redirecting some signals: self.shell.redirect_stdio.connect(lambda state: self.redirect_stdio.emit(state)) # Initialize plugin self.initialize_plugin() # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.set_editor(self.shell) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) # Main layout btn_layout = QHBoxLayout() btn_layout.setAlignment(Qt.AlignLeft) btn_layout.addStretch() btn_layout.addWidget(self.options_button, Qt.AlignRight) layout = create_plugin_layout(btn_layout) layout.addWidget(self.shell) layout.addWidget(self.find_widget) self.setLayout(layout) # Parameters self.shell.toggle_wrap_mode(self.get_option('wrap')) # Accepting drops self.setAcceptDrops(True) # Traceback MessageBox self.error_dlg = None self.error_traceback = "" self.dismiss_error = False
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) max_entries = self.get_option('max_entries', 50) self.profiler = ProfilerWidget(self, max_entries, options_button=self.options_button, text_color=MAIN_TEXT_COLOR) layout = QVBoxLayout() layout.addWidget(self.profiler) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.options_button.hide() self.hide() self.lsp_plugins = {} self.clients = {} self.requests = {} self.register_queue = {} for option in CONF.options(self.CONF_SECTION): self.clients[option] = {'status': self.STOPPED, 'config': self.get_option(option), 'instance': None} self.register_queue[option] = []
def __init__(self, parent): self.tabwidget = None self.menu_actions = None self.dockviewer = None self.wrap_action = None self.editors = [] self.filenames = [] if PYQT5: SpyderPluginWidget.__init__(self, parent, main=parent) else: SpyderPluginWidget.__init__(self, parent) # Initialize plugin self.initialize_plugin() layout = QVBoxLayout() self.tabwidget = Tabs(self, self.menu_actions) self.tabwidget.currentChanged.connect(self.refresh_plugin) self.tabwidget.move_data.connect(self.move_tab) if sys.platform == 'darwin': tab_container = QWidget() tab_container.setObjectName('tab-container') tab_layout = QHBoxLayout(tab_container) tab_layout.setContentsMargins(0, 0, 0, 0) tab_layout.addWidget(self.tabwidget) layout.addWidget(tab_container) else: layout.addWidget(self.tabwidget) # Menu as corner widget options_button = create_toolbutton(self, text=_('Options'), icon=ima.icon('tooloptions')) options_button.setPopupMode(QToolButton.InstantPopup) menu = QMenu(self) add_actions(menu, self.menu_actions) options_button.setMenu(menu) self.tabwidget.setCornerWidget(options_button) # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) layout.addWidget(self.find_widget) self.setLayout(layout)
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.breakpoints = BreakpointWidget(self, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.breakpoints) self.setLayout(layout) self.breakpoints.set_data() path = osp.join(self.PLUGIN_PATH, self.IMG_PATH) self.icon = ima.icon('breakpoints', icon_path=path)
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.pydocbrowser = PydocBrowser(self, self.options_button) layout = QVBoxLayout() layout.addWidget(self.pydocbrowser) self.setLayout(layout) self.register_widget_shortcuts(self.pydocbrowser.find_widget) self.pydocbrowser.webview.set_zoom_factor( self.get_option('zoom_factor')) self.pydocbrowser.url_combo.setMaxCount( self.get_option('max_history_entries')) self.pydocbrowser.url_combo.addItems(self.load_history())
def __init__(self, parent=None): SpyderPluginWidget.__init__(self, parent) MxStackedMixin.__init__(self, parent) # Layout layout = QVBoxLayout() layout.addWidget(self.stack) if spyder.version_info > (4,): self.options_button.setVisible(False) self.setLayout(layout) if spyder.version_info < (4,): # Initialize plugin self.initialize_plugin()
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.fileexplorer = ExplorerWidget( self, name_filters=self.get_option('name_filters'), show_all=self.get_option('show_all'), show_icontext=self.get_option('show_icontext')) layout = QVBoxLayout() layout.addWidget(self.fileexplorer) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) self.tabwidget = None self.menu_actions = None self.dockviewer = None self.wrap_action = None self.editors = [] self.filenames = [] # Initialize plugin self.initialize_plugin() layout = QVBoxLayout() self.tabwidget = Tabs(self, self.menu_actions) self.tabwidget.currentChanged.connect(self.refresh_plugin) self.tabwidget.move_data.connect(self.move_tab) if sys.platform == 'darwin': tab_container = QWidget() tab_container.setObjectName('tab-container') tab_layout = QHBoxLayout(tab_container) tab_layout.setContentsMargins(0, 0, 0, 0) tab_layout.addWidget(self.tabwidget) layout.addWidget(tab_container) else: layout.addWidget(self.tabwidget) # Menu as corner widget options_button = create_toolbutton(self, text=_('Options'), icon=ima.icon('tooloptions')) options_button.setPopupMode(QToolButton.InstantPopup) menu = QMenu(self) add_actions(menu, self.menu_actions) options_button.setMenu(menu) self.tabwidget.setCornerWidget(options_button) # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) layout.addWidget(self.find_widget) self.setLayout(layout)
def __init__(self, parent): SpyderPluginWidget.__init__(self, parent) # Initialize plugin self.initialize_plugin() self.pydocbrowser = PydocBrowser(self, self.options_button) layout = QVBoxLayout() layout.addWidget(self.pydocbrowser) self.setLayout(layout) self.register_widget_shortcuts(self.pydocbrowser.find_widget) self.pydocbrowser.webview.set_zoom_factor( self.get_option('zoom_factor')) self.pydocbrowser.url_combo.setMaxCount( self.get_option('max_history_entries')) self.pydocbrowser.url_combo.addItems( self.load_history() )
def __init__(self, parent): """Initialize plugin and create History main widget.""" SpyderPluginWidget.__init__(self, parent) self.tabwidget = None self.dockviewer = None self.wrap_action = None self.linenumbers_action = None self.editors = [] self.filenames = [] # Initialize plugin actions, toolbutton and general signals self.initialize_plugin() layout = QVBoxLayout() self.tabwidget = Tabs(self, self.plugin_actions) self.tabwidget.currentChanged.connect(self.refresh_plugin) self.tabwidget.move_data.connect(self.move_tab) if sys.platform == 'darwin': tab_container = QWidget() tab_container.setObjectName('tab-container') tab_layout = QHBoxLayout(tab_container) tab_layout.setContentsMargins(0, 0, 0, 0) tab_layout.addWidget(self.tabwidget) layout.addWidget(tab_container) else: layout.addWidget(self.tabwidget) # Menu as corner widget self.tabwidget.setCornerWidget(self.options_button) # Find/replace widget self.find_widget = FindReplace(self) self.find_widget.hide() self.register_widget_shortcuts(self.find_widget) layout.addWidget(self.find_widget) self.setLayout(layout)
def __init__(self, parent=None, fullpath_sorting=True): SpyderPluginWidget.__init__(self, parent) show_fullpath = self.get_option('show_fullpath') show_all_files = self.get_option('show_all_files') show_comments = self.get_option('show_comments') self.explorer = OutlineExplorerWidget( self, show_fullpath=show_fullpath, fullpath_sorting=fullpath_sorting, show_all_files=show_all_files, show_comments=show_comments) layout = QVBoxLayout() layout.addWidget(self.explorer) self.setLayout(layout) # Initialize plugin self.initialize_plugin() self.explorer.treewidget.header().hide() self.load_config()
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) self.fileexplorer = ExplorerWidget( self, name_filters=self.get_option('name_filters'), show_all=self.get_option('show_all'), show_icontext=self.get_option('show_icontext'), options_button=self.options_button, single_click_to_open=self.get_option('single_click_to_open'), ) # Initialize plugin self.initialize_plugin() layout = QVBoxLayout() layout.addWidget(self.fileexplorer) self.setLayout(layout) self.fileexplorer.sig_option_changed.connect( self._update_config_options)
def __init__(self, parent=None): """Initialization.""" SpyderPluginWidget.__init__(self, parent) supported_encodings = self.get_option('supported_encodings') search_path = self.get_option('search_path', None) self.search_text_samples = self.get_option('search_text_samples') search_text = self.get_option('search_text') search_text = [txt for txt in search_text \ if txt not in self.search_text_samples] search_text += self.search_text_samples search_text_regexp = self.get_option('search_text_regexp') exclude = self.get_option('exclude') exclude_idx = self.get_option('exclude_idx', None) exclude_regexp = self.get_option('exclude_regexp') in_python_path = self.get_option('in_python_path') more_options = self.get_option('more_options') case_sensitive = self.get_option('case_sensitive') path_history = self.get_option('path_history', []) self.findinfiles = FindInFilesWidget( self, search_text, search_text_regexp, search_path, exclude, exclude_idx, exclude_regexp, supported_encodings, in_python_path, more_options, case_sensitive, path_history, options_button=self.options_button) layout = QVBoxLayout() layout.addWidget(self.findinfiles) self.setLayout(layout) # Initialize plugin self.initialize_plugin() self.toggle_visibility.connect(self.toggle)
def __init__(self, parent, workdir=None, **kwds): SpyderPluginWidget.__init__(self, parent) self.hide() self.toolbar = QToolBar(self) # Initialize plugin self.initialize_plugin() self.options_button.hide() self.toolbar.setWindowTitle(self.get_plugin_title()) # Used to save Window state self.toolbar.setObjectName(self.get_plugin_title()) # Previous dir action self.history = [] self.histindex = None self.previous_action = create_action(self, "previous", None, ima.icon('previous'), _('Back'), triggered=self.previous_directory) self.toolbar.addAction(self.previous_action) # Next dir action self.next_action = create_action(self, "next", None, ima.icon('next'), _('Next'), triggered=self.next_directory) self.toolbar.addAction(self.next_action) # Enable/disable previous/next actions self.set_previous_enabled.connect(self.previous_action.setEnabled) self.set_next_enabled.connect(self.next_action.setEnabled) # Path combo box adjust = self.get_option('working_dir_adjusttocontents') self.pathedit = PathComboBox(self, adjust_to_contents=adjust) self.pathedit.setToolTip(_("This is the working directory for newly\n" "opened consoles (Python/IPython consoles and\n" "terminals), for the file explorer, for the\n" "find in files plugin and for new files\n" "created in the editor")) self.pathedit.open_dir.connect(self.chdir) self.pathedit.activated[str].connect(self.chdir) self.pathedit.setMaxCount(self.get_option('working_dir_history')) wdhistory = self.load_wdhistory(workdir) if workdir is None: if self.get_option('console/use_project_or_home_directory'): workdir = get_home_dir() else: workdir = self.get_option('console/fixed_directory', default='') if not osp.isdir(workdir): workdir = get_home_dir() self.chdir(workdir) self.pathedit.addItems(wdhistory) self.pathedit.selected_text = self.pathedit.currentText() self.refresh_plugin() self.toolbar.addWidget(self.pathedit) # Browse action browse_action = create_action(self, "browse", None, ima.icon('DirOpenIcon'), _('Browse a working directory'), triggered=self.select_directory) self.toolbar.addAction(browse_action) # Parent dir action parent_action = create_action(self, "parent", None, ima.icon('up'), _('Change to parent directory'), triggered=self.parent_directory) self.toolbar.addAction(parent_action)
def __init__(self, parent=None, css_path=CSS_PATH): SpyderPluginWidget.__init__(self, parent) self.internal_shell = None self.console = None self.css_path = css_path # Initialize plugin self.initialize_plugin() self.no_doc_string = _("No documentation available") self._last_console_cb = None self._last_editor_cb = None self.plain_text = PlainText(self) self.rich_text = RichText(self) color_scheme = self.get_color_scheme() self.set_plain_text_font(self.get_plugin_font(), color_scheme) self.plain_text.editor.toggle_wrap_mode(self.get_option('wrap')) # Add entries to read-only editor context-menu self.wrap_action = create_action(self, _("Wrap lines"), toggled=self.toggle_wrap_mode) self.wrap_action.setChecked(self.get_option('wrap')) self.plain_text.editor.readonly_menu.addSeparator() add_actions(self.plain_text.editor.readonly_menu, (self.wrap_action,)) self.set_rich_text_font(self.get_plugin_font('rich_text')) self.shell = None # locked = disable link with Console self.locked = False self._last_texts = [None, None] self._last_editor_doc = None # Object name layout_edit = QHBoxLayout() layout_edit.setContentsMargins(0, 0, 0, 0) txt = _("Source") if sys.platform == 'darwin': source_label = QLabel(" " + txt) else: source_label = QLabel(txt) layout_edit.addWidget(source_label) self.source_combo = QComboBox(self) self.source_combo.addItems([_("Console"), _("Editor")]) self.source_combo.currentIndexChanged.connect(self.source_changed) if (not programs.is_module_installed('rope') and not programs.is_module_installed('jedi', '>=0.11.0')): self.source_combo.hide() source_label.hide() layout_edit.addWidget(self.source_combo) layout_edit.addSpacing(10) layout_edit.addWidget(QLabel(_("Object"))) self.combo = ObjectComboBox(self) layout_edit.addWidget(self.combo) self.object_edit = QLineEdit(self) self.object_edit.setReadOnly(True) layout_edit.addWidget(self.object_edit) self.combo.setMaxCount(self.get_option('max_history_entries')) self.combo.addItems( self.load_history() ) self.combo.setItemText(0, '') self.combo.valid.connect(lambda valid: self.force_refresh()) # Plain text docstring option self.docstring = True self.rich_help = self.get_option('rich_mode', True) self.plain_text_action = create_action(self, _("Plain Text"), toggled=self.toggle_plain_text) # Source code option self.show_source_action = create_action(self, _("Show Source"), toggled=self.toggle_show_source) # Rich text option self.rich_text_action = create_action(self, _("Rich Text"), toggled=self.toggle_rich_text) # Add the help actions to an exclusive QActionGroup help_actions = QActionGroup(self) help_actions.setExclusive(True) help_actions.addAction(self.plain_text_action) help_actions.addAction(self.rich_text_action) # Automatic import option self.auto_import_action = create_action(self, _("Automatic import"), toggled=self.toggle_auto_import) auto_import_state = self.get_option('automatic_import') self.auto_import_action.setChecked(auto_import_state) # Lock checkbox self.locked_button = create_toolbutton(self, triggered=self.toggle_locked) layout_edit.addWidget(self.locked_button) self._update_lock_icon() # Option menu self.menu = QMenu(self) add_actions(self.menu, [self.rich_text_action, self.plain_text_action, self.show_source_action, MENU_SEPARATOR, self.auto_import_action, MENU_SEPARATOR, self.undock_action]) self.options_button.setMenu(self.menu) layout_edit.addWidget(self.options_button) if self.rich_help: self.switch_to_rich_text() else: self.switch_to_plain_text() self.plain_text_action.setChecked(not self.rich_help) self.rich_text_action.setChecked(self.rich_help) self.source_changed() # Main layout layout = create_plugin_layout(layout_edit) # we have two main widgets, but only one of them is shown at a time layout.addWidget(self.plain_text) layout.addWidget(self.rich_text) self.setLayout(layout) # Add worker thread for handling rich text rendering self._sphinx_thread = SphinxThread( html_text_no_doc=warning(self.no_doc_string, css_path=self.css_path), css_path=self.css_path) self._sphinx_thread.html_ready.connect( self._on_sphinx_thread_html_ready) self._sphinx_thread.error_msg.connect(self._on_sphinx_thread_error_msg) # Handle internal and external links view = self.rich_text.webview if not WEBENGINE: view.page().setLinkDelegationPolicy(QWebEnginePage.DelegateAllLinks) view.linkClicked.connect(self.handle_link_clicks) self._starting_up = True