Beispiel #1
0
    def set_notes_visible(self, visible):
        self.notes_widget.setVisible(visible)

        if visible:
            self.hide_notes_button.setIcon(util.make_icon(":/collapse-up.png"))
            self.hide_notes_button.setToolTip("Hide Device notes")
        else:
            self.hide_notes_button.setIcon(
                util.make_icon(":/collapse-down.png"))
            self.hide_notes_button.setToolTip("Show Device notes")

        self.hide_notes_button.setStatusTip(self.hide_notes_button.toolTip())
Beispiel #2
0
    def __init__(self, context, parent=None):
        super(MainWindow, self).__init__(parent)
        self.log = util.make_logging_source_adapter(__name__, self)
        self.context = context
        self.mdiArea = MCMdiArea()
        self.toolbar = self.addToolBar("toolbar")
        self.toolbar.setObjectName("toolbar")
        self.setWindowTitle("mesycontrol")
        self.setWindowIcon(make_icon(":/window-icon.png"))

        self.mdiArea.setLayout(QtWidgets.QGridLayout())
        self.setCentralWidget(self.mdiArea)

        self.status_bar = QtWidgets.QStatusBar()
        self.setStatusBar(self.status_bar)

        self.actionQuickstart = QtWidgets.QAction("Quickstart")
        self.actionQuickstart.setShortcut("F1")

        self.menu_file = QtWidgets.QMenu("&File")
        self.menu_window = QtWidgets.QMenu("&Window")
        self.menu_help = QtWidgets.QMenu("&Help")

        self.menu_help.addAction(self.actionQuickstart)
        self.menu_help.addSeparator()
        self.menu_help.addAction("&About", self.on_actionAbout_triggered)
        self.menu_help.addAction("About &Qt", self.on_actionAbout_Qt_triggered)

        self.menu_bar = self.menuBar()
        self.menu_bar.addMenu(self.menu_file)
        self.menu_bar.addMenu(self.menu_help)

        # Treeview
        self.treeview = MCTreeView(app_registry=context.app_registry,
                                   device_registry=context.device_registry)

        dw_tree = QtWidgets.QDockWidget("Device tree", self)
        dw_tree.setObjectName("dw_treeview")
        dw_tree.setWidget(self.treeview)
        dw_tree.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable
                            | QtWidgets.QDockWidget.DockWidgetFloatable)
        self.addDockWidget(Qt.BottomDockWidgetArea, dw_tree)

        # Log view
        self.logview = log_view.LogView(parent=self)
        dw_logview = QtWidgets.QDockWidget("Application Log", self)
        dw_logview.setObjectName("dw_logview")
        dw_logview.setWidget(self.logview)
        dw_logview.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable
                               | QtWidgets.QDockWidget.DockWidgetFloatable)
        self.addDockWidget(Qt.BottomDockWidgetArea, dw_logview)
Beispiel #3
0
    def __init__(self, title=str(), parent=None):
        super(SubProgressDialog, self).__init__(parent)
        self.log = util.make_logging_source_adapter(__name__, self)
        self.ui = util.loadUi(":/ui/subprogress_widget.ui")
        self.setWindowTitle(title)
        self.setWindowIcon(util.make_icon(":/window-icon.png"))

        l = QtWidgets.QHBoxLayout(self)
        l.setContentsMargins(0, 0, 0, 0)
        l.setSpacing(0)
        l.addWidget(self.ui)
        self.resize(300, 100)

        self.ui.cancel_button.clicked.connect(self.cancel)
        self._reset()
Beispiel #4
0
    def __init__(self, widget, window_name_prefix, parent=None, **kwargs):
        super(DeviceSubWindow, self).__init__(parent)
        self.log = util.make_logging_source_adapter(__name__, self)
        self.setWidget(widget)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.window_name_prefix = window_name_prefix
        self._linked_mode = False
        self.update_title_and_name()
        self.setWindowIcon(util.make_icon(":/window-icon.png"))

        widget.display_mode_changed.connect(self.update_title_and_name)
        widget.write_mode_changed.connect(self.update_title_and_name)

        self.device.config_set.connect(self._on_device_config_set)
        self.device.hardware_set.connect(self._on_device_hardware_set)
        self._on_device_config_set(self.device, None, self.device.cfg)
        self._on_device_hardware_set(self.device, None, self.device.hw)
Beispiel #5
0
    def __init__(self, device, parent=None):
        super(DeviceNotesWidget, self).__init__(parent)

        self.device = device

        device.read_mode_changed.connect(self._on_device_read_mode_changed)
        device.write_mode_changed.connect(self._on_device_write_mode_changed)
        device.extension_changed.connect(self._on_device_extension_changed)

        self.text_edit = NotesTextEdit()
        self.text_edit.setReadOnly(True)
        self.text_edit.modificationChanged.connect(
                self._on_text_edit_modification_changed)

        fm = self.text_edit.fontMetrics()
        rh = fm.lineSpacing() + DeviceNotesWidget.ADD_PIXELS_PER_ROW
        self.text_edit.setFixedHeight(DeviceNotesWidget.DISPLAY_ROWS * rh)

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.text_edit)

        self.edit_button = QtWidgets.QPushButton(util.make_icon(":/edit.png"), str(),
                clicked=self._on_edit_button_clicked)
        self.edit_button.setToolTip("Edit Device Notes")
        self.edit_button.setStatusTip(self.edit_button.toolTip())

        button_layout = QtWidgets.QVBoxLayout()
        button_layout.setContentsMargins(0, 0, 0, 0)
        button_layout.addWidget(self.edit_button, 0, Qt.AlignHCenter)
        button_layout.addStretch(1)

        layout.addLayout(button_layout)

        self._populate()