Esempio n. 1
0
 def __init__(self):
     style = QCommonStyle()
     icons = [x for x in dir(QStyle) if x.startswith('SP_')]
     self.names = []
     for name in icons:
         icon = style.standardIcon(getattr(QStyle, name))
         setattr(self, name[3:], icon)
         self.names.append(name[3:])
Esempio n. 2
0
    def setup_settings(self):
        a = QCommonStyle()
        self.pushButton.setIcon(a.standardIcon(QStyle.SP_ArrowDown))
        self.setWindowIcon(QIcon('book.png'))
        self.tabWidget.setCurrentIndex(0)
        self.tabWidget_2.setCurrentIndex(0)
        self.tabWidget_2.currentIndex()
        self.tableWidget.verticalHeader().setSectionResizeMode(QHeaderView.Fixed)
        self.progressBar.setVisible(False)
        self.progressBar_2.setVisible(False)
        self.export_button.setVisible(False)
        self.edit_button.setVisible(False)

        self.tableWidget.setColumnCount(6)
        self.table_lecturer.setColumnCount(2)
        self.table_groups.setColumnCount(2)
        self.table_subject.setColumnCount(2)
        self.table_classroom.setColumnCount(2)
        self.table_user.setColumnCount(3)

        self.tableWidget.setHorizontalHeaderLabels(
            ["Преподаватель", "Предмет", 'Пара', 'Примечание', "Аудитория", 'Редактировать'])
        self.table_lecturer.setHorizontalHeaderLabels(["Фамилия И.О.", ''])
        self.table_classroom.setHorizontalHeaderLabels(["Номер аудитории", ''])
        self.table_subject.setHorizontalHeaderLabels(["Предмет", ''])
        self.table_groups.setHorizontalHeaderLabels(["Группа", ''])
        self.table_user.setHorizontalHeaderLabels(["Логин", "Статус", ""])

        self.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table_lecturer.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table_groups.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table_subject.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table_classroom.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table_user.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        self.button_subject.clicked.connect(self.controller.push_button_add_subject)
        self.button_classroom.clicked.connect(self.controller.push_button_add_classroom)
        self.button_group.clicked.connect(self.controller.push_button_add_group)
        self.button_lecturer.clicked.connect(self.controller.push_button_add_lecturer)
        self.pushButton.clicked.connect(self.controller.push_button_save)
        self.update_button.clicked.connect(self.controller.push_button_update_table)
        self.pushButton_2.clicked.connect(self.controller.push_button_show_timetable)
        self.export_button.clicked.connect(self.controller.push_button_export)
        self.edit_button.clicked.connect(self.controller.push_button_edit)

        self.controller.push_button_update_table()
        self.dateEdit_2.setDate(datetime.datetime.now())
        self.dateEdit.setDate(datetime.datetime.now())
        self.edit_classroom.setValidator(QIntValidator())

        self.exit = QAction(self)
        self.exit.setText("Сменить пользователя")
        self.exit.setObjectName('exit')
        self.menuBar.addAction(self.exit)
Esempio n. 3
0
    def setup(self):
        self.setupUi(self)

        loadAct = QAction('&Open', self)
        loadAct.setShortcut('Ctrl+O')
        loadAct.setStatusTip('Load data')
        loadAct.triggered.connect(lambda: self.onLoadClicked(0))

        surfAct = QAction('&Open Surface', self)
        surfAct.setShortcut('Ctrl+S')
        surfAct.setStatusTip('Surf data')
        surfAct.triggered.connect(lambda: self.onLoadClicked(1))

        exitAct = QAction('&Exit', self)
        exitAct.setShortcut('ALT+F4')
        exitAct.setStatusTip('Exit application')
        exitAct.triggered.connect(self.close)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(loadAct)
        fileMenu.addAction(surfAct)
        fileMenu.addAction(exitAct)

        style = QCommonStyle()
        self.btnUpAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowUp))
        self.btnDownAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowDown))
        self.btnRightAzimuth.setIcon(style.standardIcon(
            QStyle.SP_ArrowForward))
        self.btnLeftAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowBack))

        self.btnUpElevation.setIcon(style.standardIcon(QStyle.SP_ArrowUp))
        self.btnDownElevation.setIcon(style.standardIcon(QStyle.SP_ArrowDown))
        self.btnRightElevation.setIcon(
            style.standardIcon(QStyle.SP_ArrowForward))
        self.btnLeftElevation.setIcon(style.standardIcon(QStyle.SP_ArrowBack))

        self.centralWidget().layout().setContentsMargins(0, 0, 0, 0)
        self.statusBar().hide()

        all_widgets = QApplication.instance().allWidgets()
        for widget in all_widgets:
            if type(widget) == QSplitter:
                widget.setStyleSheet(""
                                     " QSplitter::handle:horizontal { "
                                     "    border: 1px outset darkgrey; "
                                     " } "
                                     " QSplitter::handle:vertical{ "
                                     "    border: 1px outset darkgrey; "
                                     " } ")
                widget.setHandleWidth(2)  # Default is 3
Esempio n. 4
0
    def setup(self):
        self.setupUi(self)
        self.setupMenu()
        style = QCommonStyle()
        self.btnUpAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowUp))
        self.btnDownAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowDown))
        self.btnRightAzimuth.setIcon(style.standardIcon(
            QStyle.SP_ArrowForward))
        self.btnLeftAzimuth.setIcon(style.standardIcon(QStyle.SP_ArrowBack))

        self.btnUpElevation.setIcon(style.standardIcon(QStyle.SP_ArrowUp))
        self.btnDownElevation.setIcon(style.standardIcon(QStyle.SP_ArrowDown))
        self.btnRightElevation.setIcon(
            style.standardIcon(QStyle.SP_ArrowForward))
        self.btnLeftElevation.setIcon(style.standardIcon(QStyle.SP_ArrowBack))

        self.centralWidget().layout().setContentsMargins(0, 0, 0, 0)
        self.statusBar().hide()

        all_widgets = QApplication.instance().allWidgets()
        for widget in all_widgets:
            if type(widget) == QSplitter:
                widget.setStyleSheet(""
                                     " QSplitter::handle:horizontal { "
                                     "    border: 1px outset darkgrey "
                                     " } "
                                     " QSplitter::handle:vertical{ "
                                     "    border: 1px outset darkgrey "
                                     " } ")
                widget.setHandleWidth(2)  # Default is 3
        # Setup 3D viewer
        self.viewer3D = Viewer3D(self)
        self.viewer3D.AddPlaneCornerButtons()

        self.layout3D.setContentsMargins(0, 0, 0, 0)
        self.layout3D.addWidget(self.viewer3D)

        # Setup CT viewer
        self.stackCT = Viewer2DStacked(self)
        self.layoutCT.setContentsMargins(0, 0, 0, 0)
        self.layoutCT.insertWidget(0, self.stackCT)

        # Setup US views
        self.viewUS = []
        self.viewUS.append(Viewer2D(self, 1))
        self.viewUS.append(Viewer2D(self, 2))

        # Make all views share the same cursor object
        for i in range(2):
            self.viewUS[i].viewer.SetResliceCursor(
                self.viewUS[0].viewer.GetResliceCursor())

        # Cursor representation (anti-alias)
        for i in range(len(self.viewUS)):
            for j in range(3):
                prop = self.viewUS[i].viewer.GetResliceCursorWidget(
                ).GetResliceCursorRepresentation().GetResliceCursorActor(
                ).GetCenterlineProperty(j)
                renderLinesAsTubes(prop)

        # Remove when stacked works for 2 images
        for i in range(len(self.viewUS)):
            # Set background for 2D views
            color = [0.0, 0.0, 0.0]
            color[self.viewUS[i].iDim] = 1
            for j in range(3):
                color[j] = color[j] / 4.0
            self.viewUS[i].viewer.GetRenderer().SetBackground(color)
            self.viewUS[i].interactor.Disable()

        self.establishCallbacks()

        # Show widgets but hide non-existing data
        for i in range(self.stackCT.count()):
            self.stackCT.widget(i).show()
            self.stackCT.widget(i).viewer.GetImageActor().SetVisibility(False)

        # Show widgets but hide non-existing data
        for i in range(len(self.viewUS)):
            self.viewUS[i].show()
            self.viewUS[i].viewer.GetImageActor().SetVisibility(False)

        self.layoutUS0.setContentsMargins(0, 0, 0, 0)
        self.layoutUS0.insertWidget(0, self.viewUS[0])
        self.layoutUS1.setContentsMargins(0, 0, 0, 0)
        self.layoutUS1.insertWidget(0, self.viewUS[1])