Ejemplo n.º 1
0
    def _create_actions(self):
        a = QtWidgets.QAction(QtGui.QIcon.fromTheme("edit-copy"),
                              "&Copy",
                              self,
                              triggered=self._copy_action)

        a.setShortcut(QtGui.QKeySequence.Copy)
        a.setEnabled(False)
        self._actions['copy'] = a

        a = QtWidgets.QAction(QtGui.QIcon.fromTheme("edit-paste"),
                              "&Paste",
                              self,
                              triggered=self._paste_action)
        a.setShortcut(QtGui.QKeySequence.Paste)
        a.setEnabled(False)
        self._actions['paste'] = a
Ejemplo n.º 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)