Beispiel #1
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        # Widgets, layouts and signals
        self._group = QButtonGroup()

        layout = QGridLayout()
        layout.setSpacing(0)

        ## Element
        for z, position in _ELEMENT_POSITIONS.items():
            widget = ElementPushButton(z)
            widget.setCheckable(True)
            layout.addWidget(widget, *position)
            self._group.addButton(widget, z)

        ## Labels
        layout.addWidget(QLabel(''), 7, 0) # Dummy
        layout.addWidget(QLabel('*'), 5, 2, Qt.AlignRight)
        layout.addWidget(QLabel('*'), 8, 2, Qt.AlignRight)
        layout.addWidget(QLabel('**'), 6, 2, Qt.AlignRight)
        layout.addWidget(QLabel('**'), 9, 2, Qt.AlignRight)

        for row in [0, 1, 2, 3, 4, 5, 6, 8, 9]:
            layout.setRowStretch(row, 1)

        self.setLayout(layout)

        # Signals
        self._group.buttonClicked.connect(self.selectionChanged)

        # Default
        self.setColorFunction(_category_color_function)
Beispiel #2
0
    def __init__(self, parent, name, script="", filemodified=0):
        QWidget.__init__(self)
        self.parent = parent
        self.tabWidget = self.parent.ui.tabWidget
        self.gridlayout = QGridLayout(self)
        self._dirty = False

        self.initialize_editor()
        self.gridlayout.addWidget(self.editor)

        self.setAcceptDrops(True)

        self.filename = name
        self.filemodified = filemodified
        if self.is_file():
            self.title = os.path.basename(name)
            # if self.equals_saved():
            #    self.filemodified = os.path.getmtime(self.filename)
        else:
            self.filename = ""
            self.title = name

        # Show this file in the self.editor
        self.editor.setText(script)
        self.clean_txt = self.saved()

        self.update_dirty()

        self.editor.keyPressEvent = self.key_press_event
Beispiel #3
0
    def __init__(self, name, a, b, callback):
        QWidget.__init__(self)
        self.name = name
        self.callback = callback
        self.a = a
        self.b = b
        self.manually_triggered = False

        self.slider = QSlider()
        self.slider.setRange(0, 1000)
        self.slider.setValue(500)
        self.slider.valueChanged.connect(self.slider_changed)

        self.name_label = QLabel()
        self.name_label.setText(self.name)
        self.name_label.setAlignment(QtCore.Qt.AlignCenter)

        self.value_label = QLabel()
        self.value_label.setText('%2.2f' % (self.slider.value() * self.a
                                             + self.b))
        self.value_label.setAlignment(QtCore.Qt.AlignCenter)

        self.layout = QGridLayout(self)
        self.layout.addWidget(self.name_label, 0, 0)
        self.layout.addWidget(self.slider, 1, 0, QtCore.Qt.AlignHCenter)
        self.layout.addWidget(self.value_label, 2, 0)
Beispiel #4
0
    def __init__(self, parent=None, state=None, settings=None, data_type=None, ui_class=None, data_proxy=None):
        QWidget.__init__(self, parent)

        self._layout = QHBoxLayout()
        self.setLayout(self._layout)
        if ui_class is not None:
            self._content = ui_class(self)
            self._layout.addWidget(self._content)

        # Data filter for file dialog
        self._data_type="Data files (*.xml)"
        if data_type is not None:
            self._data_type = data_type

        # General GUI settings
        if settings is None:
            settings = GeneralSettings()
        self._settings = settings

        if ui_class is not None:
            self.setLayout(self._layout)
            self.initialize_content()

        self._instrument_view = None
        self._data_set_viewed = ''

        self._data_proxy = data_proxy
        self._has_instrument_view = HAS_INSTRUMENT_VIEW and self._data_proxy is not None

        self._is_running = True
Beispiel #5
0
 def __init__(self, counts, colormap):
     QWidget.__init__(self)
     self._validate_input(counts, colormap)
     self.counts = counts
     self.n = np.sum(self.counts)
     self.colormap = colormap
     self.setMinimumSize(100, 50)
Beispiel #6
0
    def __init__(self, parent=None, show_fullpath=True, fullpath_sorting=True,
                 show_all_files=True, show_comments=True, options_button=None):
        QWidget.__init__(self, parent)

        self.treewidget = OutlineExplorerTreeWidget(self,
                                            show_fullpath=show_fullpath,
                                            fullpath_sorting=fullpath_sorting,
                                            show_all_files=show_all_files,
                                            show_comments=show_comments)

        self.visibility_action = create_action(self,
                                           _("Show/hide outline explorer"),
                                           icon='outline_explorer_vis.png',
                                           toggled=self.toggle_visibility)
        self.visibility_action.setChecked(True)
        
        btn_layout = QHBoxLayout()
        for btn in self.setup_buttons():
            btn.setAutoRaise(True)
            btn.setIconSize(QSize(16, 16))
            btn_layout.addWidget(btn)
        if options_button:
            btn_layout.addStretch()
            btn_layout.addWidget(options_button, Qt.AlignRight)

        layout = create_plugin_layout(btn_layout, self.treewidget)
        self.setLayout(layout)
Beispiel #7
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        vert_layout = QVBoxLayout()

        # Type frame
        type_layout = QHBoxLayout()
        type_label = QLabel(_("Import as"))
        type_layout.addWidget(type_label)

        self.array_btn = array_btn = QRadioButton(_("array"))
        array_btn.setEnabled(ndarray is not FakeObject)
        array_btn.setChecked(ndarray is not FakeObject)
        type_layout.addWidget(array_btn)

        list_btn = QRadioButton(_("list"))
        list_btn.setChecked(not array_btn.isChecked())
        type_layout.addWidget(list_btn)

        if pd:
            self.df_btn = df_btn = QRadioButton(_("DataFrame"))
            df_btn.setChecked(False)
            type_layout.addWidget(df_btn)

        h_spacer = QSpacerItem(40, 20,
                               QSizePolicy.Expanding, QSizePolicy.Minimum)
        type_layout.addItem(h_spacer)
        type_frame = QFrame()
        type_frame.setLayout(type_layout)

        self._table_view = PreviewTable(self)
        vert_layout.addWidget(type_frame)
        vert_layout.addWidget(self._table_view)
        self.setLayout(vert_layout)
Beispiel #8
0
    def __init__(self):
        QWidget.__init__(self)
        vlayout = QVBoxLayout()
        self.setLayout(vlayout)

        self.explorer = ProjectExplorerWidget(None, show_all=True)
        self.explorer.setup_project(osp.dirname(osp.abspath(__file__)))
        vlayout.addWidget(self.explorer)

        hlayout1 = QHBoxLayout()
        vlayout.addLayout(hlayout1)
        label = QLabel("<b>Open file:</b>")
        label.setAlignment(Qt.AlignRight)
        hlayout1.addWidget(label)
        self.label1 = QLabel()
        hlayout1.addWidget(self.label1)
        self.explorer.sig_open_file.connect(self.label1.setText)

        hlayout3 = QHBoxLayout()
        vlayout.addLayout(hlayout3)
        label = QLabel("<b>Option changed:</b>")
        label.setAlignment(Qt.AlignRight)
        hlayout3.addWidget(label)
        self.label3 = QLabel()
        hlayout3.addWidget(self.label3)
        self.explorer.sig_option_changed.connect(
           lambda x, y: self.label3.setText('option_changed: %r, %r' % (x, y)))
Beispiel #9
0
    def __init__(self, parent, name_filters=[],
                 show_all=True, show_hscrollbar=True, options_button=None):
        QWidget.__init__(self, parent)

        self.name_filters = name_filters
        self.show_all = show_all
        self.show_hscrollbar = show_hscrollbar

        self.treewidget = ExplorerTreeWidget(self, self.show_hscrollbar)
        self.treewidget.setup(name_filters=self.name_filters,
                              show_all=self.show_all)
        self.treewidget.setup_view()
        self.treewidget.hide()

        self.emptywidget = ExplorerTreeWidget(self)

        if options_button:
            btn_layout = QHBoxLayout()
            btn_layout.setAlignment(Qt.AlignLeft)
            btn_layout.addStretch()
            btn_layout.addWidget(options_button, Qt.AlignRight)
            layout = create_plugin_layout(btn_layout)
        else:
            layout = QVBoxLayout()
            layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.emptywidget)
        layout.addWidget(self.treewidget)
        self.setLayout(layout)
Beispiel #10
0
    def __init__(self, parent=None, init_channel=None):
        QWidget.__init__(self, parent)
        PyDMWidget.__init__(self, init_channel=init_channel)
        self.value = 0
        self.setLayout(QGridLayout(self))

        self._on_color = QColor(0, 255, 0)
        self._off_color = QColor(100, 100, 100)
        self._disconnected_color = QColor(255, 255, 255)
        self._invalid_color = QColor(255, 0, 255)

        self._pen_style = Qt.SolidLine
        self._line_pen = QPen(self._pen_style)

        self._orientation = Qt.Vertical

        # This is kind of ridiculous, importing QTabWidget just to get a 4-item enum thats usable in Designer.
        # PyQt5 lets you define custom enums that you can use in designer with QtCore.Q_ENUMS(), doesn't exist in PyQt4.
        self._labels = []
        self._show_labels = True
        self._label_position = QTabWidget.East

        self._num_bits = 1

        self._indicators = []
        self._circles = False
        self.set_spacing()
        self.layout().setOriginCorner(Qt.TopLeftCorner)

        self._big_endian = False
        self._shift = 0
        self.numBits = 1  # Need to set the property to initialize
Beispiel #11
0
 def __init__(self, parent=None, logname=None, level=logging.NOTSET):
     QWidget.__init__(self, parent=parent)
     # Create Widgets
     self.label = QLabel('Minimum displayed log level: ', parent=self)
     self.combo = QComboBox(parent=self)
     self.text = QPlainTextEdit(parent=self)
     self.text.setReadOnly(True)
     self.clear_btn = QPushButton("Clear", parent=self)
     # Create layout
     layout = QVBoxLayout()
     level_control = QHBoxLayout()
     level_control.addWidget(self.label)
     level_control.addWidget(self.combo)
     layout.addLayout(level_control)
     layout.addWidget(self.text)
     layout.addWidget(self.clear_btn)
     self.setLayout(layout)
     # Allow QCombobox to control log level
     for log_level, value in LogLevels.as_dict().items():
         self.combo.addItem(log_level, value)
     self.combo.currentIndexChanged[str].connect(self.setLevel)
     # Allow QPushButton to clear log text
     self.clear_btn.clicked.connect(self.clear)
     # Create a handler with the default format
     self.handler = GuiHandler(level=level, parent=self)
     self.logFormat = self.default_format
     self.handler.message.connect(self.write)
     # Create logger. Either as a root or given logname
     self.log = None
     self.level = None
     self.logName = logname or ''
     self.logLevel = level
     self.destroyed.connect(functools.partial(logger_destroyed, self.log))
Beispiel #12
0
    def __init__(self, parent, options_button=None, plugin_actions=[]):
        QWidget.__init__(self, parent)
        
        self.shellwidget = None
        self.is_visible = True
        self.setup_in_progress = None

        # Remote dict editor settings
        self.check_all = None
        self.exclude_private = None
        self.exclude_uppercase = None
        self.exclude_capitalized = None
        self.exclude_unsupported = None
        self.excluded_names = None
        self.minmax = None
        
        # Other setting
        self.dataframe_format = None

        self.editor = None
        self.exclude_private_action = None
        self.exclude_uppercase_action = None
        self.exclude_capitalized_action = None
        self.exclude_unsupported_action = None
        self.options_button = options_button
        self.actions = None
        self.plugin_actions = plugin_actions

        self.filename = None
Beispiel #13
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self._parent = parent
        self.cp = CondaProcess(self)

        # Widgets
        self.button_get_conda_version = QPushButton('get_conda_version')
        self.button_info = QPushButton('info')
        self.button_get_envs = QPushButton('get envs')
        self.button_install = QPushButton('install')
        self.button_package_info = QPushButton('package info')
        self.button_linked = QPushButton('linked')
        self.button_pip = QPushButton('pip')
        self.button_pip_remove = QPushButton('pip-remove')

        self.widgets = [self.button_get_conda_version, self.button_info,
                        self.button_get_envs, self.button_install,
                        self.button_package_info, self.button_linked,
                        self.button_pip]

        # Layout setup
        layout_top = QHBoxLayout()
        layout_top.addWidget(self.button_get_conda_version)
        layout_top.addWidget(self.button_get_envs)
        layout_top.addWidget(self.button_info)
        layout_top.addWidget(self.button_install)
        layout_top.addWidget(self.button_package_info)

        layout_middle = QHBoxLayout()
        layout_middle.addWidget(self.button_linked)

        layout_bottom = QHBoxLayout()
        layout_bottom.addWidget(self.button_pip)
        layout_bottom.addWidget(self.button_pip_remove)

        layout = QVBoxLayout()
        layout.addLayout(layout_top)
        layout.addLayout(layout_middle)
        layout.addLayout(layout_bottom)

        self.setLayout(layout)

        # Signals
        self.cp.sig_started.connect(self.disable_widgets)
        self.cp.sig_finished.connect(self.on_finished)
        self.cp.sig_finished.connect(self.enable_widgets)

        self.button_get_conda_version.clicked.connect(
            self.cp.get_conda_version)
        self.button_get_envs.clicked.connect(self.cp.get_envs)
        self.button_info.clicked.connect(self.cp.info)
        self.button_install.clicked.connect(self.cp.install)
        self.button_package_info.clicked.connect(
            lambda: self.cp.package_info('spyder'))
        self.button_linked.clicked.connect(
            lambda: self.cp.linked(self.cp.ROOT_PREFIX))
        self.button_pip.clicked.connect(lambda: self.cp.pip(name='root'))
        self.button_pip_remove.clicked.connect(
            lambda: self.cp.pip_remove(name='root', pkgs=['grequests']))
Beispiel #14
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        
        self.shellwidget = None
        self.is_internal_shell = None
        self.ipyclient = None
        self.is_ipykernel = None
        self.is_visible = True
        self.setup_in_progress = None

        # Remote dict editor settings
        self.check_all = None
        self.exclude_private = None
        self.exclude_uppercase = None
        self.exclude_capitalized = None
        self.exclude_unsupported = None
        self.excluded_names = None
        self.truncate = None
        self.minmax = None
        self.remote_editing = None
        self.autorefresh = None
        
        self.editor = None
        self.exclude_private_action = None
        self.exclude_uppercase_action = None
        self.exclude_capitalized_action = None
        self.exclude_unsupported_action = None
        
        self.filename = None
Beispiel #15
0
    def __init__(self, parent=None, show_fullpath=True, fullpath_sorting=True,
                 show_all_files=True, show_comments=True):
        QWidget.__init__(self, parent)

        self.treewidget = OutlineExplorerTreeWidget(self,
                                            show_fullpath=show_fullpath,
                                            fullpath_sorting=fullpath_sorting,
                                            show_all_files=show_all_files,
                                            show_comments=show_comments)

        self.visibility_action = create_action(self,
                                           _("Show/hide outline explorer"),
                                           icon='outline_explorer_vis.png',
                                           toggled=self.toggle_visibility)
        self.visibility_action.setChecked(True)
        
        btn_layout = QHBoxLayout()
        btn_layout.setAlignment(Qt.AlignLeft)
        for btn in self.setup_buttons():
            btn_layout.addWidget(btn)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(btn_layout)
        layout.addWidget(self.treewidget)
        self.setLayout(layout)
Beispiel #16
0
 def __init__(self, editor_stack):
     """Main Window Mock constructor."""
     QWidget.__init__(self, None)
     self.plugin_focus_changed = Mock()
     self.editor = EditorMock(editor_stack)
     layout = QVBoxLayout()
     layout.addWidget(self.editor)
     self.setLayout(layout)
Beispiel #17
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self._parent = parent
        self.cp = CondaProcess(self)

        # Widgets
        self.button_get_conda_version = QPushButton("get_conda_version")
        self.button_info = QPushButton("info")
        self.button_get_envs = QPushButton("get envs")
        self.button_install = QPushButton("install")
        self.button_package_info = QPushButton("package info")
        self.button_linked = QPushButton("linked")
        self.button_pip = QPushButton("pip")

        self.widgets = [
            self.button_get_conda_version,
            self.button_info,
            self.button_get_envs,
            self.button_install,
            self.button_package_info,
            self.button_linked,
            self.button_pip,
        ]

        # Layout setup
        layout_top = QHBoxLayout()
        layout_top.addWidget(self.button_get_conda_version)
        layout_top.addWidget(self.button_get_envs)
        layout_top.addWidget(self.button_info)
        layout_top.addWidget(self.button_install)
        layout_top.addWidget(self.button_package_info)

        layout_middle = QHBoxLayout()
        layout_middle.addWidget(self.button_linked)

        layout_bottom = QHBoxLayout()
        layout_bottom.addWidget(self.button_pip)

        layout = QVBoxLayout()
        layout.addLayout(layout_top)
        layout.addLayout(layout_middle)
        layout.addLayout(layout_bottom)

        self.setLayout(layout)

        # Signals
        self.cp.sig_started.connect(self.disable_widgets)
        self.cp.sig_finished.connect(self.on_finished)
        self.cp.sig_finished.connect(self.enable_widgets)

        self.button_get_conda_version.clicked.connect(self.cp.get_conda_version)
        self.button_get_envs.clicked.connect(self.cp.get_envs)
        self.button_info.clicked.connect(self.cp.info)
        self.button_install.clicked.connect(self.cp.install)
        self.button_package_info.clicked.connect(lambda: self.cp.package_info("spyder"))
        self.button_linked.clicked.connect(lambda: self.cp.linked(self.cp.ROOT_PREFIX))
        self.button_pip.clicked.connect(lambda: self.cp.pip("root"))
Beispiel #18
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     vlayout = QVBoxLayout()
     self.setLayout(vlayout)
     self.treewidget = FilteredDirView(self)
     self.treewidget.setup_view()
     self.treewidget.set_root_path(osp.dirname(osp.abspath(__file__)))
     self.treewidget.set_folder_names(['variableexplorer', 'sourcecode'])
     vlayout.addWidget(self.treewidget)
Beispiel #19
0
 def __init__(self, parent, name_filters=[],
              show_all=True, show_hscrollbar=True):
     QWidget.__init__(self, parent)
     self.treewidget = None
     self.emptywidget = None
     self.name_filters = name_filters
     self.show_all = show_all
     self.show_hscrollbar = show_hscrollbar
     self.setup_layout()
Beispiel #20
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self.parent = parent
        
        # Variables to adjust 
        self.duration_canvas = [666, 666]
        self.duration_tips = [333, 333]
        self.opacity_canvas = [0.0, 0.7]
        self.opacity_tips = [0.0, 1.0]
        self.color = Qt.black
        self.easing_curve = [QEasingCurve.Linear]

        self.current_step = 0
        self.step_current = 0
        self.steps = 0
        self.canvas = None
        self.tips = None
        self.frames = None
        self.spy_window = None

        self.widgets = None
        self.dockwidgets = None
        self.decoration = None
        self.run = None

        self.is_tour_set = False

        # Widgets
        self.canvas = FadingCanvas(self.parent, self.opacity_canvas,
                                   self.duration_canvas, self.easing_curve,
                                   self.color)
        self.tips = FadingTipBox(self.parent, self.opacity_tips,
                                 self.duration_tips, self.easing_curve)

        # Widgets setup
        # Needed to fix issue #2204
        self.setAttribute(Qt.WA_TransparentForMouseEvents)

        # Signals and slots
        self.tips.button_next.clicked.connect(self.next_step)
        self.tips.button_previous.clicked.connect(self.previous_step)
        self.tips.button_close.clicked.connect(self.close_tour)
        self.tips.button_run.clicked.connect(self.run_code)
        self.tips.button_home.clicked.connect(self.first_step)
        self.tips.button_end.clicked.connect(self.last_step)
        self.tips.button_run.clicked.connect(
            lambda: self.tips.button_run.setDisabled(True))
        self.tips.combo_title.currentIndexChanged.connect(self.go_to_step)

        # Main window move or resize
        self.parent.sig_resized.connect(self._resized)
        self.parent.sig_moved.connect(self._moved)

        # To capture the arrow keys that allow moving the tour
        self.tips.sig_key_pressed.connect(self._key_pressed)
Beispiel #21
0
    def __init__(self, parent,
                 search_text = r"# ?TODO|# ?FIXME|# ?XXX",
                 search_text_regexp=True, search_path=None,
                 include=[".", ".py"], include_idx=None, include_regexp=True,
                 exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None,
                 exclude_regexp=True,
                 supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
                 in_python_path=False, more_options=False):
        QWidget.__init__(self, parent)
        
        self.setWindowTitle(_('Find in files'))

        self.search_thread = None
        self.get_pythonpath_callback = None
        
        self.find_options = FindOptions(self, search_text, search_text_regexp,
                                        search_path,
                                        include, include_idx, include_regexp,
                                        exclude, exclude_idx, exclude_regexp,
                                        supported_encodings, in_python_path,
                                        more_options)
        self.find_options.find.connect(self.find)
        self.find_options.stop.connect(self.stop_and_reset_thread)
        
        self.result_browser = ResultsBrowser(self)
        
        collapse_btn = create_toolbutton(self)
        collapse_btn.setDefaultAction(self.result_browser.collapse_all_action)
        expand_btn = create_toolbutton(self)
        expand_btn.setDefaultAction(self.result_browser.expand_all_action)
        restore_btn = create_toolbutton(self)
        restore_btn.setDefaultAction(self.result_browser.restore_action)
#        collapse_sel_btn = create_toolbutton(self)
#        collapse_sel_btn.setDefaultAction(
#                                self.result_browser.collapse_selection_action)
#        expand_sel_btn = create_toolbutton(self)
#        expand_sel_btn.setDefaultAction(
#                                self.result_browser.expand_selection_action)
        
        btn_layout = QVBoxLayout()
        btn_layout.setAlignment(Qt.AlignTop)
        for widget in [collapse_btn, expand_btn, restore_btn]:
#                       collapse_sel_btn, expand_sel_btn]:
            btn_layout.addWidget(widget)
        
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.result_browser)
        hlayout.addLayout(btn_layout)
        
        layout = QVBoxLayout()
        left, _x, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(left, 0, right, bottom)
        layout.addWidget(self.find_options)
        layout.addLayout(hlayout)
        self.setLayout(layout)
Beispiel #22
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self.status_text = QLabel(self)
        self.spinner = QWaitingSpinner(self, centerOnParent=False)
        self.spinner.setNumberOfLines(12)
        self.spinner.setInnerRadius(2)
        layout = QHBoxLayout()
        layout.addWidget(self.spinner)
        layout.addWidget(self.status_text)
        self.setLayout(layout)
Beispiel #23
0
 def __init__(self, parent=None, include_hidden=False):
     """
     Initialise a new instance of AlgorithmSelectorWidget
     :param parent: A parent QWidget
     :param include_hidden: If True the widget must include all hidden algorithms
     """
     self.execute_button = None
     self.search_box = None
     self.tree = None
     QWidget.__init__(self, parent)
     IAlgorithmSelectorView.__init__(self, include_hidden)
Beispiel #24
0
    def __init__(self, parent, statusbar):
        QWidget.__init__(self, parent)

        self.label_font = font = get_font(option='rich_font')
        font.setPointSize(self.font().pointSize())
        font.setBold(True)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        statusbar.addPermanentWidget(self)
Beispiel #25
0
 def __init__(self, parent=None, init_channel=None):
     QWidget.__init__(self, parent)
     PyDMWritableWidget.__init__(self, init_channel=init_channel)
     self._has_enums = False
     self.setLayout(QGridLayout(self))
     self._btn_group = QButtonGroup()
     self._btn_group.setExclusive(True)
     self._btn_group.buttonClicked[int].connect(self.handle_button_clicked)
     self._widget_type = WidgetType.PushButton
     self._orientation = Qt.Vertical
     self._widgets = []
     self.rebuild_widgets()
Beispiel #26
0
    def __init__(self, editor_stack):
        """Editor Mock constructor."""
        QWidget.__init__(self, None)
        self.editor_stack = editor_stack
        self.editorsplitter = self.editor_stack
        self.open_action = Mock()
        self.new_action = Mock()
        self.save_action = Mock()
        self.close_action = Mock()

        layout = QVBoxLayout()
        layout.addWidget(self.editor_stack)
        self.setLayout(layout)
Beispiel #27
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self.webview = FrameWebView(self)
        self.find_widget = FindReplace(self)
        self.find_widget.set_editor(self.webview.web_widget)
        self.find_widget.hide()

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.webview)
        layout.addWidget(self.find_widget)
        self.setLayout(layout)
Beispiel #28
0
 def __init__(self, parent=None, init_channel=None):
     QWidget.__init__(self, parent)
     PyDMWidget.__init__(self, init_channel=init_channel)
     if 'Index' not in PyDMSymbol.RULE_PROPERTIES:
         PyDMSymbol.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
         PyDMSymbol.RULE_PROPERTIES.update(
             {'Index': ['set_current_key', object]})
     self.app = QApplication.instance()
     self._current_key = 0
     self._state_images_string = ""
     self._state_images = {}  # Keyed on state values (ints), values are (filename, qpixmap or qsvgrenderer) tuples.
     self._aspect_ratio_mode = Qt.KeepAspectRatio
     self._sizeHint = self.minimumSizeHint()
     self._painter = QPainter()
Beispiel #29
0
 def __init__(self,mmc,qnd,initial_frame):
     QWidget.__init__(self)
      
      
     self.image = qnd.gray2qimage(initial_frame,normalize = True)
     self.videobox = QLabel()
      
     self.videobox.setPixmap(QtGui.QPixmap.fromImage(self.image))
      
     self.lyt = QGridLayout()
     self.lyt.addWidget(self.videobox,0,0)
      
     self.setLayout(self.lyt)
      
     self.show()
Beispiel #30
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        SpyderPluginMixin.__init__(self, parent)

        # Widgets
        self.stack = QStackedWidget(self)
        self.shellwidgets = {}

        # Layout
        layout = QVBoxLayout()
        layout.addWidget(self.stack)
        self.setLayout(layout)

        # Initialize plugin
        self.initialize_plugin()
Beispiel #31
0
 def __init__(self, parent=None, init_channel=None):
     QWidget.__init__(self, parent)
     PyDMWidget.__init__(self, init_channel=init_channel)
     if 'Index' not in PyDMSymbol.RULE_PROPERTIES:
         PyDMSymbol.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
         PyDMSymbol.RULE_PROPERTIES.update(
             {'Index': ['set_current_key', object]})
     self.app = QApplication.instance()
     self._current_key = 0
     self._state_images_string = ""
     self._state_images = {
     }  # Keyed on state values (ints), values are (filename, qpixmap or qsvgrenderer) tuples.
     self._aspect_ratio_mode = Qt.KeepAspectRatio
     self._sizeHint = self.minimumSizeHint()
     self._painter = QPainter()
Beispiel #32
0
 def __init__(self, datalist, comment="", parent=None):
     QWidget.__init__(self, parent)
     layout = QVBoxLayout()
     self.tabwidget = QTabWidget()
     layout.addWidget(self.tabwidget)
     self.setLayout(layout)
     self.widgetlist = []
     for data, title, comment in datalist:
         if len(data[0]) == 3:
             widget = FormComboWidget(data, comment=comment, parent=self)
         else:
             widget = FormWidget(data, comment=comment, parent=self)
         index = self.tabwidget.addTab(widget, title)
         self.tabwidget.setTabToolTip(index, comment)
         self.widgetlist.append(widget)
Beispiel #33
0
 def __init__(self, data, comment="", parent=None):
     QWidget.__init__(self, parent)
     from copy import deepcopy
     self.data = deepcopy(data)
     self.widgets = []
     self.formlayout = QFormLayout(self)
     if comment:
         self.formlayout.addRow(QLabel(comment))
         self.formlayout.addRow(QLabel(" "))
     if DEBUG_FORMLAYOUT:
         print("\n" + ("*" * 80))  # trex: test-skip
         print("DATA:", self.data)  # trex: test-skip
         print("*" * 80)  # trex: test-skip
         print("COMMENT:", comment)  # trex: test-skip
         print("*" * 80)  # trex: test-skip
Beispiel #34
0
    def __init__(self, parent=None, include_hidden=False):
        """
        Initialise a new instance of AlgorithmSelectorWidget
        :param parent: A parent QWidget
        :param include_hidden: If True the widget must include all hidden algorithms
        """
        self.execute_button = None
        self.search_box = None
        self.tree = None
        self.algorithm_progress_widget = None
        self.get_selected_workspace_fn = None
        QWidget.__init__(self, parent)
        IAlgorithmSelectorView.__init__(self, include_hidden)

        self.afo = AlgorithmSelectorFactoryObserver(self)
Beispiel #35
0
 def __init__(self, path=None):
     QWidget.__init__(self)
     self.setWindowTitle(self.NAME)
     self.setWindowIcon(APP_ICON)
     self.games = None  # pandas dataframe
     self.ranks = None  # pandas dataframe
     self.fn_players = None
     self.fn_games = None
     self.rank_order = 1  # descending
     self.rank_column = 1
     if path is None:
         path = os.getcwd()
     self.path = path
     self.setup_page()
     QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
Beispiel #36
0
 def __init__(self,
              styles,
              selected_style=None,
              size=None,
              *args,
              **kwargs):
     QWidget.__init__(self, *args, **kwargs)
     self.styles = styles
     self._selected_style = selected_style
     if self._selected_style is None:
         self._selected_style = self.styles[0]
     self._quality = size
     if self._quality is None:
         self._quality = settings.SIZES[0]
     self.setup_ui()
Beispiel #37
0
    def __init__(self, parent=None, options_button=None):
        QWidget.__init__(self, parent)

        self.setup_mainwidget()

        btn_layout = QHBoxLayout()
        for btn in self.setup_buttons():
            btn.setIconSize(QSize(16, 16))
            btn_layout.addWidget(btn)
        if options_button:
            btn_layout.addStretch()
            btn_layout.addWidget(options_button, Qt.AlignRight)

        layout = create_plugin_layout(btn_layout, self.mainwidget)
        self.setLayout(layout)
Beispiel #38
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        SpyderPluginMixin.__init__(self, parent)

        # Widgets
        self.stack = QStackedWidget(self)
        self.shellwidgets = {}

        # Layout
        layout = QVBoxLayout()
        layout.addWidget(self.stack)
        self.setLayout(layout)

        # Initialize plugin
        self.initialize_plugin()
Beispiel #39
0
    def __init__(self, parent, options=None):
        QWidget.__init__(self, parent=parent)

        if options is None:
            options = {}
        self.imagewidget = ImageWidget(self, **options)
        self.imagewidget.register_all_image_tools()

        hlayout = QHBoxLayout()
        self.add_buttons_to_layout(hlayout)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.imagewidget)
        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)
Beispiel #40
0
 def __init__(self, datalist, comment="", parent=None):
     QWidget.__init__(self, parent)
     layout = QVBoxLayout()
     self.tabwidget = QTabWidget()
     layout.addWidget(self.tabwidget)
     self.setLayout(layout)
     self.widgetlist = []
     for data, title, comment in datalist:
         if len(data[0])==3:
             widget = FormComboWidget(data, comment=comment, parent=self)
         else:
             widget = FormWidget(data, comment=comment, parent=self)
         index = self.tabwidget.addTab(widget, title)
         self.tabwidget.setTabToolTip(index, comment)
         self.widgetlist.append(widget)
Beispiel #41
0
    def __init__(self,
                 parent=None,
                 show_fullpath=True,
                 show_all_files=True,
                 group_cells=True,
                 show_comments=True,
                 sort_files_alphabetically=False,
                 display_variables=False,
                 follow_cursor=True,
                 options_button=None):
        # TODO: Remove once the OutlineExplorer is migrated
        self.CONF_SECTION = 'outline_explorer'
        QWidget.__init__(self, parent)

        self.treewidget = OutlineExplorerTreeWidget(
            self,
            show_fullpath=show_fullpath,
            show_all_files=show_all_files,
            group_cells=group_cells,
            display_variables=display_variables,
            show_comments=show_comments,
            sort_files_alphabetically=sort_files_alphabetically,
            follow_cursor=follow_cursor,
        )
        self.loading_widget = create_waitspinner(size=16, parent=self)
        self.treewidget.sig_display_spinner.connect(self.loading_widget.start)
        self.treewidget.sig_hide_spinner.connect(self.loading_widget.stop)
        self.treewidget.sig_update_configuration.connect(
            self.sig_update_configuration)

        self.visibility_action = create_action(self,
                                               _("Show/hide outline explorer"),
                                               icon='outline_explorer_vis.png',
                                               toggled=self.toggle_visibility)
        self.visibility_action.setChecked(True)

        btn_layout = QHBoxLayout()
        for btn in self.setup_buttons():
            btn.setAutoRaise(True)
            btn.setIconSize(QSize(16, 16))
            btn_layout.addWidget(btn)
        if options_button:
            btn_layout.addStretch()
            btn_layout.addWidget(self.loading_widget, Qt.AlignRight)
            btn_layout.addWidget(options_button, Qt.AlignRight)

        layout = create_plugin_layout(btn_layout, self.treewidget)
        self.setLayout(layout)
Beispiel #42
0
    def __init__(self,
                 parent,
                 data,
                 readonly=False,
                 xlabels=None,
                 ylabels=None):
        QWidget.__init__(self, parent)
        self.data = data
        print(type(self.data))
        self.old_data_shape = None

        if len(self.data.shape) == 1:
            self.old_data_shape = self.data.shape
            self.data.shape = (self.data.shape[0], 1)
        elif len(self.data.shape) == 0:
            self.old_data_shape = self.data.shape
            self.data.shape = (1, 1)

        format = SUPPORTED_FORMATS.get(data.dtype.name, '%s')

        self.model = ArrayModel(self.data,
                                format=format,
                                xlabels=xlabels,
                                ylabels=ylabels,
                                readonly=readonly,
                                parent=self)
        self.view = ArrayView(self, self.model, data.dtype, data.shape)

        btn_layout = QHBoxLayout()
        btn_layout.setAlignment(Qt.AlignLeft)
        btn = QPushButton("Format")
        # disable format button for int type
        btn.setEnabled(is_float(data.dtype))
        btn_layout.addWidget(btn)
        btn.clicked.connect(self.change_format)
        btn = QPushButton("Resize")
        btn_layout.addWidget(btn)
        btn.clicked.connect(self.view.resize_to_contents)
        bgcolor = QCheckBox('Background color')
        bgcolor.setChecked(self.model.bgcolor_enabled)
        bgcolor.setEnabled(self.model.bgcolor_enabled)
        bgcolor.stateChanged.connect(self.model.bgcolor)
        btn_layout.addWidget(bgcolor)

        layout = QVBoxLayout()
        layout.addWidget(self.view)
        layout.addLayout(btn_layout)
        self.setLayout(layout)
Beispiel #43
0
    def __init__(self, parent, file_handler):
        """

        :param parent:
        :type parent: start.StartQt4
        :param file_handler
        :type file_handler.FileHandler
        """
        QWidget.__init__(self, parent)
        # self._ignore_selection_change = False  # guard that used to ignore the selection change processing
        self.file_handler = file_handler
        self.ui = Ui_StationViewer()
        self.ui.setupUi(self)
        # self.subwindow, _ = parent.create_subwindow(self, self.windowTitle())
        # self.subwindow.setMaximumWidth(600)
        # self.subwindow.setMinimumWidth(400)
        # self.subwindow.resize(parent.width()/3, self.height())
        # set the item to be ordered by ascending order
        self.ui.treeWidget_stations.sortByColumn(0, QtCore.Qt.AscendingOrder)
        # make station_viewer never been deleted
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose, False)
        # handle selection changed event
        self.ui.treeWidget_stations.selectionModel().selectionChanged.connect(self.item_selection_changed)
        # add context menu for tree view
        self.tree_menu = StationViewer.TreeViewMenu()
        self.tree_menu.actionCreate_New_Group.triggered.connect(self.create_new_group)
        self.tree_menu.actionDismiss_Group.triggered.connect(self.dismiss_group)
        self.tree_menu.actionAdd_To_Group.triggered.connect(self.add_selected_to_group)
        self.tree_menu.actionRemove_Station.triggered.connect(self.remove_stations)
        self.tree_menu.actionPlot.triggered.connect(parent.plot_selected_station)
        self.ui.treeWidget_stations.customContextMenuRequested.connect(self.open_menu_in_tree_view)
        # setup and connect map button
        self.ui.pushButton_hideMap.hide()
        self.ui.pushButton_hideMap.clicked.connect(self.toggle_map)
        self.ui.pushButton_showMap.clicked.connect(self.toggle_map)
        # add map area and hide by default
        self.station_map = StationViewer.StationMap(self, self.file_handler, 4, 3, dpi=self.width()/3)
        self.station_map.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        self.station_map.setHidden(True)
        self.station_map.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.station_map.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.station_map.customContextMenuRequested.connect(self.open_menu_in_map_view)
        self.ui.verticalLayout.addWidget(self.station_map)
        # share the selected station collection from fig_canvas
        self.selected_stations = self.station_map.selected_stations
        # connect signals between map and tree view
        self.station_map.selection_changed.connect(self.update_selection)
        self.selection_changed.connect(self.station_map.update_figure)
Beispiel #44
0
 def __init__(self, parent=None, init_channel=None):
     QWidget.__init__(self, parent)
     PyDMWritableWidget.__init__(self, init_channel=init_channel)
     self._has_enums = False
     self._checkable = True
     self.setLayout(QGridLayout(self))
     self._layout_spacing_horizontal = 6
     self._layout_spacing_vertical = 6
     self._layout_margins = QMargins(9, 9, 9, 9)
     self._btn_group = QButtonGroup()
     self._btn_group.setExclusive(True)
     self._btn_group.buttonClicked[int].connect(self.handle_button_clicked)
     self._widget_type = WidgetType.PushButton
     self._orientation = Qt.Vertical
     self._widgets = []
     self.rebuild_widgets()
Beispiel #45
0
    def __init__(self, w, parent=None):
        QWidget.__init__(self, parent)

        self._w = w
        self.setupUi()

        contentLayout = QHBoxLayout()
        contentLayout.setContentsMargins(0, 0, 0, 0)
        contentLayout.addWidget(w)

        self.windowContent.setLayout(contentLayout)

        self.setWindowTitle(w.windowTitle())
        self.setGeometry(w.geometry())

        self.installEventFilter(self)
Beispiel #46
0
    def __init__(self, parent):
        if PYQT5:
            super().__init__(parent=parent, class_parent=parent)
        else:
            QWidget.__init__(self, parent)
            SpyderWidgetMixin.__init__(self, class_parent=parent)

        # Attributes
        self.filename = None
        self.text_finder = None
        self.last_find = ''
        self.finder_is_visible = False

        # Widgets
        self.editor = None
        self.shellwidget = None
Beispiel #47
0
    def __init__(self):
        QWidget.__init__(self)

        self.setWindowTitle("Run Analysis")
        self.activateWindow()

        self.analysis_module = AnalysisModuleSelector(
            load_all=True, help_link="config/analysis/analysis_module")
        self.target_case_text = QLineEdit()
        self.source_case_selector = CaseSelector(update_ert=False)

        layout = QFormLayout()
        layout.addRow("Analysis", self.analysis_module)
        layout.addRow("Target case", self.target_case_text)
        layout.addRow("Source case", self.source_case_selector)
        self.setLayout(layout)
Beispiel #48
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)  # mx change

        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.data = None
        self.arraywidget = None
        self.stack = None
        self.layout = None
        # Values for 3d array editor
        self.dim_indexes = [{}, {}, {}]
        self.last_dim = 0  # Adjust this for changing the startup dimension
Beispiel #49
0
 def __init__(self, dynamic=False):
     EditorExtension.__init__(self)
     QWidget.__init__(self)
     # Specifies whether the panel is dynamic. A dynamic panel is a panel
     # that will be shown/hidden depending on the context.
     # Dynamic panel should not appear in any GUI menu
     self.dynamic = dynamic
     # Panel order into the zone it is installed to. This value is
     # automatically set when installing the panel but it can be changed
     # later (negative values can also be used).
     self.order_in_zone = -1
     self._scrollable = False
     self._background_brush = None
     self._foreground_pen = None
     # Position in the editor (top, left, right, bottom)
     self.position = -1
Beispiel #50
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     self.start = create_toolbutton(self,
                                    text="Download",
                                    triggered=lambda: self.start_sig.emit(),
                                    tip="Start Download")
     self.stop = create_toolbutton(self,
                                   text="Stop",
                                   triggered=lambda: self.stop_sig.emit(),
                                   tip="Stop Download")
     self.stop.setEnabled(False)
     self.start.setEnabled(False)
     layout = QHBoxLayout()
     layout.addWidget(self.start)
     layout.addWidget(self.stop)
     self.setLayout(layout)
Beispiel #51
0
    def __init__(self, obj):

        QWidget.__init__(self)

        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        #Add a standard display box for error messages to user

        self.msgbox = QtWidgets.QMessageBox()

        self.data_deposit = obj

        self.layout = QtWidgets.QVBoxLayout()

        #add load button and connect

        self.load_button = QPushButton('Load')
        self.load_button.clicked.connect(self.load_regular)

        self.overide_load_fmt = QPushButton(
            'Load files with different name convention')

        self.done_load_sig.connect(self.close)

        self.directorypathchoose = QLineEdit(
            'Input directory path in format "C:/..." without final "/"')
        self.datechoose = QLineEdit('Choose Date in format: "DD-MM-YY"')
        self.timechoose = QLineEdit('Choose Time in format: "HH:MM"')

        #add ability to load upon pressing Enter only for time input, on presumption that people will fill date first and then the time..

        self.timechoose.returnPressed.connect(self.load_regular)

        self.layout.addWidget(self.directorypathchoose)

        self.layout.addWidget(self.datechoose)

        self.layout.addWidget(self.timechoose)

        self.layout.addWidget(self.load_button)

        self.layout.addWidget(self.overide_load_fmt)

        self.setLayout(self.layout)

        #When error occurs an error messagebox will be shown. When the user accepts this the loadbox should close to be reopenned again

        self.msgbox.buttonClicked.connect(self.close)
Beispiel #52
0
    def __init__(self,
                 parent,
                 search_text="",
                 search_text_regexp=False,
                 exclude=EXCLUDE_PATTERNS[0],
                 exclude_idx=None,
                 exclude_regexp=False,
                 supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
                 more_options=True,
                 case_sensitive=False,
                 external_path_history=[],
                 options_button=None,
                 text_color=None):
        QWidget.__init__(self, parent)

        self.setWindowTitle(_('Find in files'))

        self.search_thread = None
        self.status_bar = FileProgressBar(self)
        self.status_bar.hide()

        self.find_options = FindOptions(self,
                                        search_text,
                                        search_text_regexp,
                                        exclude,
                                        exclude_idx,
                                        exclude_regexp,
                                        supported_encodings,
                                        more_options,
                                        case_sensitive,
                                        external_path_history,
                                        options_button=options_button)
        self.find_options.find.connect(self.find)
        self.find_options.stop.connect(self.stop_and_reset_thread)

        self.result_browser = ResultsBrowser(self, text_color=text_color)

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.result_browser)

        layout = QVBoxLayout()
        left, _x, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(left, 0, right, bottom)
        layout.addWidget(self.find_options)
        layout.addLayout(hlayout)
        layout.addWidget(self.status_bar)
        self.setLayout(layout)
Beispiel #53
0
    def __init__(self, parent,
                 search_text=r"# ?TODO|# ?FIXME|# ?XXX",
                 search_text_regexp=True, search_path=None,
                 exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None,
                 exclude_regexp=True,
                 supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
                 in_python_path=False, more_options=False,
                 case_sensitive=True, external_path_history=[],
                 options_button=None):
        QWidget.__init__(self, parent)

        self.setWindowTitle(_('Find in files'))

        self.search_thread = None
        self.search_path = ''
        self.get_pythonpath_callback = None

        self.status_bar = FileProgressBar(self)
        self.status_bar.hide()

        self.find_options = FindOptions(self, search_text,
                                        search_text_regexp,
                                        search_path,
                                        exclude, exclude_idx,
                                        exclude_regexp,
                                        supported_encodings,
                                        in_python_path,
                                        more_options,
                                        case_sensitive,
                                        external_path_history,
                                        options_button=options_button)
        self.find_options.find.connect(self.find)
        self.find_options.stop.connect(self.stop_and_reset_thread)

        self.result_browser = ResultsBrowser(self)

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.result_browser)

        layout = QVBoxLayout()
        left, _x, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(left, 0, right, bottom)
        layout.addWidget(self.find_options)
        layout.addLayout(hlayout)
        layout.addWidget(self.status_bar)
        self.setLayout(layout)
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        l = QVBoxLayout(self)
        self.tfPlot = TransferFunctionPlot()
        self.cwidget = ControlsWidget()
        self.noiseCanvas = MplCanvas()

        #l.addWidget(self.noiseCanvas)
        l.addWidget(self.tfPlot)
        l.addWidget(self.cwidget)
        self.parameterTable = FitParameterTable()
        self.parameterTable.guessChanged.connect(self.recalculate)
        l.addWidget(self.parameterTable)
        self.setLayout(l)
        self.cwidget.modelCombo.activated.connect(self.modelChanged)
        #self.modelChanged()
        self.restoreSettings()
Beispiel #55
0
    def __init__(self, parent=None, options_button=None):
        QWidget.__init__(self, parent)

        # central widget
        self.textBrowser = QTextBrowser(self)
        # self.textBrowser = TextBrowserBase(self)

        btn_layout = QHBoxLayout()
        for btn in self.setup_buttons():
            btn.setIconSize(QSize(16, 16))
            btn_layout.addWidget(btn)
        if options_button:
            btn_layout.addStretch()
            btn_layout.addWidget(options_button, Qt.AlignRight)

        layout = create_plugin_layout(btn_layout, self.textBrowser)
        self.setLayout(layout)
Beispiel #56
0
    def __init__(self, appdata: CnaData):
        QWidget.__init__(self)
        self.appdata = appdata
        self.last_selected = None
        self.reaction_counter = 1

        self.add_button = QPushButton("Add new reaction")
        self.add_button.setIcon(QIcon.fromTheme("list-add"))
        policy = QSizePolicy()
        policy.ShrinkFlag = True
        self.add_button.setSizePolicy(policy)

        self.reaction_list = DragableTreeWidget()
        self.reaction_list.setDragEnabled(True)
        self.reaction_list.setHeaderLabels(["Id", "Name", "Flux"])
        self.reaction_list.setSortingEnabled(True)

        for r in self.appdata.project.cobra_py_model.reactions:
            self.add_reaction(r)

        self.reaction_mask = ReactionMask(self)
        self.reaction_mask.hide()

        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        l = QHBoxLayout()
        l.setAlignment(Qt.AlignRight)
        l.addWidget(self.add_button)
        self.splitter = QSplitter()
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.addWidget(self.reaction_list)
        self.splitter.addWidget(self.reaction_mask)
        self.layout.addItem(l)
        self.layout.addWidget(self.splitter)
        self.setLayout(self.layout)

        self.reaction_list.currentItemChanged.connect(self.reaction_selected)
        self.reaction_mask.reactionChanged.connect(
            self.handle_changed_reaction)
        self.reaction_mask.reactionDeleted.connect(
            self.handle_deleted_reaction)
        self.reaction_mask.jumpToMap.connect(self.emit_jump_to_map)
        self.reaction_mask.jumpToMetabolite.connect(
            self.emit_jump_to_metabolite)

        self.add_button.clicked.connect(self.add_new_reaction)
Beispiel #57
0
    def __init__(self, parent=None, options_button=None, name=None):
        QWidget.__init__(self, parent)
        self.parent = parent
        self.base = PlotBase(parent=self, name=name)

        btn_layout = QHBoxLayout()
        for btn in self.setup_buttons():
            btn.setIconSize(QSize(16, 16))
            btn_layout.addWidget(btn)
        if options_button:
            btn_layout.addStretch()
            btn_layout.addWidget(options_button, Qt.AlignRight)

        layout = create_plugin_layout(btn_layout, self.base)
        self.setLayout(layout)

        self.base.canvas.show()  # show after parent widgets are in place
Beispiel #58
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
        self._file_handler = FileHandler()
        self._is_file_dialog_opened = False

        self.ui = Ui_SmartMT_MainWindow()

        # init gui
        self.ui.setupUi(self)
        self.setup_menu()

        # export dialogs
        self._export_dialog = ExportDialog(self)
        self._export_dialog_modem = ExportDialogModEm(self)

        # set station viewer
        self._station_viewer = StationViewer(self,
                                             file_handler=self._file_handler)
        self._station_viewer.ui.pushButton_plot.clicked.connect(
            self.plot_selected_station)
        self._station_viewer.selection_changed.connect(
            self._selected_station_changed)
        self.ui.stackedWidget.addWidget(self._station_viewer)

        # set plot option widget
        self._plot_option = PlotOption(self, self._file_handler,
                                       self._station_viewer.selected_stations)
        self._plot_option.ui.pushButton_back.clicked.connect(
            lambda x: self.ui.stackedWidget.setCurrentWidget(self.
                                                             _station_viewer))
        self._station_viewer.selection_changed.connect(
            self._plot_option.data_changed)
        self.ui.stackedWidget.addWidget(self._plot_option)

        self.ui.stackedWidget.setCurrentWidget(self._station_viewer)

        self._subwindow_counter = 0

        self._station_summary = None

        self._progress_bar = ProgressBar(title='Loading files...')
        self.subwindows = {}
        # enable export if the activated subwindow is a image window
        self.ui.mdiArea.subWindowActivated.connect(self._subwindow_activated)
        self.setWindowState(QtCore.Qt.WindowMaximized)
Beispiel #59
0
    def __init__(self, parent, port, path='~', font=None):
        """Frame main constructor."""
        QWidget.__init__(self, parent)
        url = 'http://127.0.0.1:{0}'.format(port)
        self.view = TermView(self, term_url=url)
        self.font = font
        self.initial_path = path

        layout = QVBoxLayout()
        layout.addWidget(self.view)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
        self.setLayout(layout)

        self.body = self.view.document

        self.view.page().loadFinished.connect(self.setup_term)
Beispiel #60
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self.setWindowTitle("Breakpoints")
        self.dictwidget = BreakpointTableView(self,
                                              self._load_all_breakpoints())
        layout = QVBoxLayout()
        layout.addWidget(self.dictwidget)
        self.setLayout(layout)
        self.dictwidget.clear_all_breakpoints.connect(
            lambda: self.clear_all_breakpoints.emit())
        self.dictwidget.clear_breakpoint.connect(
            lambda s1, lino: self.clear_breakpoint.emit(s1, lino))
        self.dictwidget.edit_goto.connect(
            lambda s1, lino, s2: self.edit_goto.emit(s1, lino, s2))
        self.dictwidget.set_or_edit_conditional_breakpoint.connect(
            lambda: self.set_or_edit_conditional_breakpoint.emit())