Beispiel #1
0
 def __init__(self):
     super(Model, self).__init__()
     self.items = []
     self.item_model = QtGui.QStandardItemModel(self)
     self.current_label = None
     self.xaxis_unit = None  # Default value, will be set upon first data
     self.total_items_ever_added = 0
Beispiel #2
0
    def init_ui(self):
        self.win = QtWidgets.QWidget()
        self.win.setObjectName('window_widget')
        self.win.setStyleSheet("background-color:{};".format(BACKGROUND_COLOR))
        self.setGeometry(300, 300, 1224, 720)

        self.list_view = self.setup_list_view(self.model.item_model)
        logger.debug('Set up done: List view')

        self.marking_label = self.setup_marking_label()

        (
        self.fig,
        self.canvas,
        self.mpl_toolbar,
        ) = self.setup_figure()
        logger.debug('Set up done: Figure')
        (
        self.outline_view,
        self.detail_view,
        ) = self.setup_views(self.fig, self.model.items)
        logger.debug('Set up done: Views')
        self.setup_connections()
        logger.debug('Set up done: Connections')
        # Compose layout
        #
        # Left side
        self.frame_left = QtWidgets.QFrame()
        self.frame_left.setObjectName('frame_left')
        self.grid_left = QtWidgets.QGridLayout()
        self.grid_left.setSpacing(20)
        self.frame_left.setLayout(self.grid_left)
        self.grid_left.addWidget(self.marking_label, 0, 0, 2, 1)
        self.grid_left.addItem(
            QtWidgets.QSpacerItem(1,1),
            2, 0, 1, 1
        )
        self.help_item_model = QtGui.QStandardItemModel()
#         self.help_list = QListView()
        class CustListView(QtWidgets.QListView):
            def sizeHint(self, *args, **kwargs):
                return QtCore.QSize(100, 400)
        self.help_list = CustListView()
        self.help_list.setSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.Preferred,
        )
        self.help_list.setModel(self.help_item_model)
        self.grid_left.addWidget(self.help_list, 2, 0, 1, 1)
        self.grid_left.addWidget(self.list_view, 4, 0, 4, 1)

        # Right side
        self.frame_right = QtWidgets.QFrame()
        self.frame_right.setObjectName('frame_right')
        self.frame_right.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.vbox_right = QtWidgets.QVBoxLayout()
        self.frame_right.setLayout(self.vbox_right)
        list(map(
            self.vbox_right.addWidget,
            [self.mpl_toolbar, self.canvas]
        ))

        # Vertical splitter
        self.vsplit = QtWidgets.QSplitter(self.win)
        self.vsplit.addWidget(self.frame_left)
        self.vsplit.addWidget(self.frame_right)
        self.vsplit.setStretchFactor(1, 2)

        self.hbox = QtWidgets.QHBoxLayout()
        self.hbox.addWidget(self.vsplit)
        self.win.setLayout(self.hbox)

#         self.grid = QGridLayout()
#         self.grid.setSpacing(10)
#         self.grid.addWidget(self.marking_label, 0, 0)
# #         self.grid.addWidget(self.list_view, 3, 0, 2, 1)
#         self.grid.addWidget(self.canvas, 1, 2, 4, 6)
#         self.grid.addWidget(self.mpl_toolbar, 0, 2, 1, 6)

#         self.win.setLayout(self.grid)
        self.setCentralWidget(self.win)
        self.setWindowTitle('Inspector')

        self.setup_menus_and_actions()

        self.setup_populate_help_list()

        self.statusBar().showMessage('Ready')
        self.show()