示例#1
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.cameraInfo = QCameraInfo.defaultCamera()
        self.camera = QCamera(self.cameraInfo)
        self.camera.setCaptureMode(QCamera.CaptureStillImage)
        self.imageCapture = QCameraImageCapture(self.camera)
        self.imageCapture.imageCaptured.connect(self.imageCaptured)
        self.imageCapture.imageSaved.connect(self.imageSaved)
        self.currentPreview = QImage()

        toolBar = QToolBar()
        self.addToolBar(toolBar)

        fileMenu = self.menuBar().addMenu("&File")
        shutterIcon = QIcon(os.path.join(os.path.dirname(__file__),
                            "shutter.svg"))
        self.takePictureAction = QAction(shutterIcon, "&Take Picture", self,
                                         shortcut="Ctrl+T",
                                         triggered=self.takePicture)
        self.takePictureAction.setToolTip("Take Picture")
        fileMenu.addAction(self.takePictureAction)
        toolBar.addAction(self.takePictureAction)

        exitAction = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut="Ctrl+Q", triggered=self.close)
        fileMenu.addAction(exitAction)

        aboutMenu = self.menuBar().addMenu("&About")
        aboutQtAction = QAction("About &Qt", self, triggered=qApp.aboutQt)
        aboutMenu.addAction(aboutQtAction)

        self.tabWidget = QTabWidget()
        self.setCentralWidget(self.tabWidget)

        self.cameraViewfinder = QCameraViewfinder()
        self.camera.setViewfinder(self.cameraViewfinder)
        self.tabWidget.addTab(self.cameraViewfinder, "Viewfinder")

        if self.camera.status() != QCamera.UnavailableStatus:
            name = self.cameraInfo.description()
            self.setWindowTitle("PySide2 Camera Example (" + name + ")")
            self.statusBar().showMessage("Starting: '" + name + "'", 5000)
            self.camera.start()
        else:
            self.setWindowTitle("PySide2 Camera Example")
            self.takePictureAction.setEnabled(False)
            self.statusBar().showMessage("Camera unavailable", 5000)
示例#2
0
    def __init__(self, timeline, parent, topic):
        super(PlotWidget, self).__init__(parent)
        self.setObjectName('PlotWidget')

        self.timeline = timeline
        msg_type = self.timeline.get_datatype(topic)
        self.msgtopic = topic
        self.start_stamp = self.timeline._get_start_stamp()
        self.end_stamp = self.timeline._get_end_stamp()

        # the current region-of-interest for our bag file
        # all resampling and plotting is done with these limits
        self.limits = [0,(self.end_stamp-self.start_stamp).to_sec()]

        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_bag_plugins'), 'resource', 'plot.ui')
        loadUi(ui_file, self)
        self.message_tree = MessageTree(msg_type, self)
        self.data_tree_layout.addWidget(self.message_tree)
        # TODO: make this a dropdown with choices for "Auto", "Full" and
        #       "Custom"
        #       I continue to want a "Full" option here
        self.auto_res.stateChanged.connect(self.autoChanged)

        self.resolution.editingFinished.connect(self.settingsChanged)
        self.resolution.setValidator(QDoubleValidator(0.0,1000.0,6,self.resolution))


        self.timeline.selected_region_changed.connect(self.region_changed)

        self.recompute_timestep()

        self.plot = DataPlot(self)
        self.plot.set_autoscale(x=False)
        self.plot.set_autoscale(y=DataPlot.SCALE_VISIBLE)
        self.plot.autoscroll(False)
        self.plot.set_xlim(self.limits)
        self.data_plot_layout.addWidget(self.plot)

        self._home_button = QPushButton()
        self._home_button.setToolTip("Reset View")
        self._home_button.setIcon(QIcon.fromTheme('go-home'))
        self._home_button.clicked.connect(self.home)
        self.plot_toolbar_layout.addWidget(self._home_button)

        self._config_button = QPushButton("Configure Plot")
        self._config_button.clicked.connect(self.plot.doSettingsDialog)
        self.plot_toolbar_layout.addWidget(self._config_button)

        self.set_cursor(0)

        self.paths_on = set()
        self._lines = None

        # get bag from timeline
        bag = None
        start_time = self.start_stamp
        while bag is None:
            bag,entry = self.timeline.get_entry(start_time, topic)
            if bag is None:
                start_time = self.timeline.get_entry_after(start_time)[1].time

        self.bag = bag
        # get first message from bag
        msg = bag._read_message(entry.position)
        self.message_tree.set_message(msg[1])

        # state used by threaded resampling
        self.resampling_active = False
        self.resample_thread = None
        self.resample_fields = set()
示例#3
0
def build_gui_help_world_space_baker():
    ''' Creates Help window for World Space Baker '''
    window_name = "build_gui_help_world_space_baker"
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name, window=True)

    cmds.window(window_name,
                title=script_name + " Help",
                mnb=False,
                mxb=False,
                s=True)
    cmds.window(window_name, e=True, s=True, wh=[1, 1])

    cmds.columnLayout("main_column", p=window_name)

    # Title Text
    cmds.separator(h=12, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)],
                         p="main_column")  # Window Size Adjustment
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)],
                         p="main_column")  # Title Column
    cmds.text(script_name + " Help",
              bgc=[.4, .4, .4],
              fn="boldLabelFont",
              align="center")
    cmds.separator(h=10, style='none', p="main_column")  # Empty Space

    # Body ====================
    cmds.rowColumnLayout(nc=1, cw=[(1, 210)], cs=[(1, 55)], p="main_column")

    cmds.text(
        l=
        '1. Use "Load Selection" to define targets\n2. Enter animation range (Start & End)\n3. Extract and store transforms\n4. Bake transforms when necessary',
        align="left")
    cmds.separator(h=15, style='none')  # Empty Space

    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p="main_column")
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p="main_column")
    cmds.text('Guilherme Trevisan  ')
    cmds.text(
        l='<a href="mailto:[email protected]">[email protected]</a>',
        hl=True,
        highlightColor=[1, 1, 1])
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p="main_column")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='<a href="https://github.com/TrevisanGMW">Github</a>',
              hl=True,
              highlightColor=[1, 1, 1])
    cmds.separator(h=7, style='none')  # Empty Space

    # Close Button
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p="main_column")
    cmds.separator(h=10, style='none')
    cmds.button(l='OK', h=30, c=lambda args: close_help_gui())
    cmds.separator(h=8, style='none')

    # Show and Lock Window
    cmds.showWindow(window_name)
    cmds.window(window_name, e=True, s=False)

    # Set Window Icon
    qw = omui.MQtUtil.findWindow(window_name)
    if python_version == 3:
        widget = wrapInstance(int(qw), QWidget)
    else:
        widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/question.png')
    widget.setWindowIcon(icon)

    def close_help_gui():
        ''' Closes Help Window '''
        if cmds.window(window_name, exists=True):
            cmds.deleteUI(window_name, window=True)
示例#4
0
    def setupUi(self, Main):
        if not Main.objectName():
            Main.setObjectName(u"Main")
        Main.resize(718, 453)
        Main.setMinimumSize(QSize(718, 453))
        Main.setStyleSheet(u"")
        self.centralwidget = QWidget(Main)
        self.centralwidget.setObjectName(u"centralwidget")
        self.centralwidget.setMinimumSize(QSize(718, 453))
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.topbar_menu = QFrame(self.centralwidget)
        self.topbar_menu.setObjectName(u"topbar_menu")
        self.topbar_menu.setMinimumSize(QSize(15, 48))
        self.topbar_menu.setMaximumSize(QSize(16777215, 50))
        self.topbar_menu.setCursor(QCursor(Qt.ArrowCursor))
        self.topbar_menu.setStyleSheet(u"background-color: black;")
        self.topbar_menu.setFrameShape(QFrame.WinPanel)
        self.topbar_menu.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_2 = QHBoxLayout(self.topbar_menu)
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.slideMenuFrame = QFrame(self.topbar_menu)
        self.slideMenuFrame.setObjectName(u"slideMenuFrame")
        self.slideMenuFrame.setMinimumSize(QSize(0, 45))
        self.slideMenuFrame.setMaximumSize(QSize(48, 50))
        self.slideMenuFrame.setStyleSheet(u"background-color: black;")
        self.slideMenuFrame.setFrameShape(QFrame.StyledPanel)
        self.slideMenuFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_3 = QHBoxLayout(self.slideMenuFrame)
        self.horizontalLayout_3.setSpacing(5)
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.horizontalLayout_3.setContentsMargins(9, 6, 6, 6)
        self.slideMenuButton = QPushButton(self.slideMenuFrame)
        self.slideMenuButton.setObjectName(u"slideMenuButton")
        self.slideMenuButton.setMaximumSize(QSize(40, 50))
        self.slideMenuButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.slideMenuButton.setStyleSheet(
            u"QPushButton{\n"
            "	border-radius: 3px;\n"
            "}\n"
            "QPushButton:hover{\n"
            "	background-color: rgb(208, 116, 53);\n"
            "}\n"
            "\n"
            "")
        icon = QIcon()
        icon.addFile(u":/Icons/Icons/Menu.svg", QSize(), QIcon.Normal,
                     QIcon.Off)
        self.slideMenuButton.setIcon(icon)
        self.slideMenuButton.setIconSize(QSize(24, 24))

        self.horizontalLayout_3.addWidget(self.slideMenuButton)

        self.horizontalLayout_2.addWidget(self.slideMenuFrame, 0, Qt.AlignLeft)

        self.titlleFrame = QFrame(self.topbar_menu)
        self.titlleFrame.setObjectName(u"titlleFrame")
        self.titlleFrame.setStyleSheet(u"margin-left: 20%;")
        self.titlleFrame.setFrameShape(QFrame.StyledPanel)
        self.titlleFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_4 = QVBoxLayout(self.titlleFrame)
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")
        self.verticalLayout_4.setContentsMargins(0, 6, 0, -1)
        self.titleLabel = QLabel(self.titlleFrame)
        self.titleLabel.setObjectName(u"titleLabel")
        font = QFont()
        font.setFamily(u"Bahnschrift")
        font.setPointSize(24)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.titleLabel.setFont(font)
        self.titleLabel.setStyleSheet(u"color: #bd6e38;\n" "")
        self.titleLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_4.addWidget(self.titleLabel)

        self.horizontalLayout_2.addWidget(self.titlleFrame)

        self.window_buttons = QFrame(self.topbar_menu)
        self.window_buttons.setObjectName(u"window_buttons")
        self.window_buttons.setStyleSheet(u"border: none;\n" "")
        self.window_buttons.setFrameShape(QFrame.WinPanel)
        self.window_buttons.setFrameShadow(QFrame.Raised)
        self.horizontalLayout = QHBoxLayout(self.window_buttons)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(0, 0, 0, 9)
        self.minimazeButton = QPushButton(self.window_buttons)
        self.minimazeButton.setObjectName(u"minimazeButton")
        self.minimazeButton.setMinimumSize(QSize(20, 20))
        self.minimazeButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.minimazeButton.setStyleSheet(
            u"QPushButton:hover{\n"
            "	background-color: rgb(154, 154, 154);\n"
            "}")
        icon1 = QIcon()
        icon1.addFile(u":/Icons/Icons/Minimaze-Icon.svg", QSize(),
                      QIcon.Normal, QIcon.Off)
        self.minimazeButton.setIcon(icon1)
        self.minimazeButton.setIconSize(QSize(16, 16))

        self.horizontalLayout.addWidget(self.minimazeButton)

        self.maximazeButton = QPushButton(self.window_buttons)
        self.maximazeButton.setObjectName(u"maximazeButton")
        self.maximazeButton.setMinimumSize(QSize(20, 20))
        self.maximazeButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.maximazeButton.setStyleSheet(
            u"QPushButton:hover{\n"
            "	background-color: rgb(154, 154, 154);\n"
            "}")
        icon2 = QIcon()
        icon2.addFile(u":/Icons/Icons/Maximaze-Icon.svg", QSize(),
                      QIcon.Normal, QIcon.Off)
        self.maximazeButton.setIcon(icon2)
        self.maximazeButton.setIconSize(QSize(16, 16))

        self.horizontalLayout.addWidget(self.maximazeButton)

        self.closeButton = QPushButton(self.window_buttons)
        self.closeButton.setObjectName(u"closeButton")
        self.closeButton.setMinimumSize(QSize(20, 20))
        self.closeButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.closeButton.setStyleSheet(u"QPushButton:hover{\n"
                                       "	background-color: rgb(170, 0, 0);\n"
                                       "}")
        icon3 = QIcon()
        icon3.addFile(u":/Icons/Icons/WindowCloseButton.svg", QSize(),
                      QIcon.Normal, QIcon.Off)
        self.closeButton.setIcon(icon3)
        self.closeButton.setIconSize(QSize(12, 12))

        self.horizontalLayout.addWidget(self.closeButton)

        self.horizontalLayout_2.addWidget(self.window_buttons, 0,
                                          Qt.AlignRight | Qt.AlignVCenter)

        self.verticalLayout.addWidget(self.topbar_menu)

        self.gridLayout = QGridLayout()
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName(u"gridLayout")
        self.left_side_menu = QFrame(self.centralwidget)
        self.left_side_menu.setObjectName(u"left_side_menu")
        self.left_side_menu.setMinimumSize(QSize(50, 0))
        self.left_side_menu.setMaximumSize(QSize(50, 16777215))
        self.left_side_menu.setStyleSheet(u"QFrame{\n"
                                          "	background-color: black;\n"
                                          "}\n"
                                          "QPushButton{\n"
                                          "	background: transparent;\n"
                                          "	color: white;\n"
                                          "}")
        self.left_side_menu.setFrameShape(QFrame.WinPanel)
        self.left_side_menu.setFrameShadow(QFrame.Raised)
        self.verticalLayout_3 = QVBoxLayout(self.left_side_menu)
        self.verticalLayout_3.setSpacing(0)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.left_menu_buttons = QFrame(self.left_side_menu)
        self.left_menu_buttons.setObjectName(u"left_menu_buttons")
        self.left_menu_buttons.setStyleSheet(u"")
        self.left_menu_buttons.setFrameShape(QFrame.StyledPanel)
        self.left_menu_buttons.setFrameShadow(QFrame.Raised)
        self.verticalLayout_2 = QVBoxLayout(self.left_menu_buttons)
        self.verticalLayout_2.setSpacing(35)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(0, 28, 0, 20)
        self.homeButton = QPushButton(self.left_menu_buttons)
        self.homeButton.setObjectName(u"homeButton")
        self.homeButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.homeButton.setStyleSheet(u"margin-left: 42%;")
        icon4 = QIcon()
        icon4.addFile(u":/Icons/Icons/New-Home-Icon.svg", QSize(),
                      QIcon.Normal, QIcon.Off)
        self.homeButton.setIcon(icon4)
        self.homeButton.setIconSize(QSize(32, 32))

        self.verticalLayout_2.addWidget(self.homeButton)

        self.listButton = QPushButton(self.left_menu_buttons)
        self.listButton.setObjectName(u"listButton")
        self.listButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.listButton.setStyleSheet(u"margin-left: 42%;")
        icon5 = QIcon()
        icon5.addFile(u":/Icons/Icons/New-Search-Icon.svg", QSize(),
                      QIcon.Normal, QIcon.Off)
        self.listButton.setIcon(icon5)
        self.listButton.setIconSize(QSize(32, 32))

        self.verticalLayout_2.addWidget(self.listButton, 0, Qt.AlignHCenter)

        self.addButton = QPushButton(self.left_menu_buttons)
        self.addButton.setObjectName(u"addButton")
        self.addButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.addButton.setStyleSheet(u"margin-left: 50%;")
        icon6 = QIcon()
        icon6.addFile(u":/Icons/Icons/New_Add.svg", QSize(), QIcon.Normal,
                      QIcon.Off)
        self.addButton.setIcon(icon6)
        self.addButton.setIconSize(QSize(32, 32))

        self.verticalLayout_2.addWidget(self.addButton, 0, Qt.AlignHCenter)

        self.removeButton = QPushButton(self.left_menu_buttons)
        self.removeButton.setObjectName(u"removeButton")
        self.removeButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.removeButton.setStyleSheet(u"margin-left: 45%;")
        icon7 = QIcon()
        icon7.addFile(u":/Icons/Icons/New_Delete.svg", QSize(), QIcon.Normal,
                      QIcon.Off)
        self.removeButton.setIcon(icon7)
        self.removeButton.setIconSize(QSize(32, 32))

        self.verticalLayout_2.addWidget(self.removeButton, 0, Qt.AlignHCenter)

        self.verticalLayout_3.addWidget(self.left_menu_buttons, 0,
                                        Qt.AlignHCenter | Qt.AlignTop)

        self.versionWdiget = QWidget(self.left_side_menu)
        self.versionWdiget.setObjectName(u"versionWdiget")
        self.verticalLayout_17 = QVBoxLayout(self.versionWdiget)
        self.verticalLayout_17.setSpacing(0)
        self.verticalLayout_17.setObjectName(u"verticalLayout_17")
        self.verticalLayout_17.setContentsMargins(0, 0, 0, 0)
        self.versionLabel = QLabel(self.versionWdiget)
        self.versionLabel.setObjectName(u"versionLabel")
        self.versionLabel.setStyleSheet(u"color: white;\n"
                                        "margin-bottom: 5%;")
        self.versionLabel.setScaledContents(False)

        self.verticalLayout_17.addWidget(self.versionLabel, 0,
                                         Qt.AlignHCenter | Qt.AlignVCenter)

        self.verticalLayout_3.addWidget(self.versionWdiget, 0,
                                        Qt.AlignHCenter | Qt.AlignBottom)

        self.gridLayout.addWidget(self.left_side_menu, 0, 0, 2, 1)

        self.footer = QFrame(self.centralwidget)
        self.footer.setObjectName(u"footer")
        self.footer.setMinimumSize(QSize(0, 20))
        self.footer.setMaximumSize(QSize(16777215, 20))
        self.footer.setStyleSheet(u"background-color: black;\n" "")
        self.footer.setFrameShape(QFrame.WinPanel)
        self.footer.setFrameShadow(QFrame.Raised)
        self.verticalLayout_10 = QVBoxLayout(self.footer)
        self.verticalLayout_10.setSpacing(0)
        self.verticalLayout_10.setObjectName(u"verticalLayout_10")
        self.verticalLayout_10.setContentsMargins(0, 0, 0, 0)
        self.size_grip = QFrame(self.footer)
        self.size_grip.setObjectName(u"size_grip")
        self.size_grip.setMinimumSize(QSize(20, 15))
        self.size_grip.setCursor(QCursor(Qt.SizeFDiagCursor))
        self.size_grip.setStyleSheet(u"background-color: rgb(255, 0, 0);")
        self.size_grip.setFrameShape(QFrame.StyledPanel)
        self.size_grip.setFrameShadow(QFrame.Raised)

        self.verticalLayout_10.addWidget(self.size_grip, 0,
                                         Qt.AlignRight | Qt.AlignBottom)

        self.gridLayout.addWidget(self.footer, 1, 1, 1, 1)

        self.content_menu = QFrame(self.centralwidget)
        self.content_menu.setObjectName(u"content_menu")
        self.content_menu.setMinimumSize(QSize(30, 60))
        self.content_menu.setStyleSheet(u"background-color: #333;")
        self.content_menu.setFrameShape(QFrame.WinPanel)
        self.content_menu.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_4 = QHBoxLayout(self.content_menu)
        self.horizontalLayout_4.setSpacing(0)
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.containerPages = QStackedWidget(self.content_menu)
        self.containerPages.setObjectName(u"containerPages")
        font1 = QFont()
        font1.setFamily(u"Bahnschrift")
        font1.setPointSize(30)
        self.containerPages.setFont(font1)
        self.containerPages.setStyleSheet(u"background: #333;\n"
                                          "QRadioButton{\n"
                                          "	font: 12pt \"Bahnschript\";\n"
                                          "	font-style: italic;\n"
                                          "	color: white;\n"
                                          "}")
        self.HomeWWidget = QWidget()
        self.HomeWWidget.setObjectName(u"HomeWWidget")
        self.HomeWWidget.setStyleSheet(
            u"border-image: url(:/Icons/Icons/Home-Background.svg);")
        self.verticalLayout_11 = QVBoxLayout(self.HomeWWidget)
        self.verticalLayout_11.setObjectName(u"verticalLayout_11")
        self.verticalLayout_11.setContentsMargins(0, 0, 0, 40)
        self.homeTitleLabel = QLabel(self.HomeWWidget)
        self.homeTitleLabel.setObjectName(u"homeTitleLabel")
        font2 = QFont()
        font2.setFamily(u"Bahnschrift")
        font2.setPointSize(60)
        font2.setBold(True)
        font2.setWeight(75)
        self.homeTitleLabel.setFont(font2)
        self.homeTitleLabel.setStyleSheet(u"border-image: none;\n"
                                          "background: transparent;\n"
                                          "color: white;")
        self.homeTitleLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_11.addWidget(self.homeTitleLabel)

        self.homeintroLabel = QLabel(self.HomeWWidget)
        self.homeintroLabel.setObjectName(u"homeintroLabel")
        font3 = QFont()
        font3.setFamily(u"Bahnschrift")
        font3.setPointSize(12)
        self.homeintroLabel.setFont(font3)
        self.homeintroLabel.setStyleSheet(u"border-image: none;\n"
                                          "background: transparent;\n"
                                          "color: white;")
        self.homeintroLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_11.addWidget(self.homeintroLabel, 0,
                                         Qt.AlignHCenter | Qt.AlignTop)

        self.containerPages.addWidget(self.HomeWWidget)
        self.SearchWidget = QWidget()
        self.SearchWidget.setObjectName(u"SearchWidget")
        self.verticalLayout_9 = QVBoxLayout(self.SearchWidget)
        self.verticalLayout_9.setSpacing(7)
        self.verticalLayout_9.setObjectName(u"verticalLayout_9")
        self.verticalLayout_9.setContentsMargins(5, 0, 5, 5)
        self.searchbarFrame = QFrame(self.SearchWidget)
        self.searchbarFrame.setObjectName(u"searchbarFrame")
        self.searchbarFrame.setFrameShape(QFrame.StyledPanel)
        self.searchbarFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_8 = QHBoxLayout(self.searchbarFrame)
        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
        self.searchbarLineEdit = QLineEdit(self.searchbarFrame)
        self.searchbarLineEdit.setObjectName(u"searchbarLineEdit")
        self.searchbarLineEdit.setStyleSheet(u"color: white;\n"
                                             "border: 1px solid white;\n"
                                             "border-radius: 5px;")
        self.searchbarLineEdit.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_8.addWidget(self.searchbarLineEdit)

        self.searchbarButton = QPushButton(self.searchbarFrame)
        self.searchbarButton.setObjectName(u"searchbarButton")
        self.searchbarButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.searchbarButton.setStyleSheet(u"border: none;")
        self.searchbarButton.setIcon(icon5)
        self.searchbarButton.setIconSize(QSize(20, 20))

        self.horizontalLayout_8.addWidget(self.searchbarButton)

        self.verticalLayout_9.addWidget(self.searchbarFrame)

        self.FilterCheckBoxFrame = QFrame(self.SearchWidget)
        self.FilterCheckBoxFrame.setObjectName(u"FilterCheckBoxFrame")
        self.FilterCheckBoxFrame.setStyleSheet(u"QRadioButton{\n"
                                               "	font: 9pt \"Bahnschript\";\n"
                                               "	font-style: italic;\n"
                                               "	color: white;\n"
                                               "}")
        self.FilterCheckBoxFrame.setFrameShape(QFrame.StyledPanel)
        self.FilterCheckBoxFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_9 = QHBoxLayout(self.FilterCheckBoxFrame)
        self.horizontalLayout_9.setSpacing(0)
        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
        self.horizontalLayout_9.setContentsMargins(0, 0, 0, 0)
        self.recentDateOrderRadioButton = QRadioButton(
            self.FilterCheckBoxFrame)
        self.recentDateOrderRadioButton.setObjectName(
            u"recentDateOrderRadioButton")

        self.horizontalLayout_9.addWidget(self.recentDateOrderRadioButton, 0,
                                          Qt.AlignHCenter)

        self.oldDateOrderRadioButton = QRadioButton(self.FilterCheckBoxFrame)
        self.oldDateOrderRadioButton.setObjectName(u"oldDateOrderRadioButton")

        self.horizontalLayout_9.addWidget(self.oldDateOrderRadioButton, 0,
                                          Qt.AlignHCenter)

        self.alphabeticalOrderRadioButton = QRadioButton(
            self.FilterCheckBoxFrame)
        self.alphabeticalOrderRadioButton.setObjectName(
            u"alphabeticalOrderRadioButton")

        self.horizontalLayout_9.addWidget(self.alphabeticalOrderRadioButton, 0,
                                          Qt.AlignHCenter)

        self.verticalLayout_9.addWidget(self.FilterCheckBoxFrame)

        self.tableFrame = QFrame(self.SearchWidget)
        self.tableFrame.setObjectName(u"tableFrame")
        self.tableFrame.setFrameShape(QFrame.StyledPanel)
        self.tableFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_12 = QVBoxLayout(self.tableFrame)
        self.verticalLayout_12.setSpacing(0)
        self.verticalLayout_12.setObjectName(u"verticalLayout_12")
        self.verticalLayout_12.setContentsMargins(0, 0, 0, 0)
        self.clientsDataTableView = QTableView(self.tableFrame)
        self.clientsDataTableView.setObjectName(u"clientsDataTableView")
        self.clientsDataTableView.setStyleSheet(u"border: 1px solid white;\n"
                                                "border-radius: 2px;")

        self.verticalLayout_12.addWidget(self.clientsDataTableView)

        self.verticalLayout_9.addWidget(self.tableFrame)

        self.ViewClientButton = QPushButton(self.SearchWidget)
        self.ViewClientButton.setObjectName(u"ViewClientButton")
        self.ViewClientButton.setMinimumSize(QSize(100, 50))
        font4 = QFont()
        font4.setPointSize(15)
        self.ViewClientButton.setFont(font4)
        self.ViewClientButton.setStyleSheet(u"background-color: #bd6e38;\n"
                                            "color: white;\n"
                                            "border: 4px solid white;\n"
                                            "border-radius: 15px;\n"
                                            "")

        self.verticalLayout_9.addWidget(self.ViewClientButton, 0,
                                        Qt.AlignHCenter)

        self.containerPages.addWidget(self.SearchWidget)
        self.ViewClientWidget = QWidget()
        self.ViewClientWidget.setObjectName(u"ViewClientWidget")
        self.verticalLayout_13 = QVBoxLayout(self.ViewClientWidget)
        self.verticalLayout_13.setObjectName(u"verticalLayout_13")
        self.ClientViewFrame = QFrame(self.ViewClientWidget)
        self.ClientViewFrame.setObjectName(u"ClientViewFrame")
        self.ClientViewFrame.setStyleSheet(u"QLabel{\n"
                                           "	font: 12pt \"Bahnschript\";\n"
                                           "	font-style: italic;\n"
                                           "	color: white;\n"
                                           "}\n"
                                           "\n"
                                           "QLineEdit{\n"
                                           "	border-right: none;\n"
                                           "	border-top: none;\n"
                                           "	border-left: none;\n"
                                           "	border-bottom: 1px solid white;\n"
                                           "}")
        self.ClientViewFrame.setFrameShape(QFrame.StyledPanel)
        self.ClientViewFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_14 = QVBoxLayout(self.ClientViewFrame)
        self.verticalLayout_14.setObjectName(u"verticalLayout_14")
        self.verticalLayout_14.setContentsMargins(-1, 15, 0, 0)
        self.gridLayout_4 = QGridLayout()
        self.gridLayout_4.setObjectName(u"gridLayout_4")
        self.gridLayout_4.setHorizontalSpacing(35)
        self.gridLayout_4.setVerticalSpacing(20)
        self.gridLayout_4.setContentsMargins(20, -1, 20, -1)
        self.NameLabel = QLabel(self.ClientViewFrame)
        self.NameLabel.setObjectName(u"NameLabel")

        self.gridLayout_4.addWidget(self.NameLabel, 0, 0, 1, 1)

        self.lineEdit = QLineEdit(self.ClientViewFrame)
        self.lineEdit.setObjectName(u"lineEdit")
        self.lineEdit.setStyleSheet(u"	font: 12pt \"Bahnschript\";\n"
                                    "	font-style: italic;\n"
                                    "	color: white;")
        self.lineEdit.setAlignment(Qt.AlignCenter)

        self.gridLayout_4.addWidget(self.lineEdit, 0, 1, 1, 1)

        self.CreationDateLabel = QLabel(self.ClientViewFrame)
        self.CreationDateLabel.setObjectName(u"CreationDateLabel")

        self.gridLayout_4.addWidget(self.CreationDateLabel, 0, 2, 1, 1)

        self.lineEdit_2 = QLineEdit(self.ClientViewFrame)
        self.lineEdit_2.setObjectName(u"lineEdit_2")
        self.lineEdit_2.setStyleSheet(u"	font: 12pt \"Bahnschript\";\n"
                                      "	font-style: italic;\n"
                                      "	color: white;")
        self.lineEdit_2.setAlignment(Qt.AlignCenter)

        self.gridLayout_4.addWidget(self.lineEdit_2, 0, 3, 1, 1)

        self.IdLabel = QLabel(self.ClientViewFrame)
        self.IdLabel.setObjectName(u"IdLabel")

        self.gridLayout_4.addWidget(self.IdLabel, 1, 0, 1, 1)

        self.lineEdit_4 = QLineEdit(self.ClientViewFrame)
        self.lineEdit_4.setObjectName(u"lineEdit_4")
        self.lineEdit_4.setStyleSheet(u"	font: 12pt \"Bahnschript\";\n"
                                      "	font-style: italic;\n"
                                      "	color: white;")
        self.lineEdit_4.setAlignment(Qt.AlignCenter)

        self.gridLayout_4.addWidget(self.lineEdit_4, 1, 1, 1, 1)

        self.ExpirationDateLabel = QLabel(self.ClientViewFrame)
        self.ExpirationDateLabel.setObjectName(u"ExpirationDateLabel")

        self.gridLayout_4.addWidget(self.ExpirationDateLabel, 1, 2, 1, 1)

        self.lineEdit_3 = QLineEdit(self.ClientViewFrame)
        self.lineEdit_3.setObjectName(u"lineEdit_3")
        self.lineEdit_3.setStyleSheet(u"	font: 12pt \"Bahnschript\";\n"
                                      "	font-style: italic;\n"
                                      "	color: white;")
        self.lineEdit_3.setAlignment(Qt.AlignCenter)

        self.gridLayout_4.addWidget(self.lineEdit_3, 1, 3, 1, 1)

        self.verticalLayout_14.addLayout(self.gridLayout_4)

        self.Valid_InvalidLabel = QLabel(self.ClientViewFrame)
        self.Valid_InvalidLabel.setObjectName(u"Valid_InvalidLabel")
        font5 = QFont()
        font5.setFamily(u"Bahnschript")
        font5.setPointSize(25)
        font5.setBold(False)
        font5.setItalic(True)
        font5.setWeight(50)
        self.Valid_InvalidLabel.setFont(font5)
        self.Valid_InvalidLabel.setStyleSheet(u"font: 25pt \"Bahnschript\";\n"
                                              "font-style: italic;\n"
                                              "color: white;")
        self.Valid_InvalidLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_14.addWidget(self.Valid_InvalidLabel)

        self.PrintButton = QPushButton(self.ClientViewFrame)
        self.PrintButton.setObjectName(u"PrintButton")
        self.PrintButton.setMinimumSize(QSize(110, 40))
        font6 = QFont()
        font6.setPointSize(11)
        font6.setBold(True)
        font6.setWeight(75)
        self.PrintButton.setFont(font6)
        self.PrintButton.setStyleSheet(u"background-color: #bd6e38;\n"
                                       "color: white;\n"
                                       "border: 4px solid white;\n"
                                       "border-radius: 15px;\n"
                                       "")

        self.verticalLayout_14.addWidget(self.PrintButton, 0, Qt.AlignHCenter)

        self.verticalLayout_13.addWidget(self.ClientViewFrame)

        self.containerPages.addWidget(self.ViewClientWidget)
        self.AddWidget = QWidget()
        self.AddWidget.setObjectName(u"AddWidget")
        self.verticalLayout_6 = QVBoxLayout(self.AddWidget)
        self.verticalLayout_6.setObjectName(u"verticalLayout_6")
        self.addTextFrame = QFrame(self.AddWidget)
        self.addTextFrame.setObjectName(u"addTextFrame")
        self.addTextFrame.setStyleSheet(u"border-bottom: 1px solid #bd6e38;\n"
                                        "border-top: 2px solid #bd6e38;")
        self.addTextFrame.setFrameShape(QFrame.StyledPanel)
        self.addTextFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_5 = QVBoxLayout(self.addTextFrame)
        self.verticalLayout_5.setObjectName(u"verticalLayout_5")
        self.verticalLayout_5.setContentsMargins(0, -1, 0, -1)
        self.addTextLabel = QLabel(self.addTextFrame)
        self.addTextLabel.setObjectName(u"addTextLabel")
        font7 = QFont()
        font7.setFamily(u"Bahnschrift")
        font7.setPointSize(15)
        font7.setItalic(True)
        self.addTextLabel.setFont(font7)
        self.addTextLabel.setStyleSheet(u"color: white;\n" "border: none;")
        self.addTextLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_5.addWidget(self.addTextLabel)

        self.verticalLayout_6.addWidget(self.addTextFrame)

        self.InsertNameFrame = QFrame(self.AddWidget)
        self.InsertNameFrame.setObjectName(u"InsertNameFrame")
        self.InsertNameFrame.setFrameShape(QFrame.StyledPanel)
        self.InsertNameFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_5 = QHBoxLayout(self.InsertNameFrame)
        self.horizontalLayout_5.setSpacing(13)
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.addNameLabel = QLabel(self.InsertNameFrame)
        self.addNameLabel.setObjectName(u"addNameLabel")
        font8 = QFont()
        font8.setFamily(u"Bahnschrift")
        font8.setPointSize(17)
        font8.setItalic(True)
        self.addNameLabel.setFont(font8)
        self.addNameLabel.setStyleSheet(u"color: white;\n"
                                        "margin-left:  70%;\n"
                                        "margin-bottom: 10%;\n"
                                        "")
        self.addNameLabel.setAlignment(Qt.AlignCenter)
        self.addNameLabel.setMargin(0)

        self.horizontalLayout_5.addWidget(self.addNameLabel)

        self.addLineEdit = QLineEdit(self.InsertNameFrame)
        self.addLineEdit.setObjectName(u"addLineEdit")
        self.addLineEdit.setMinimumSize(QSize(50, 0))
        font9 = QFont()
        font9.setFamily(u"Bahnschrift")
        font9.setPointSize(17)
        self.addLineEdit.setFont(font9)
        self.addLineEdit.setStyleSheet(u"margin-right: 70%;\n"
                                       "color: white;\n"
                                       "border-top: none;\n"
                                       "border-left: none;\n"
                                       "border-right: none;\n"
                                       "border-bottom: 1px solid white;\n"
                                       "\n"
                                       "")
        self.addLineEdit.setAlignment(Qt.AlignCenter)
        self.addLineEdit.setDragEnabled(False)

        self.horizontalLayout_5.addWidget(self.addLineEdit)

        self.verticalLayout_6.addWidget(self.InsertNameFrame)

        self.addButtonsFrame = QFrame(self.AddWidget)
        self.addButtonsFrame.setObjectName(u"addButtonsFrame")
        self.addButtonsFrame.setFrameShape(QFrame.StyledPanel)
        self.addButtonsFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_6 = QHBoxLayout(self.addButtonsFrame)
        self.horizontalLayout_6.setSpacing(40)
        self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
        self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
        self.addPushBUtton = QPushButton(self.addButtonsFrame)
        self.addPushBUtton.setObjectName(u"addPushBUtton")
        self.addPushBUtton.setMinimumSize(QSize(0, 34))
        font10 = QFont()
        font10.setFamily(u"Bahnschrift")
        font10.setPointSize(14)
        self.addPushBUtton.setFont(font10)
        self.addPushBUtton.setStyleSheet(u"background-color: #bd6e38;\n"
                                         "color: white;\n"
                                         "border: 4px solid white;\n"
                                         "border-radius: 15px;\n"
                                         "margin-left: 70%;")

        self.horizontalLayout_6.addWidget(self.addPushBUtton)

        self.quitPushButton = QPushButton(self.addButtonsFrame)
        self.quitPushButton.setObjectName(u"quitPushButton")
        self.quitPushButton.setMinimumSize(QSize(0, 34))
        self.quitPushButton.setFont(font10)
        self.quitPushButton.setStyleSheet(u"background-color: #bd6e38;\n"
                                          "color: white;\n"
                                          "border: 4px solid white;\n"
                                          "border-radius: 15px;\n"
                                          "margin-right: 70%;")

        self.horizontalLayout_6.addWidget(self.quitPushButton)

        self.verticalLayout_6.addWidget(self.addButtonsFrame)

        self.containerPages.addWidget(self.AddWidget)
        self.RemoveWidget = QWidget()
        self.RemoveWidget.setObjectName(u"RemoveWidget")
        self.horizontalLayout_11 = QHBoxLayout(self.RemoveWidget)
        self.horizontalLayout_11.setSpacing(2)
        self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
        self.horizontalLayout_11.setContentsMargins(0, 2, 2, 3)
        self.removeElementsFrame = QFrame(self.RemoveWidget)
        self.removeElementsFrame.setObjectName(u"removeElementsFrame")
        self.verticalLayout_16 = QVBoxLayout(self.removeElementsFrame)
        self.verticalLayout_16.setSpacing(0)
        self.verticalLayout_16.setObjectName(u"verticalLayout_16")
        self.verticalLayout_16.setContentsMargins(0, -1, -1, -1)
        self.verticalLayout_15 = QVBoxLayout()
        self.verticalLayout_15.setObjectName(u"verticalLayout_15")
        self.removeTextFrame = QFrame(self.removeElementsFrame)
        self.removeTextFrame.setObjectName(u"removeTextFrame")
        self.removeTextFrame.setStyleSheet(
            u"border-right: 1px solid #bd6e38;\n"
            "border-bottom: 1px solid #bd6e38;\n"
            "border-top: 2px solid #bd6e38;\n"
            "border-top-right-radius: 4px;\n"
            "border-bottom-right-radius: 4px;")
        self.removeTextFrame.setFrameShape(QFrame.StyledPanel)
        self.removeTextFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_7 = QVBoxLayout(self.removeTextFrame)
        self.verticalLayout_7.setObjectName(u"verticalLayout_7")
        self.verticalLayout_7.setContentsMargins(0, -1, 0, -1)
        self.removeLabel = QLabel(self.removeTextFrame)
        self.removeLabel.setObjectName(u"removeLabel")
        self.removeLabel.setFont(font7)
        self.removeLabel.setStyleSheet(u"color: white;\n" "border: none;")
        self.removeLabel.setAlignment(Qt.AlignCenter)

        self.verticalLayout_7.addWidget(self.removeLabel)

        self.verticalLayout_15.addWidget(self.removeTextFrame, 0,
                                         Qt.AlignLeft | Qt.AlignTop)

        self.removeSearchbarFrame = QFrame(self.removeElementsFrame)
        self.removeSearchbarFrame.setObjectName(u"removeSearchbarFrame")
        self.removeSearchbarFrame.setStyleSheet(u"")
        self.removeSearchbarFrame.setFrameShape(QFrame.StyledPanel)
        self.removeSearchbarFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_10 = QHBoxLayout(self.removeSearchbarFrame)
        self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
        self.removeSearchbarLineEdit = QLineEdit(self.removeSearchbarFrame)
        self.removeSearchbarLineEdit.setObjectName(u"removeSearchbarLineEdit")
        self.removeSearchbarLineEdit.setStyleSheet(u"color: white;\n"
                                                   "border: 1px solid white;\n"
                                                   "border-radius: 5px;")
        self.removeSearchbarLineEdit.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_10.addWidget(self.removeSearchbarLineEdit)

        self.removeSearchbarButton = QPushButton(self.removeSearchbarFrame)
        self.removeSearchbarButton.setObjectName(u"removeSearchbarButton")
        self.removeSearchbarButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.removeSearchbarButton.setStyleSheet(u"border: none;")
        self.removeSearchbarButton.setIcon(icon5)
        self.removeSearchbarButton.setIconSize(QSize(20, 20))

        self.horizontalLayout_10.addWidget(self.removeSearchbarButton)

        self.verticalLayout_15.addWidget(self.removeSearchbarFrame, 0,
                                         Qt.AlignTop)

        self.verticalLayout_16.addLayout(self.verticalLayout_15)

        self.removeButtonsFrame = QFrame(self.removeElementsFrame)
        self.removeButtonsFrame.setObjectName(u"removeButtonsFrame")
        self.removeButtonsFrame.setFrameShape(QFrame.StyledPanel)
        self.removeButtonsFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_7 = QHBoxLayout(self.removeButtonsFrame)
        self.horizontalLayout_7.setSpacing(40)
        self.horizontalLayout_7.setObjectName(u"horizontalLayout_7")
        self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0)
        self.removePushButton = QPushButton(self.removeButtonsFrame)
        self.removePushButton.setObjectName(u"removePushButton")
        self.removePushButton.setMinimumSize(QSize(0, 34))
        self.removePushButton.setFont(font10)
        self.removePushButton.setStyleSheet(u"background-color: #bd6e38;\n"
                                            "color: white;\n"
                                            "border: 4px solid white;\n"
                                            "border-radius: 15px;\n"
                                            "margin-left: 20%;")

        self.horizontalLayout_7.addWidget(self.removePushButton)

        self.quitPushButton_2 = QPushButton(self.removeButtonsFrame)
        self.quitPushButton_2.setObjectName(u"quitPushButton_2")
        self.quitPushButton_2.setMinimumSize(QSize(0, 34))
        self.quitPushButton_2.setFont(font10)
        self.quitPushButton_2.setStyleSheet(u"background-color: #bd6e38;\n"
                                            "color: white;\n"
                                            "border: 4px solid white;\n"
                                            "border-radius: 15px;\n"
                                            "margin-right: 20%;")

        self.horizontalLayout_7.addWidget(self.quitPushButton_2)

        self.verticalLayout_16.addWidget(self.removeButtonsFrame, 0,
                                         Qt.AlignBottom)

        self.horizontalLayout_11.addWidget(self.removeElementsFrame, 0,
                                           Qt.AlignLeft)

        self.removeTableFrame = QFrame(self.RemoveWidget)
        self.removeTableFrame.setObjectName(u"removeTableFrame")
        self.removeTableFrame.setFrameShape(QFrame.StyledPanel)
        self.removeTableFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_8 = QVBoxLayout(self.removeTableFrame)
        self.verticalLayout_8.setSpacing(0)
        self.verticalLayout_8.setObjectName(u"verticalLayout_8")
        self.verticalLayout_8.setContentsMargins(35, -1, -1, -1)
        self.removetableView = QTableView(self.removeTableFrame)
        self.removetableView.setObjectName(u"removetableView")
        self.removetableView.setStyleSheet(u"border: 1px solid white;\n"
                                           "border-radius: 2px;")

        self.verticalLayout_8.addWidget(self.removetableView)

        self.horizontalLayout_11.addWidget(self.removeTableFrame)

        self.containerPages.addWidget(self.RemoveWidget)

        self.horizontalLayout_4.addWidget(self.containerPages)

        self.gridLayout.addWidget(self.content_menu, 0, 1, 1, 1)

        self.verticalLayout.addLayout(self.gridLayout)

        Main.setCentralWidget(self.centralwidget)

        self.retranslateUi(Main)

        self.containerPages.setCurrentIndex(1)

        QMetaObject.connectSlotsByName(Main)
示例#5
0
    def setButtons(self):
        '''A Mutator function that defines all buttons in TrainWindow.'''
        self.p1_button = QPushButton('P1', self)
        self.p1_button.setGeometry(0, 0, 50, 100)
        self.p1_button.setStyleSheet('background-color: rgba(180,180,180,255);')

        self.p2_button = QPushButton('P2', self)
        self.p2_button.setGeometry(50, 0, 50, 100)

        self.p3_button = QPushButton('P3', self)
        self.p3_button.setGeometry(100, 0, 50, 100)

        # Model dropdown menu to select Precision Level specific model
        self.model_selector = QComboBox(self)
        self.model_selector.setGeometry(self._TRAIN_WIN_W-150, 0, 150, 100)
        self.model_selector.setStyleSheet('background-color: red;')
        self.populateModelSelector()

        self.model_selector_label = QLabel(self)
        self.model_selector_label.setText('Choose Model =')
        self.model_selector_label.move(220, 40)

        # Labeller button to initiate labelme
        self.label_button = QPushButton('Label Dataset', self)
        self.label_button.setIcon(QIcon('img/label.png'))
        self.label_button.setIconSize(QSize(50, 50))
        self.label_button.setGeometry(0, 200, self._TRAIN_WIN_W/2, 100)
        self.label_button.setStyleSheet('background-color: rgba(0,200,10,255);')
        if self._precision_level == 1:
            self.label_button.hide()

        self.generate_button = QPushButton('Generate Dataset', self)
        self.generate_button.setIcon(QIcon('img/label.png'))
        self.generate_button.setIconSize(QSize(50, 50))
        self.generate_button.setGeometry(self._TRAIN_WIN_W/2, 200, self._TRAIN_WIN_W/2, 100)
        self.generate_button.setStyleSheet('background-color: rgba(0,200,10,255);')
        if self._precision_level == 1:
            self.generate_button.hide()

        # Labeller button to initiate labelme
        self.validate_button = QPushButton('Validate Dataset', self)
        self.validate_button.setIcon(QIcon('img/validate.png'))
        self.validate_button.setIconSize(QSize(50, 50))
        self.validate_button.setGeometry(self._TRAIN_WIN_W/2, 300, self._TRAIN_WIN_W/2, 100)

        # Dataset button to prompt input via FileDialogue
        self.dataset_button = QPushButton('Choose Dataset', self)
        self.dataset_button.setIcon(QIcon('img/dataset.png'))
        self.dataset_button.setIconSize(QSize(50, 50))
        self.dataset_button.setGeometry(0, 300, self._TRAIN_WIN_W/2, 100)
        self.dataset_button.setStyleSheet('background-color: red;')

        # Start Training button to start and display training process
        self.train_button = QPushButton('Train', self)
        self.train_button.setIcon(QIcon('img/train.png'))
        self.train_button.setIconSize(QSize(75, 75))
        self.train_button.setGeometry(0, self._TRAIN_WIN_H-100, self._TRAIN_WIN_W, 100)
        self.train_button.setStyleSheet('background-color: rgba(180,180,180,255);')

        # Set Label List
        self.list_button = QPushButton('Choose Label List', self)
        self.list_button.setIcon(QIcon('img/label_list.png'))
        self.list_button.setIconSize(QSize(75, 75))
        self.list_button.setGeometry(0, 100, self._TRAIN_WIN_W, 100)
        self.list_button.setStyleSheet('background-color: rgba(200,10,0,255);')

        self.p1_button.clicked.connect(self.setP1)
        self.p2_button.clicked.connect(self.setP2)
        self.p3_button.clicked.connect(self.setP3)

        self.model_selector.activated.connect(self.setModel)
        self.dataset_button.clicked.connect(self.setDataset)
        self.label_button.clicked.connect(self.runLabelme)
        self.generate_button.clicked.connect(self.conformDatasetToCOCO)
        self.validate_button.clicked.connect(self.validateDataset)
        self.list_button.clicked.connect(self.setLabelList)
示例#6
0
def startNexT(cfgfile, active, execScripts, execCode, withGui):
    """
    Starts next with the given config file and activates the given application.
    :param cfgfile: path to config file
    :param active: active application (if None, the first application in the config will be used)
    :return: None
    """
    logger.debug("Starting nexxT...")
    config = Configuration()
    lcl = QLocale.system()
    lcl.setNumberOptions(QLocale.c().numberOptions())
    QLocale.setDefault(lcl)
    if withGui:
        app = QApplication(
        ) if QApplication.instance() is None else QApplication.instance()
        app.setWindowIcon(QIcon(":icons/nexxT.svg"))
        app.setOrganizationName("nexxT")
        app.setApplicationName("nexxT")
        setupGuiServices(config)
    else:
        app = QCoreApplication() if QCoreApplication.instance(
        ) is None else QCoreApplication.instance()
        app.setOrganizationName("nexxT")
        app.setApplicationName("nexxT")
        setupConsoleServices(config)

    if cfgfile is not None:
        ConfigFileLoader.load(config, cfgfile)
    if withGui:
        mainWindow = Services.getService("MainWindow")
        mainWindow.restoreState()
        mainWindow.show()
        # the reference will still be held by the service, but here we don't need it anymore
        del mainWindow
    if active is not None:
        config.activate(active)
        # pylint: disable=unused-variable
        # need to hold the reference of this until the method is called
        i2 = MethodInvoker(
            dict(object=Application, method="initialize", thread=app.thread()),
            MethodInvoker.IDLE_TASK)  # pylint: disable=unused-variable
        waitForSignal(config.appActivated)
        if Application.activeApplication.getState() != FilterState.ACTIVE:
            waitForSignal(Application.activeApplication.stateChanged,
                          lambda s: s == FilterState.ACTIVE)
        logger.info("done")

    def cleanup():
        logger.debug("cleaning up loaded services")
        Services.removeAll()
        logger.debug("cleaning up loaded plugins")
        for v in ("last_traceback", "last_type", "last_value"):
            if hasattr(sys, v):
                del sys.__dict__[v]
        #PluginManager.singleton().unloadAll()
        logger.debug("cleaning up complete")

    code_globals = {}
    for c in execCode:
        logger.info("Executing code '%s'", c)
        # note that exec is used intentionally here to provide the user with scripting posibilities
        exec(compile(c, "<string>", 'exec'), code_globals)  # pylint: disable=exec-used
        logger.debug("Executing code done")

    for s in execScripts:
        logger.info("Executing script '%s'", s)
        with open(s) as fscript:
            # note that exec is used intentionally here to provide the user with scripting possibilities
            exec(compile(fscript.read(), s, 'exec'), code_globals)  # pylint: disable=exec-used
        logger.debug("Executing script done")

    res = app.exec_()
    logger.debug("closing config")
    config.close()
    cleanup()

    logger.internal("app.exec_ returned")

    return res
 def setIcon(self):
     appIcon = QIcon("icon.png")
     self.setWindowIcon(appIcon)
示例#8
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.playlist = QMediaPlaylist()
        self.player = QMediaPlayer()

        toolBar = QToolBar()
        self.addToolBar(toolBar)

        fileMenu = self.menuBar().addMenu("&File")
        openAction = QAction(QIcon.fromTheme("document-open"),
                             "&Open...", self, shortcut=QKeySequence.Open,
                             triggered=self.open)
        fileMenu.addAction(openAction)
        exitAction = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut="Ctrl+Q", triggered=self.close)
        fileMenu.addAction(exitAction)

        playMenu = self.menuBar().addMenu("&Play")
        playIcon = self.style().standardIcon(QStyle.SP_MediaPlay)
        self.playAction = toolBar.addAction(playIcon, "Play")
        self.playAction.triggered.connect(self.player.play)
        playMenu.addAction(self.playAction)

        previousIcon = self.style().standardIcon(QStyle.SP_MediaSkipBackward)
        self.previousAction = toolBar.addAction(previousIcon, "Previous")
        self.previousAction.triggered.connect(self.previousClicked)
        playMenu.addAction(self.previousAction)

        pauseIcon = self.style().standardIcon(QStyle.SP_MediaPause)
        self.pauseAction = toolBar.addAction(pauseIcon, "Pause")
        self.pauseAction.triggered.connect(self.player.pause)
        playMenu.addAction(self.pauseAction)

        nextIcon = self.style().standardIcon(QStyle.SP_MediaSkipForward)
        self.nextAction = toolBar.addAction(nextIcon, "Next")
        self.nextAction.triggered.connect(self.playlist.next)
        playMenu.addAction(self.nextAction)

        stopIcon = self.style().standardIcon(QStyle.SP_MediaStop)
        self.stopAction = toolBar.addAction(stopIcon, "Stop")
        self.stopAction.triggered.connect(self.player.stop)
        playMenu.addAction(self.stopAction)

        self.volumeSlider = QSlider()
        self.volumeSlider.setOrientation(Qt.Horizontal)
        self.volumeSlider.setMinimum(0)
        self.volumeSlider.setMaximum(100)
        self.volumeSlider.setFixedWidth(app.desktop().availableGeometry(self).width() / 10)
        self.volumeSlider.setValue(self.player.volume())
        self.volumeSlider.setTickInterval(10)
        self.volumeSlider.setTickPosition(QSlider.TicksBelow)
        self.volumeSlider.setToolTip("Volume")
        self.volumeSlider.valueChanged.connect(self.player.setVolume)
        toolBar.addWidget(self.volumeSlider)

        aboutMenu = self.menuBar().addMenu("&About")
        aboutQtAct = QAction("About &Qt", self, triggered=qApp.aboutQt)
        aboutMenu.addAction(aboutQtAct)

        self.videoWidget = QVideoWidget()
        self.setCentralWidget(self.videoWidget)
        self.player.setPlaylist(self.playlist)
        self.player.stateChanged.connect(self.updateButtons)
        self.player.setVideoOutput(self.videoWidget)

        self.updateButtons(self.player.state())
示例#9
0
        self.ramTotalInfo.emit(get_size(svmen.total))

        # GPU INFO
        self.gpuModelInfo.emit(gpus[0].name)
        self.vramTotalInfo.emit(f"{gpus[0].memoryTotal}MB")

        # SHOW PERCENTAGE
        def showValues():
            self.showPercentage = True

        QTimer.singleShot(2000, showValues)


if __name__ == "__main__":
    app = QGuiApplication(sys.argv)
    engine = QQmlApplicationEngine()

    # GET CONTEXT
    main = MainWindow()
    engine.rootContext().setContextProperty("backend", main)

    # SET ICON
    app.setWindowIcon(QIcon("icon.ico"))

    # LOAD QML
    engine.load(os.path.join(os.path.dirname(__file__), "qml/main.qml"))

    if not engine.rootObjects():
        sys.exit(-1)
    sys.exit(app.exec_())
示例#10
0
def create_icon():
    data = QByteArray(icon_data)
    pixmap = QPixmap()
    pixmap.loadFromData(data)
    return QIcon(pixmap)
示例#11
0
    def __init__(self, config):
        super(MainWindow, self).__init__()

        QFontDatabase.addApplicationFont(
            '../resources/fonts/poppins/Poppins-Medium.ttf')
        QFontDatabase.addApplicationFont(
            '../resources/fonts/source code pro/SourceCodePro-Regular.ttf')
        QFontDatabase.addApplicationFont(
            '../resources/fonts/asap/Asap-Regular.ttf')

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        if MainConsole.main_console is not None:
            self.ui.scripts_console_splitter.addWidget(
                MainConsole.main_console)
        self.ui.scripts_console_splitter.setSizes([350, 350])
        self.ui.splitter.setSizes([120, 800])
        self.setWindowTitle('Ryven')
        self.setWindowIcon(QIcon('../resources/pics/program_icon2.png'))
        self.load_stylesheet('dark')
        self.ui.scripts_tab_widget.removeTab(0)

        # menu actions
        self.flow_design_actions = []
        self.setup_menu_actions()

        # shortcuts
        save_shortcut = QShortcut(QKeySequence.Save, self)
        save_shortcut.activated.connect(self.on_save_project_triggered)
        import_nodes_shortcut = QShortcut(QKeySequence('Ctrl+i'), self)
        import_nodes_shortcut.activated.connect(self.on_import_nodes_triggered)

        # clear temp folder
        if not os.path.exists('temp'):
            os.mkdir('temp')
        for f in os.listdir('temp'):
            os.remove('temp/' + f)

        # GENERAL ATTRIBUTES
        self.scripts = []
        self.custom_nodes = []
        self.all_nodes = [
            SetVar_Node(),
            GetVar_Node(),
            Val_Node(),
            Result_Node()
        ]
        self.package_names = []

        #   holds NI subCLASSES for imported nodes:
        self.all_node_instance_classes = {
            self.all_nodes[0]: SetVar_NodeInstance,
            self.all_nodes[1]: GetVar_NodeInstance,
            self.all_nodes[2]: Val_NodeInstance,
            self.all_nodes[3]: Result_NodeInstance
        }  # (key: node obj, val: NI subclass) (used in Flow)

        #   custom subclasses for input widgets
        #   {node : {str: PortInstanceWidget-subclass}} (used in PortInstance)
        self.custom_node_input_widget_classes = {}

        # UI
        self.scripts_list_widget = ScriptsListWidget(self, self.scripts)
        self.ui.scripts_scrollArea.setWidget(self.scripts_list_widget)
        self.ui.add_new_script_pushButton.clicked.connect(
            self.create_new_script_button_pressed)
        self.ui.new_script_name_lineEdit.returnPressed.connect(
            self.create_new_script_LE_return_pressed)

        if config['config'] == 'create plain new project':
            self.try_to_create_new_script()
        elif config['config'] == 'open project':
            print('importing packages...')
            self.import_packages(config['required packages'])
            print('loading project...')
            self.parse_project(config['content'])
            print('finished')

        print('''
CONTROLS
placing: right mouse
selecting: left mouse
panning: middle mouse
saving: ctrl+s
        ''')

        Design.set_flow_theme()
        Design.set_flow_theme()  # temporary
        #   the double call is just a temporary fix for an issue I will address in a future release.
        #   Problem: because the signal emitted when setting a flow theme is directly connected to the according slots
        #   in NodeInstance as well as NodeInstance_TitleLabel, the NodeInstance's slot (which starts an animation which
        #   uses the title label's current and theme dependent color) could get called before the title
        #   label's slot has been called to reinitialize this color. This results in wrong color end points for the
        #   title label when activating animations.
        #   This is pretty nasty since I cannot think of a nice fix for this issue other that not letting the slot
        #   methods be called directly from the emitted signal but instead through a defined procedure like before.

        # maybe this will be necessary due to scheduling issues when loading flows
        # for s in self.scripts:
        #     s.flow.viewport().update()

        self.resize(1500, 800)
示例#12
0
    #############################################################

    #-----> FUNCTION WHICH OPENS THE DIALOG AND DISPLAYS IT: SO TO CALL DIALOG BOX JUST CALL THE FUNCTION dialogexec() WITH ALL THE PARAMETER
    #NOW WHENEVER YOU WANT A DIALOG BOX TO APPEAR IN THE APP LIKE IN PRESS OF CLODE BUTTON, THIS CAN BE DONE BY CALLING THIS FUNCTION.        ----------(C11)
    #IT TAKES DIALOG OBJECT(INITIALISED EARLIER), HEADER NAME OF DIALOG BOX, MESSAGE TO BE DISPLAYED, ICON, BUTTON NAMES.
    #THIS CODE EXECUTES THE DIALOGBOX AND SO WE CAN SEE THE DIALOG BOX IN THE SCREEN.
    #DURING THE APPEARENCE OF THIS WINDOW, YOU CANNOT USE THE MAINWINDOW, YOU SHPULD EITHER PRESS ANY ONE OFT HE PROVIDED BUTTONS
    #OR JUST CLODE THE DIALOG BOX.
    def dialogexec(self, heading, message, icon, btn1, btn2):
        dialogUi.dialogConstrict(self.diag, heading, message, icon, btn1, btn2)
        self.diag.exec_()

    #############################################################

    #-----> FUNCTION WHICH OPENS THE ERROR BOX AND DISPLAYS IT: SO TO CALL DIALOG BOX JUST CALL THE FUNCTION errorexec() WITH ALL THE PARAMETER
    #SAME AS COMMEND (C11), EXCEPT THIS IS FOR THE ERROR BOX.
    def errorexec(self, heading, icon, btnOk):
        errorUi.errorConstrict(self.error, heading, icon, btnOk)
        self.error.exec_()

    ##############################################################


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon("icons/car.ico"))
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())

############################################################################################################################################################
示例#13
0
 def testQIconCtorWithNone(self):
     icon = QIcon(None)
     pixmap = icon.pixmap(48, 48)
     self.app.exec_()
示例#14
0
import scihubeva.resources

if hasattr(Qt, 'AA_EnableHighDpiScaling'):
    QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
    QGuiApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)

if __name__ == '__main__':
    app_path = os.path.abspath(os.path.dirname(sys.argv[0]))
    os.environ['QT_QUICK_CONTROLS_CONF'] = (
        CONF_DIR / 'qtquickcontrols2.conf').resolve().as_posix()

    app = QGuiApplication(sys.argv)

    lang = locale.getdefaultlocale()[0]
    lang_file_path = (
        TRANSLATION_DIR /
        'SciHubEVA_{lang}.qm'.format(lang=lang)).resolve().as_posix()
    translator = QTranslator()
    translator.load(lang_file_path)
    app.installTranslator(translator)

    icon_file_path = (IMAGES_DIR / 'SciHubEVA-icon.png').resolve().as_posix()
    app.setWindowIcon(QIcon(icon_file_path))

    if is_windows():
        app.setFont(QFont('Microsoft YaHei'))

    eva = SciHubEVADialog()
    sys.exit(app.exec_())
示例#15
0
    def __init__(self, filename, image, parent=None):
        super(ComparisonWidget, self).__init__(parent)

        load_button = QPushButton(self.tr("Load reference image..."))
        self.comp_label = QLabel(self.tr("Comparison:"))
        self.normal_radio = QRadioButton(self.tr("Normal"))
        self.normal_radio.setToolTip(self.tr("Show reference (raw pixels)"))
        self.normal_radio.setChecked(True)
        self.difference_radio = QRadioButton(self.tr("Difference"))
        self.difference_radio.setToolTip(
            self.tr("Show evidence/reference difference"))
        self.ssim_radio = QRadioButton(self.tr("SSIM Map"))
        self.ssim_radio.setToolTip(self.tr("Structure similarity quality map"))
        self.butter_radio = QRadioButton(self.tr("Butteraugli"))
        self.butter_radio.setToolTip(
            self.tr("Butteraugli spatial changes heatmap"))
        self.gray_check = QCheckBox(self.tr("Grayscale"))
        self.gray_check.setToolTip(self.tr("Show desaturated output"))
        self.equalize_check = QCheckBox(self.tr("Equalized"))
        self.equalize_check.setToolTip(self.tr("Apply histogram equalization"))
        self.last_radio = self.normal_radio
        self.metric_button = QPushButton(self.tr("Compute metrics"))
        self.metric_button.setToolTip(
            self.tr("Image quality assessment metrics"))

        self.evidence = image
        self.reference = self.difference = self.ssim_map = self.butter_map = None
        basename = os.path.basename(filename)
        self.evidence_viewer = ImageViewer(self.evidence, None,
                                           self.tr(f"Evidence: {basename}"))
        self.reference_viewer = ImageViewer(np.full_like(self.evidence, 127),
                                            None, self.tr("Reference"))

        self.table_widget = QTableWidget(20, 3)
        self.table_widget.setHorizontalHeaderLabels(
            [self.tr("Metric"),
             self.tr("Value"),
             self.tr("Better")])
        self.table_widget.setItem(0, 0, QTableWidgetItem(self.tr("RMSE")))
        self.table_widget.setItem(
            0, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(0, 0).setToolTip(
            self.
            tr("Root Mean Square Error (RMSE) is commonly used to compare \n"
               "the difference between the reference and evidence images \n"
               "by directly computing the variation in pixel values. \n"
               "The combined image is close to the reference image when \n"
               "RMSE value is zero. RMSE is a good indicator of the spectral \n"
               "quality of the reference image."))
        self.table_widget.setItem(1, 0, QTableWidgetItem(self.tr("SAM")))
        self.table_widget.setItem(
            1, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(1, 0).setToolTip(
            self.
            tr("It computes the spectral angle between the pixel, vector of the \n"
               "evidence image and reference image. It is worked out in either \n"
               "degrees or radians. It is performed on a pixel-by-pixel base. \n"
               "A SAM equal to zero denotes the absence of spectral distortion."
               ))
        self.table_widget.setItem(2, 0, QTableWidgetItem(self.tr("ERGAS")))
        self.table_widget.setItem(
            2, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(2, 0).setToolTip(
            self.
            tr("It is used to compute the quality of reference image in terms \n"
               "of normalized average error of each band of the reference image. \n"
               "Increase in the value of ERGAS indicates distortion in the \n"
               "reference image, lower value of ERGAS indicates that it is \n"
               "similar to the reference image."))
        self.table_widget.setItem(3, 0, QTableWidgetItem(self.tr("MB")))
        self.table_widget.setItem(
            3, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(3, 0).setToolTip(
            self.
            tr("Mean Bias is the difference between the mean of the evidence \n"
               "image and reference image. The ideal value is zero and indicates \n"
               "that the evidence and reference images are similar. Mean value \n"
               "refers to the grey level of pixels in an image."))
        self.table_widget.setItem(4, 0, QTableWidgetItem(self.tr("PFE")))
        self.table_widget.setItem(
            4, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(4, 0).setToolTip(
            self.
            tr("It computes the norm of the difference between the corresponding \n"
               "pixels of the reference and fused image to the norm of the reference \n"
               "image. When the calculated value is zero, it indicates that both the \n"
               "reference and fused images are similar and value will be increased \n"
               "when the merged image is not similar to the reference image."))
        self.table_widget.setItem(5, 0, QTableWidgetItem(self.tr("PSNR")))
        self.table_widget.setItem(
            5, 2,
            QTableWidgetItem(QIcon("icons/high.svg"), "(+" + "\u221e" + ")"))
        self.table_widget.item(5, 0).setToolTip(
            self.
            tr("It is widely used metric it is computed by the number of gray levels \n"
               "in the image divided by the corresponding pixels in the evidence and \n"
               "the reference images. When the value is high, both images are similar."
               ))
        # self.table_widget.setItem(6, 0, QTableWidgetItem(self.tr('PSNR-B')))
        # self.table_widget.setItem(6, 2, QTableWidgetItem(QIcon('icons/high.svg'), '(+' + u'\u221e' + ')'))
        # self.table_widget.item(6, 0).setToolTip(self.tr('PSNR with Blocking Effect Factor.'))
        self.table_widget.setItem(6, 0, QTableWidgetItem(self.tr("SSIM")))
        self.table_widget.setItem(
            6, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(6, 0).setToolTip(
            self.
            tr("SSIM is used to compare the local patterns of pixel intensities between \n"
               " the reference and fused images. The range varies between -1 to 1. \n"
               "The value 1 indicates the reference and fused images are similar."
               ))
        self.table_widget.setItem(7, 0, QTableWidgetItem(self.tr("MS-SSIM")))
        self.table_widget.setItem(
            7, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(7, 0).setToolTip(
            self.tr("Multiscale version of SSIM."))
        self.table_widget.setItem(8, 0, QTableWidgetItem(self.tr("RASE")))
        self.table_widget.setItem(
            8, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(8, 0).setToolTip(
            self.tr("Relative average spectral error"))
        self.table_widget.setItem(9, 0, QTableWidgetItem(self.tr("SCC")))
        self.table_widget.setItem(
            9, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(9, 0).setToolTip(
            self.tr("Spatial Correlation Coefficient"))
        self.table_widget.setItem(10, 0, QTableWidgetItem(self.tr("UQI")))
        self.table_widget.setItem(
            10, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(10, 0).setToolTip(
            self.tr("Universal Image Quality Index"))
        self.table_widget.setItem(11, 0, QTableWidgetItem(self.tr("VIF-P")))
        self.table_widget.setItem(
            11, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(11, 0).setToolTip(
            self.tr("Pixel-based Visual Information Fidelity"))
        self.table_widget.setItem(12, 0,
                                  QTableWidgetItem(self.tr("SSIMulacra")))
        self.table_widget.setItem(
            12, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(12, 0).setToolTip(
            self.tr("Structural SIMilarity Unveiling Local "
                    "And Compression Related Artifacts"))
        self.table_widget.setItem(13, 0,
                                  QTableWidgetItem(self.tr("Butteraugli")))
        self.table_widget.setItem(
            13, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(13, 0).setToolTip(
            self.tr("Estimate psychovisual error"))
        self.table_widget.setItem(14, 0,
                                  QTableWidgetItem(self.tr("Correlation")))
        self.table_widget.setItem(
            14, 2, QTableWidgetItem(QIcon("icons/high.svg"), "(1)"))
        self.table_widget.item(14,
                               0).setToolTip(self.tr("Histogram correlation"))
        self.table_widget.setItem(15, 0,
                                  QTableWidgetItem(self.tr("Chi-Square")))
        self.table_widget.setItem(
            15, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(15,
                               0).setToolTip(self.tr("Histogram Chi-Square"))
        self.table_widget.setItem(16, 0,
                                  QTableWidgetItem(self.tr("Chi-Square 2")))
        self.table_widget.setItem(
            16, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(16,
                               0).setToolTip(self.tr("Alternative Chi-Square"))
        self.table_widget.setItem(17, 0,
                                  QTableWidgetItem(self.tr("Intersection")))
        self.table_widget.setItem(
            17, 2,
            QTableWidgetItem(QIcon("icons/high.svg"), "(+" + "\u221e" + ")"))
        self.table_widget.item(17,
                               0).setToolTip(self.tr("Histogram intersection"))
        self.table_widget.setItem(18, 0,
                                  QTableWidgetItem(self.tr("Hellinger")))
        self.table_widget.setItem(
            18, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(18, 0).setToolTip(
            self.tr("Histogram Hellinger distance"))
        self.table_widget.setItem(19, 0,
                                  QTableWidgetItem(self.tr("Divergence")))
        self.table_widget.setItem(
            19, 2, QTableWidgetItem(QIcon("icons/low.svg"), "(0)"))
        self.table_widget.item(19, 0).setToolTip(
            self.tr("Kullback-Leibler divergence"))

        for i in range(self.table_widget.rowCount()):
            modify_font(self.table_widget.item(i, 0), bold=True)
        self.table_widget.setSelectionMode(QAbstractItemView.SingleSelection)
        self.table_widget.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.table_widget.resizeColumnsToContents()
        self.table_widget.setMaximumWidth(250)
        self.table_widget.setAlternatingRowColors(True)
        self.stopped = False

        self.comp_label.setEnabled(False)
        self.normal_radio.setEnabled(False)
        self.difference_radio.setEnabled(False)
        self.ssim_radio.setEnabled(False)
        self.butter_radio.setEnabled(False)
        self.gray_check.setEnabled(False)
        self.equalize_check.setEnabled(False)
        self.metric_button.setEnabled(False)
        self.table_widget.setEnabled(False)

        load_button.clicked.connect(self.load)
        self.normal_radio.clicked.connect(self.change)
        self.difference_radio.clicked.connect(self.change)
        self.butter_radio.clicked.connect(self.change)
        self.gray_check.stateChanged.connect(self.change)
        self.equalize_check.stateChanged.connect(self.change)
        self.ssim_radio.clicked.connect(self.change)
        self.evidence_viewer.viewChanged.connect(
            self.reference_viewer.changeView)
        self.reference_viewer.viewChanged.connect(
            self.evidence_viewer.changeView)
        self.metric_button.clicked.connect(self.metrics)

        top_layout = QHBoxLayout()
        top_layout.addWidget(load_button)
        top_layout.addStretch()
        top_layout.addWidget(self.comp_label)
        top_layout.addWidget(self.normal_radio)
        top_layout.addWidget(self.difference_radio)
        top_layout.addWidget(self.ssim_radio)
        top_layout.addWidget(self.butter_radio)
        top_layout.addWidget(self.gray_check)
        top_layout.addWidget(self.equalize_check)

        metric_layout = QVBoxLayout()
        index_label = QLabel(self.tr("Image Quality Assessment"))
        index_label.setAlignment(Qt.AlignCenter)
        modify_font(index_label, bold=True)
        metric_layout.addWidget(index_label)
        metric_layout.addWidget(self.table_widget)
        metric_layout.addWidget(self.metric_button)

        center_layout = QHBoxLayout()
        center_layout.addWidget(self.evidence_viewer)
        center_layout.addWidget(self.reference_viewer)
        center_layout.addLayout(metric_layout)

        main_layout = QVBoxLayout()
        main_layout.addLayout(top_layout)
        main_layout.addLayout(center_layout)
        self.setLayout(main_layout)
示例#16
0
def build_gui_connect_attributes():
    window_name = "build_gui_connect_attributes"
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name)

    # Main GUI Start Here =================================================================================
    title_bgc_color = (.4, .4, .4)
    build_gui_connect_attributes = cmds.window(window_name, title=script_name + "  (v" + script_version + ')',\
                          titleBar=True, mnb=False, mxb=False, sizeable =True)

    cmds.window(window_name, e=True, s=True, wh=[1, 1])

    content_main = cmds.columnLayout()

    # Title Text

    cmds.separator(h=10, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 10)],
                         p=content_main)  # Window Size Adjustment
    cmds.rowColumnLayout(nc=3,
                         cw=[(1, 10), (2, 200), (3, 50)],
                         cs=[(1, 10), (2, 0), (3, 0)],
                         p=content_main)  # Title Column
    cmds.text(" ", bgc=title_bgc_color)  # Tiny Empty Green Space
    cmds.text(script_name,
              bgc=title_bgc_color,
              fn="boldLabelFont",
              align="left")
    cmds.button(l="Help",
                bgc=title_bgc_color,
                c=lambda x: build_gui_help_connect_attributes())
    cmds.separator(h=10, style='none', p=content_main)  # Empty Space

    # Body ====================
    body_column = cmds.rowColumnLayout(nc=1,
                                       cw=[(1, 260)],
                                       cs=[(1, 10)],
                                       p=content_main)
    #cmds.separator(h=5)

    # Checkbox - Selection as Source and Target
    interactive_container_misc = cmds.rowColumnLayout(p=body_column,
                                                      nc=1,
                                                      cs=[(1, 12)],
                                                      h=25)
    single_source_target = cmds.checkBox(p=interactive_container_misc, label='  Use Selection for Source and Target (s)', value=settings.get("def_single_source_target"),\
                         cc=lambda x:is_using_single_target(cmds.checkBox(single_source_target, query=True, value=True)) )

    # CheckboxGrp Reverse and Disconnect
    interactive_container_jnt = cmds.rowColumnLayout(p=body_column,
                                                     nc=1,
                                                     cs=[(1, 11)],
                                                     h=25)
    rev_disc_check_box_grp = cmds.checkBoxGrp(p=interactive_container_jnt, columnWidth2=[137, 0], numberOfCheckBoxes=2, \
                                label1 = '  Add Reverse Node', label2 = " Disconnect", v1 = settings.get("def_reverse_node"), v2 = settings.get("def_disconnect"), \
                                cc1=lambda x:update_stored_values(), cc2= lambda x:is_disconnecting(cmds.checkBoxGrp(rev_disc_check_box_grp,q=True,v2=True)))

    # Checkbox - Override Existing (Force Connection)
    override_existing_container = cmds.rowColumnLayout(p=body_column,
                                                       nc=1,
                                                       cs=[(1, 12)],
                                                       h=25)
    forcing_connection_checkbox = cmds.checkBox(p=override_existing_container, label='  Force Connection  (Overrides Existing)', value=settings.get("def_force_connection"),\
                         cc=lambda x:update_stored_values())

    cmds.separator(h=15, p=body_column)

    # Checkbox Use Custom Node Between Connection
    interactive_container_misc = cmds.rowColumnLayout(p=body_column,
                                                      nc=1,
                                                      cs=[(1, 12)],
                                                      h=25)
    add_custom_node = cmds.checkBox(p=interactive_container_misc, label='  Add Custom Node Between Connection', value=settings.get("def_use_custom_node"),\
                          cc=lambda x:is_using_custom_node(cmds.checkBox(add_custom_node, query=True, value=True)) ) # UPDATE THIS

    # Dropdown Menu (Custom Node)
    custom_node_menu_container = cmds.rowColumnLayout(p=body_column,
                                                      nc=1,
                                                      cw=[(1, 247)],
                                                      cs=[(1, 3)],
                                                      h=25)
    custom_node_menu = cmds.optionMenu(
        en=False,
        p=custom_node_menu_container,
        label='   Custom Node : ',
        cc=lambda x: update_stored_values())  #######
    cmds.menuItem(label='plusMinusAverage')
    cmds.menuItem(label='multiplyDivide')
    cmds.menuItem(label='condition')

    #custom_node_empty_space = cmds.rowColumnLayout(p=body_column, numberOfRows=1, h= 7) #??????????
    cmds.separator(h=5, style='none', p=body_column)  # Empty Space

    # Checkbox and Dropdown Menu for Input node and its type
    node_behaviour_container_one = cmds.rowColumnLayout(p=body_column,
                                                        numberOfRows=1,
                                                        h=25)
    cmds.text("    ")
    add_ctrl_node = cmds.checkBox(p=node_behaviour_container_one, en=False, label='  Add Input Node  ', value=settings.get("def_use_custom_node"),\
                          cc=lambda x:update_stored_values())

    ctrl_node_output = cmds.optionMenu(
        en=False,
        p=node_behaviour_container_one,
        label='',
        w=120,
        cc=lambda x: update_stored_values())  #######
    cmds.menuItem(label='condition')
    cmds.menuItem(label='plusMinusAverage')
    cmds.menuItem(label='multiplyDivide')
    cmds.text("   ", p=custom_node_menu_container)

    cmds.separator(h=10, p=body_column)
    cmds.separator(h=3, style='none', p=body_column)  # Empty Space

    # Source List Loader (Buttons)
    source_container = cmds.rowColumnLayout(p=body_column, numberOfRows=1)
    source_btn = cmds.button(p=source_container,
                             l="Load Source Object",
                             c=lambda x: update_load_btn_jnt("source"),
                             w=130)
    source_status = cmds.button(p=source_container, l ="Not loaded yet", bgc=(.2, .2, .2), w=130, \
                            c="cmds.headsUpMessage( 'Select your source element and click on \"Load Source Object\"', verticalOffset=150 , time=5.0)")

    # Target List Loader (Buttons)
    target_container = cmds.rowColumnLayout(p=body_column, numberOfRows=1)
    target_btn = cmds.button(p=target_container,
                             l="Load Target Objects",
                             c=lambda x: update_load_btn_jnt("target"),
                             w=130)
    target_status = cmds.button(p=target_container, l ="Not loaded yet", bgc=(.2, .2, .2), w=130, \
                            c="cmds.headsUpMessage( 'Select your target elements and click on \"Load Target Objects\"', verticalOffset=150 , time=5.0)")
    cmds.separator(h=3, style='none', p=body_column)  # Empty Space
    cmds.separator(h=10, p=body_column)

    # Source/Target Attributes
    bottom_container = cmds.rowColumnLayout(p=body_column, adj=True)
    cmds.text('Source Attribute (Only One):', p=bottom_container)
    source_attributes_input = cmds.textField(p = bottom_container, text="translate", \
                                    enterCommand=lambda x:connect_attributes(cmds.textField(source_attributes_input, q=True, text=True),\
                                                                            cmds.textField(target_attributes_input, q=True, text=True)))
    cmds.text('Target Attributes:', p=bottom_container)
    target_attributes_input = cmds.textField(p = bottom_container, text="translate, rotate, scale", \
                                    enterCommand=lambda x:connect_attributes(cmds.textField(source_attributes_input, q=True, text=True),\
                                                                            cmds.textField(target_attributes_input, q=True, text=True)))

    cmds.separator(h=3, style='none', p=body_column)  # Empty Space
    cmds.separator(h=10, p=body_column)

    # Print Attributes Buttons
    cmds.rowColumnLayout(p=body_column, adj=True, h=5)
    show_attributes_container = cmds.rowColumnLayout(p=body_column,
                                                     numberOfRows=1,
                                                     h=25)
    cmds.button(p=show_attributes_container, l ="List All Attributes", w=130,\
                                    c=lambda x:print_selection_attributes("all"))
    cmds.button(p=show_attributes_container, l ="List Keyable Attributes", w=130,\
                                    c=lambda x:print_selection_attributes("keyable"))

    cmds.separator(h=10, style='none', p=body_column)  # Empty Space

    # Connect Button (Main Function)
    cmds.button(p=body_column, l ="Connect Attributes", bgc=(.6, .6, .6), \
                                    c=lambda x:connect_attributes(cmds.textField(source_attributes_input, q=True, text=True),\
                                                                            cmds.textField(target_attributes_input, q=True, text=True)))
    cmds.separator(h=10, style='none', p=body_column)  # Empty Space

    # Prints selection attributes
    def print_selection_attributes(type):
        selection = cmds.ls(selection=True)
        header = ""
        if type == "keyable" and len(selection) > 0:
            attrList = cmds.listAttr(selection[0], k=True) or []
            header = '"' + selection[0] + '" keyable attributes: '
        elif len(selection) > 0:
            attrList = cmds.listAttr(selection[0]) or []
            header = '"' + selection[0] + '" attributes: '

        if len(selection) > 0 and attrList != []:
            export_to_txt(header, attrList)
        else:
            cmds.warning("Nothing selected (or no attributes to be displayed)")

    # Updates elements to reflect the use of selection (instead of loaders)
    def is_using_single_target(state):
        if state:
            settings["status_single_source_target"] = cmds.checkBox(
                single_source_target, q=True, value=True)
            cmds.button(source_btn, e=True, en=False)
            cmds.button(source_status,
                        l="Not necessary",
                        e=True,
                        en=False,
                        bgc=(.25, .25, .25))
            cmds.button(target_btn, e=True, en=False)
            cmds.button(target_status,
                        l="Not necessary",
                        e=True,
                        en=False,
                        bgc=(.25, .25, .25))
            settings["target_list"] = []
            settings["source_obj"] = []
        else:
            settings["status_single_source_target"] = cmds.checkBox(
                single_source_target, q=True, value=True)
            cmds.button(source_btn, e=True, en=True)
            cmds.button(source_status, l ="Not loaded yet", e=True, en=True, bgc=(.2, .2, .2),\
                        c="cmds.headsUpMessage( 'Select your source element and click on \"Load Source Object\"', verticalOffset=150 , time=5.0)")
            cmds.button(target_btn, e=True, en=True)
            cmds.button(target_status, l ="Not loaded yet", e=True, en=True, bgc=(.2, .2, .2), \
                        c="cmds.headsUpMessage( 'Select your target elements and click on \"Load Target Objects\"', verticalOffset=150 , time=5.0)")

    # Updates elements to reflect the use of in between custom node
    def is_using_custom_node(state):
        if state:
            cmds.optionMenu(custom_node_menu, e=True, en=True)
            settings["status_use_custom_node"] = cmds.checkBox(add_custom_node,
                                                               q=True,
                                                               value=True)
            cmds.checkBox(add_ctrl_node, e=True, en=True)
            cmds.optionMenu(ctrl_node_output, e=True, en=True)
        else:
            cmds.optionMenu(custom_node_menu, e=True, en=False)
            settings["status_use_custom_node"] = cmds.checkBox(add_custom_node,
                                                               q=True,
                                                               value=True)
            cmds.checkBox(add_ctrl_node, e=True, en=False)
            cmds.optionMenu(ctrl_node_output, e=True, en=False)

    # Updates many of the stored GUI values (Used by multiple elements)
    def update_stored_values():
        settings["custom_node"] = cmds.optionMenu(custom_node_menu,
                                                  q=True,
                                                  value=True)
        settings["status_use_reverse_node"] = cmds.checkBoxGrp(
            rev_disc_check_box_grp, q=True, value1=True)
        settings["status_disconnect"] = cmds.checkBoxGrp(
            rev_disc_check_box_grp, q=True, value2=True)
        settings["input_node_type"] = cmds.optionMenu(ctrl_node_output,
                                                      q=True,
                                                      value=True)
        settings["status_add_input"] = cmds.checkBox(add_ctrl_node,
                                                     q=True,
                                                     value=True)
        settings["status_force_connection"] = cmds.checkBox(
            forcing_connection_checkbox, q=True, value=True)
        #print(settings.get("status_force_connections")) # Debugging

    # Updates elements to reflect the use disconnect function
    def is_disconnecting(state):

        if state:
            cmds.checkBox(add_custom_node, e=True, en=False)
            is_using_custom_node(False)
            cmds.checkBoxGrp(rev_disc_check_box_grp, e=True, en1=False)
            update_stored_values()

        else:
            cmds.checkBox(add_custom_node, e=True, en=True)
            is_using_custom_node(
                cmds.checkBox(add_custom_node, q=True, value=True))
            cmds.checkBoxGrp(rev_disc_check_box_grp, e=True, en1=True)
            update_stored_values()

    # Objects Loader
    def update_load_btn_jnt(button_name):

        # Check If Selection is Valid
        received_valid_source_selection = False
        received_valid_target_selection = False
        selected_elements = cmds.ls(selection=True)

        if button_name == "source":
            if len(selected_elements) == 0:
                cmds.warning(
                    "Please make sure you select at least one object before loading"
                )
            elif len(selected_elements) == 1:
                received_valid_source_selection = True
            elif len(selected_elements) > 1:
                cmds.warning("You can only have one source object")
            else:
                cmds.warning(
                    "Something went wrong, make sure you selected all necessary elements"
                )

        if button_name == "target":
            if len(selected_elements) == 0:
                cmds.warning(
                    "Please make sure you select at least one object before loading"
                )
            elif len(selected_elements) > 0:
                received_valid_target_selection = True
            else:
                cmds.warning(
                    "Something went wrong, make sure you selected all necessary elements"
                )

        # If Source
        if button_name is "source" and received_valid_source_selection == True:
            settings["source_obj"] = selected_elements[0]
            cmds.button(
                source_status,
                l=selected_elements[0],
                e=True,
                bgc=(.6, .8, .6),
                w=130,
                c=lambda x: if_exists_select(settings.get("source_obj")))
        elif button_name is "source":
            cmds.button(source_status, l ="Failed to Load",e=True, bgc=(1, .4, .4), w=130,\
                        c="cmds.headsUpMessage( 'Make sure you select only one source element', verticalOffset=150 , time=5.0)")

        # If Target
        if button_name is "target" and received_valid_target_selection == True:
            settings["target_list"] = selected_elements

            loaded_text = str(len(selected_elements)) + " objects loaded"
            if len(selected_elements) == 1:
                loaded_text = selected_elements[0]

            cmds.button(
                target_status,
                l=loaded_text,
                e=True,
                bgc=(.6, .8, .6),
                w=130,
                c=lambda x: target_listManager(settings.get("target_list")))
        elif button_name is "target":
            cmds.button(target_status, l ="Failed to Load",e=True, bgc=(1, .4, .4), w=130,\
                        c="cmds.headsUpMessage( 'Make sure you select at least one target element', verticalOffset=150 , time=5.0)")

    # Show and Lock Window
    cmds.showWindow(build_gui_connect_attributes)
    cmds.window(window_name, e=True, s=False)

    # Set Window Icon
    qw = omui.MQtUtil.findWindow(window_name)
    widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/hsRearrange.png')
    widget.setWindowIcon(icon)
 def setIcon(self):
     """ 
     Setting icon to the main window.
     """
     appIcon = QIcon("icon.png")
     self.setWindowIcon(appIcon)
示例#18
0
    def setLayers(self, mImg, delete=False):
        """
        Displays the layer stack of a mImage instance.
        @param mImg: image
        @type mImg: mImage
        """
        # close open adjustment windows
        #self.closeAdjustForms()
        self.clear(delete=delete)
        mImg.layerView = self
        # back link to image
        self.img = weakProxy(mImg)
        model = layerModel()
        model.setColumnCount(3)
        l = len(mImg.layersStack)

        # dataChanged event handler : enables edition of layer name
        def f(index1, index2):
            # index1 and index2 should be equal
            # only layer name should be editable
            # dropEvent emit dataChanged when setting item values. f must
            # return immediately from these calls, as they are possibly made with unconsistent data :
            # dragged rows are already removed from layersStack
            # and not yet removed from model.
            if l != self.model().rowCount():
                return
            # only name is editable
            if index1.column() != 1:
                return
            row = index1.row()
            stackIndex = l - row - 1
            mImg.layersStack[stackIndex].name = index1.data()

        model.dataChanged.connect(f)
        for r, lay in enumerate(reversed(mImg.layersStack)):
            try:
                lay.maskSettingsChanged.sig.disconnect()
            except RuntimeError:
                pass
            lay.maskSettingsChanged.sig.connect(self.updateRows)
            items = []
            # col 0 : visibility icon
            if lay.visible:
                item_visible = QStandardItem(
                    QIcon(":/images/resources/eye-icon.png"), "")
            else:
                item_visible = QStandardItem(
                    QIcon(":/images/resources/eye-icon-strike.png"), "")
            items.append(item_visible)
            # col 1 : image icon (for non-adjustment layeronly) and name
            if len(lay.name) <= 30:
                name = lay.name
            else:
                name = lay.name[:28] + '...'
            if hasattr(lay, 'inputImg'):
                item_name = QStandardItem(name)
            else:
                # icon with very small dim causes QPainter error
                # QPixmap.fromImage bug ?
                smallImg = lay.resize(50 * 50)
                w, h = smallImg.width(), smallImg.height()
                if w < h / 5 or h < w / 5:
                    item_name = QStandardItem(name)
                else:
                    item_name = QStandardItem(
                        QIcon(QPixmap.fromImage(smallImg)), name)
            # set tool tip to full name
            item_name.setToolTip(lay.name)
            items.append(item_name)
            item_mask = QStandardItem('m')
            items.append(item_mask)
            model.appendRow(items)
        self.setModel(model)
        self.horizontalHeader().hide()
        self.verticalHeader().hide()
        header = self.horizontalHeader()
        header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
        # select active layer
        self.selectRow(len(mImg.layersStack) - 1 - mImg.activeLayerIndex)
        layerview = mImg.getActiveLayer().view  # TODO added 25/11/18
        if layerview is not None:
            layerview.show()
            if TABBING:
                layerview.raise_()
        self.updateForm()
        for item in self.img.layersStack:
            if hasattr(item, 'sourceIndex'):
                combo = item.getGraphicsForm().sourceCombo
                currentText = combo.currentText()
                combo.clear()
                for i, x in enumerate(self.img.layersStack):
                    item.view.widget().sourceCombo.addItem(x.name, i)
                combo.setCurrentIndex(combo.findText(currentText))
示例#19
0
                    fp.write(str(index))
                    index += 1
                    fp.write('\t')
                    fp.write(qa)
                    fp.write('\t')
                    fp.write(an)
                    fp.write('\n')
                fp.close()
            except Exception as e:
                self.print("获取数据出现错误,错误信息:" + str(e))


        self.print("文件获取完毕,写入文件成功。\n")


    def clear(self):
        self.ui.Output.clear()

    def print(self, line):
        self.ui.Output.appendPlainText(line)
        # 刷新窗口
        QApplication.processEvents()

if __name__ == '__main__':
    PAGES = 0
    app = QApplication([])
    app.setWindowIcon(QIcon('jbr.png'))
    getdata = Getdata()
    getdata.ui.show()
    app.exec_()
示例#20
0
 def setColor(self, value):
     self.__color = value
     self.px.fill(self.__color)
     self.px.setMask(self.px_mask)
     self.setIcon(QIcon(self.px))
示例#21
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(700, 495)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.main_frame = QFrame(self.centralwidget)
        self.main_frame.setObjectName(u"main_frame")
        self.main_frame.setFrameShape(QFrame.StyledPanel)
        self.main_frame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_2 = QVBoxLayout(self.main_frame)
        self.verticalLayout_2.setSpacing(0)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)

        # "панель инструментов"
        self.top_frame = QFrame(self.main_frame)
        self.top_frame.setObjectName(u"top_frame")
        self.top_frame.setMinimumSize(QSize(0, 60))
        self.top_frame.setMaximumSize(QSize(16777215, 60))
        self.top_frame.setFrameShape(QFrame.StyledPanel)
        self.top_frame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout = QHBoxLayout(self.top_frame)
        self.horizontalLayout.setSpacing(5)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(5, 5, 5, 5)

        # кнопка "новый расчёт"
        self.new_calc_btn = QPushButton(self.top_frame)
        self.new_calc_btn.setObjectName(u"new_calc_btn")
        self.new_calc_btn.setMinimumSize(QSize(110, 50))
        self.new_calc_btn.setMaximumSize(QSize(110, 50))
        icon = QIcon()
        icon.addFile(NEW_CALC_ICON, QSize(), QIcon.Normal, QIcon.Off)
        self.new_calc_btn.setIcon(icon)
        self.new_calc_btn.setIconSize(QSize(45, 45))

        self.horizontalLayout.addWidget(self.new_calc_btn)

        # кнопка "выбор режима расчёта"
        self.select_mode_btn = QPushButton(self.top_frame)
        self.select_mode_btn.setObjectName(u"select_mode_btn")
        self.select_mode_btn.setMinimumSize(QSize(110, 50))
        self.select_mode_btn.setMaximumSize(QSize(110, 50))
        icon1 = QIcon()
        icon1.addFile(SET_MODE_ICON, QSize(), QIcon.Normal, QIcon.Off)
        self.select_mode_btn.setIcon(icon1)
        self.select_mode_btn.setIconSize(QSize(45, 45))

        self.horizontalLayout.addWidget(self.select_mode_btn)

        # кнопка "запуск расчёта"
        self.start_calc_btn = QPushButton(self.top_frame)
        self.start_calc_btn.setObjectName(u"start_calc_btn")
        self.start_calc_btn.setMinimumSize(QSize(110, 50))
        self.start_calc_btn.setMaximumSize(QSize(110, 50))
        icon2 = QIcon()
        icon2.addFile(START_CALC_ICON, QSize(), QIcon.Normal, QIcon.Off)
        self.start_calc_btn.setIcon(icon2)
        self.start_calc_btn.setIconSize(QSize(45, 45))

        self.horizontalLayout.addWidget(self.start_calc_btn)

        self.horizontalSpacer = QSpacerItem(338, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)

        self.horizontalLayout.addItem(self.horizontalSpacer)

        self.verticalLayout_2.addWidget(self.top_frame)

        self.bottom_frame = QFrame(self.main_frame)
        self.bottom_frame.setObjectName(u"bottom_frame")
        self.bottom_frame.setFrameShape(QFrame.StyledPanel)
        self.bottom_frame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_2 = QHBoxLayout(self.bottom_frame)
        self.horizontalLayout_2.setSpacing(5)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.horizontalLayout_2.setContentsMargins(5, 5, 5, 5)
        self.input_frame = QFrame(self.bottom_frame)
        self.input_frame.setObjectName(u"input_frame")
        self.input_frame.setMinimumSize(QSize(340, 0))
        self.input_frame.setMaximumSize(QSize(340, 16777215))
        self.input_frame.setFrameShape(QFrame.StyledPanel)
        self.input_frame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_3 = QVBoxLayout(self.input_frame)
        self.verticalLayout_3.setSpacing(5)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)

        # поле ввода длины заготовки
        self.length_layout = QHBoxLayout()
        self.length_layout.setSpacing(5)
        self.length_layout.setObjectName(u"length_layout")
        self.length_label = QLabel(self.input_frame)
        self.length_label.setObjectName(u"length_label")
        self.length_label.setMinimumSize(QSize(165, 25))
        self.length_label.setMaximumSize(QSize(165, 25))
        self.length_layout.addWidget(self.length_label)
        self.length_entry = QLineEdit(self.input_frame)
        self.length_entry.setObjectName(u"length_entry")
        self.length_entry.setMinimumSize(QSize(165, 25))
        self.length_entry.setMaximumSize(QSize(165, 25))
        self.length_layout.addWidget(self.length_entry)
        self.verticalLayout_3.addLayout(self.length_layout)

        # поле ввода длины безусловного отхода
        self.waste_layout = QHBoxLayout()
        self.waste_layout.setSpacing(5)
        self.waste_layout.setObjectName(u"waste_layout")
        self.waste_label = QLabel(self.input_frame)
        self.waste_label.setObjectName(u"waste_label")
        self.waste_label.setMinimumSize(QSize(165, 25))
        self.waste_label.setMaximumSize(QSize(165, 25))
        self.waste_layout.addWidget(self.waste_label)
        self.waste_entry = QLineEdit(self.input_frame)
        self.waste_entry.setObjectName(u"waste_entry")
        self.waste_entry.setMinimumSize(QSize(165, 25))
        self.waste_entry.setMaximumSize(QSize(165, 25))
        self.waste_layout.addWidget(self.waste_entry)
        self.verticalLayout_3.addLayout(self.waste_layout)

        # поле ввода ширины реза
        self.cut_layout = QHBoxLayout()
        self.cut_layout.setSpacing(5)
        self.cut_layout.setObjectName(u"cut_layout")
        self.cut_label = QLabel(self.input_frame)
        self.cut_label.setObjectName(u"cut_label")
        self.cut_label.setMinimumSize(QSize(165, 25))
        self.cut_label.setMaximumSize(QSize(165, 25))
        self.cut_layout.addWidget(self.cut_label)
        self.cut_entry = QLineEdit(self.input_frame)
        self.cut_entry.setObjectName(u"cut_entry")
        self.cut_entry.setMinimumSize(QSize(165, 25))
        self.cut_entry.setMaximumSize(QSize(165, 25))
        self.cut_layout.addWidget(self.cut_entry)
        self.verticalLayout_3.addLayout(self.cut_layout)

        # поле ввода длины подрезки торца заготовки
        self.trim_layout = QHBoxLayout()
        self.trim_layout.setSpacing(5)
        self.trim_layout.setObjectName(u"trim_layout")
        self.trim_label = QLabel(self.input_frame)
        self.trim_label.setObjectName(u"trim_label")
        self.trim_label.setMinimumSize(QSize(165, 25))
        self.trim_label.setMaximumSize(QSize(165, 25))
        self.trim_layout.addWidget(self.trim_label)
        self.trim_entry = QLineEdit(self.input_frame)
        self.trim_entry.setObjectName(u"trim_entry")
        self.trim_entry.setMinimumSize(QSize(165, 25))
        self.trim_entry.setMaximumSize(QSize(165, 25))
        self.trim_layout.addWidget(self.trim_entry)
        self.verticalLayout_3.addLayout(self.trim_layout)

        # таблица ввода длин и количеств элементов
        self.input_table = QTableWidget(self.input_frame)
        if (self.input_table.columnCount() < 2):
            self.input_table.setColumnCount(2)
        if (self.input_table.rowCount() < 7):
            self.input_table.setRowCount(7)
        self.input_table.setObjectName(u"input_table")
        self.input_table.setRowCount(7)
        self.input_table.setColumnCount(2)
        self.input_table.horizontalHeader().setMinimumSectionSize(33)
        self.input_table.horizontalHeader().setDefaultSectionSize(130)
        self.input_table.horizontalHeader().setProperty(
            "showSortIndicator",
            True,
        )
        self.input_table.horizontalHeader().setStretchLastSection(True)
        self.input_table.verticalHeader().setMinimumSectionSize(30)
        self.input_table.verticalHeader().setDefaultSectionSize(30)
        self.verticalLayout_3.addWidget(self.input_table)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")

        # кнопка "добавить строку в конец таблицы"
        self.add_str_button = QPushButton(self.input_frame)
        self.add_str_button.setObjectName(u"add_str_button")
        self.add_str_button.setMinimumSize(QSize(150, 35))
        self.add_str_button.setMaximumSize(QSize(150, 35))
        icon3 = QIcon()
        icon3.addFile(
            ADD_STR_ICON,
            QSize(),
            QIcon.Normal,
            QIcon.Off,
        )
        self.add_str_button.setIcon(icon3)
        self.add_str_button.setIconSize(QSize(25, 25))
        self.horizontalLayout_3.addWidget(self.add_str_button)

        # кнопка "удалить последнюю строку в таблице"
        self.remove_str_button = QPushButton(self.input_frame)
        self.remove_str_button.setObjectName(u"remove_str_button")
        self.remove_str_button.setMinimumSize(QSize(150, 35))
        self.remove_str_button.setMaximumSize(QSize(150, 35))
        icon4 = QIcon()
        icon4.addFile(
            DESTR_STR_ICON,
            QSize(),
            QIcon.Normal,
            QIcon.Off,
        )
        self.remove_str_button.setIcon(icon4)
        self.remove_str_button.setIconSize(QSize(25, 25))
        self.horizontalLayout_3.addWidget(self.remove_str_button)

        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2.addWidget(self.input_frame)

        self.output_frame = QFrame(self.bottom_frame)
        self.output_frame.setObjectName(u"output_frame")
        self.output_frame.setFrameShape(QFrame.StyledPanel)
        self.output_frame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_4 = QVBoxLayout(self.output_frame)
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")

        # поле вывода результатов расчёта
        self.textBrowser = QTextBrowser(self.output_frame)
        self.textBrowser.setObjectName(u"textBrowser")
        self.verticalLayout_4.addWidget(self.textBrowser)

        self.horizontalLayout_4 = QHBoxLayout()
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")

        # строка состояния
        self.label_2 = QLabel(self.output_frame)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setMinimumSize(QSize(25, 25))
        self.label_2.setMaximumSize(QSize(16777215, 25))
        self.horizontalLayout_4.addWidget(self.label_2)
        self.horizontalSpacer_2 = QSpacerItem(
            40,
            20,
            QSizePolicy.Expanding,
            QSizePolicy.Minimum,
        )

        self.horizontalLayout_4.addItem(self.horizontalSpacer_2)

        # поле вывода версии программы
        self.label = QLabel(self.output_frame)
        self.label.setObjectName(u"label")
        self.label.setMinimumSize(QSize(0, 25))
        self.label.setMaximumSize(QSize(16777215, 25))

        self.horizontalLayout_4.addWidget(self.label)
        self.verticalLayout_4.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_2.addWidget(self.output_frame)
        self.verticalLayout_2.addWidget(self.bottom_frame)
        self.verticalLayout.addWidget(self.main_frame)

        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
示例#22
0
 def setIcon(self,MainWindow):
     appIcon = QIcon("icon.png")
     MainWindow.setWindowIcon(appIcon)
示例#23
0
 def setIcon(self):
     appIcon = QIcon("close.ico")
     self.setWindowIcon(appIcon)
示例#24
0
    from PySide2.QtGui import QIcon
    from PySide2.QtWidgets import QApplication
    from standard_interface_template.gui.feedback.export_simulation_thread import ExportSimulationThread
    from xmsguipy.dialogs.process_feedback_dlg import ProcessFeedbackDlg

    path = os.getcwd()
    worker = ExportSimulationThread(out_dir=path)
    note = ''
    display_text = {
        'title': 'Standard Interface Template Export Simulation',
        'working_prompt':
        'Exporting Standard Interface Template simulation files. Please wait...',
        'warning_prompt':
        'Warning(s) encountered while exporting simulation. Review log output for more details.',
        'error_prompt':
        'Error(s) encountered while exporting simulation. Review log output for more details.',
        'success_prompt': 'Successfully exported simulation',
        'note': note,
        'auto_load':
        'Close this dialog automatically when exporting is finished.'
    }
    app = QApplication(sys.argv)
    icon = QIcon()
    feedback_dlg = ProcessFeedbackDlg(
        icon=icon,
        display_text=display_text,
        logger_name='standard_interface_template',
        worker=worker,
        parent=None)
    feedback_dlg.exec()
示例#25
0
 def dark_mode(self):
     self.input.setMaximumWidth(250)
     self.input.setFixedSize(250, 150)
     self.gbox.setMaximumWidth(250)
     self.gbox.setFixedSize(250, 90)
     self.gbox3.setMaximumWidth(250)
     self.gbox3.setFixedSize(250, 90)
     self.gbox4.setMaximumWidth(250)
     self.gbox4.setFixedSize(250, 45)
     self.gbox_mode.setMaximumWidth(250)
     self.gbox_mode.setFixedSize(250, 50)
     self.gbox5.setMaximumWidth(270)
     self.input.setObjectName("input")
     self.input.setStyleSheet(
         "QGroupBox#input{border: 2px solid #3d3d3d;background-color:#383838;color: "
         + self.font_color_black + ";margin-top: 6px;}" +
         "QGroupBox#input::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox.setStyleSheet(
         "QGroupBox {border: 2px solid #3d3d3d;background-color:#383838;color: "
         + self.font_color_black + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox4.setStyleSheet(
         "QGroupBox {border: 2px solid #3d3d3d;background-color:#383838;color: "
         + self.font_color_black + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox_mode.setStyleSheet(
         "QGroupBox {border: 2px solid #3d3d3d;background-color:#383838;color: "
         + self.font_color_black + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.plot.setStyleSheet("color: " + self.font_color)
     self.setStyleSheet("background-color:#202020")
     self.label1.setStyleSheet(
         "background-color:#383838;border:None;color: " +
         self.font_color_black)
     self.label2.setStyleSheet(
         "background-color:#383838;border:None;color:" +
         self.font_color_black)
     self.label3.setStyleSheet(
         "background-color:#383838;border:None;color:" +
         self.font_color_black)
     self.label4.setStyleSheet(
         "background-color:#383838;border:None;color:" +
         self.font_color_black)
     self.label5.setStyleSheet(
         "background-color:#383838;border:None;color:" +
         self.font_color_black)
     self.label6.setStyleSheet(
         "background-color:#383838;border:None;color:" +
         self.font_color_black)
     self.rbutton1.setStyleSheet("background-color:#383838;color:" +
                                 self.font_color_black)
     self.rbutton2.setStyleSheet("background-color:#383838;color:" +
                                 self.font_color_black)
     self.rbutton1.setFont(
         QFont(self.font_type, self.font_size, QFont.Normal))
     self.rbutton2.setFont(
         QFont(self.font_type, self.font_size, QFont.Normal))
     self.label1.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label2.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label3.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label4.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label5.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label6.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.text1.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text2.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text3.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text4.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text5.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text6.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.text7.setStyleSheet(
         "border:1px solid #5b5b5b;background-color:#383838;color:" +
         self.font_color_black)
     self.button_save.setStyleSheet(
         " QPushButton{border: 1px solid #f0f0f0;Text-align:center;background:#333333; color:#f0f0f0}"
         "QPushButton::hover{border: 1px solid #f0f0f0;Text-align:center;background:#2c2c2c}"
         "QPushButton::Pressed{border: 1px solid #f0f0f0;Text-align:center;background:#3d3c3c}"
     )
     self.button.setStyleSheet(
         " QPushButton{border: 1px solid #f0f0f0;Text-align:center;background:#333333; color:#f0f0f0}"
         "QPushButton::hover{border: 1px solid #f0f0f0;Text-align:center;background:#2c2c2c}"
         "QPushButton::Pressed{border: 1px solid #f0f0f0;Text-align:center;background:#3d3c3c}"
     )
     self.text1.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text2.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text3.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text4.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text5.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text6.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text7.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.gbox5.setObjectName("GroupBox")
     self.gbox5.setStyleSheet(
         "QGroupBox#GroupBox{border: None;background-color:#383838}")
     f = open("plotter.txt", "w")
     f.write("dark")
     f.close()
     self.s = "dark"
     self.pw.setBackground(background=None)
     if self.after == True:
         self.plotx()
     pixmap1 = QPixmap("auto-button_dark.png")
     button_icon1 = QIcon(pixmap1)
     self.button_2.setStyleSheet("border:none;background-color:#383838")
     self.button_2.setIcon(button_icon1)
     pixmap2 = QPixmap("help_dark.png")
     button_icon2 = QIcon(pixmap2)
     self.button_help.setIcon(button_icon2)
     self.button_help.setStyleSheet("border:none;background-color:#383838")
     if self.check_text == True:
         self.gbox6.setStyleSheet(
             "QGroupBox {border: 2px solid #3d3d3d;background-color:#383838;color: "
             + self.font_color_black + ";margin-top: 6px;}" +
             "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
         )
         self.text8.setStyleSheet(
             "border:None;background-color:#383838;border:None;color: " +
             self.font_color_black)
         self.text8.setFont(
             QFont(self.font_type, self.font_size, QFont.Normal))
示例#26
0
    def setupUi(self, MainWindow):
        if MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(1135, 600)
        MainWindow.setMinimumSize(QSize(1000, 600))
        icon = QIcon()
        icon.addFile(u"beer.ico", QSize(), QIcon.Normal, QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.actionNew = QAction(MainWindow)
        self.actionNew.setObjectName(u"actionNew")
        self.actionOpen = QAction(MainWindow)
        self.actionOpen.setObjectName(u"actionOpen")
        self.actionSave = QAction(MainWindow)
        self.actionSave.setObjectName(u"actionSave")
        self.actionSaveAs = QAction(MainWindow)
        self.actionSaveAs.setObjectName(u"actionSaveAs")
        self.actionAbout = QAction(MainWindow)
        self.actionAbout.setObjectName(u"actionAbout")
        self.actionContents = QAction(MainWindow)
        self.actionContents.setObjectName(u"actionContents")
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.gridLayout = QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(u"gridLayout")
        self.group_calculations = QGroupBox(self.centralwidget)
        self.group_calculations.setObjectName(u"group_calculations")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(2)
        sizePolicy.setHeightForWidth(
            self.group_calculations.sizePolicy().hasHeightForWidth())
        self.group_calculations.setSizePolicy(sizePolicy)
        self.formLayout = QFormLayout(self.group_calculations)
        self.formLayout.setObjectName(u"formLayout")
        self.lbl_boil_size = QLabel(self.group_calculations)
        self.lbl_boil_size.setObjectName(u"lbl_boil_size")

        self.formLayout.setWidget(0, QFormLayout.LabelRole, self.lbl_boil_size)

        self.calcBoilSize = QLineEdit(self.group_calculations)
        self.calcBoilSize.setObjectName(u"calcBoilSize")
        self.calcBoilSize.setFrame(False)
        self.calcBoilSize.setReadOnly(True)

        self.formLayout.setWidget(0, QFormLayout.FieldRole, self.calcBoilSize)

        self.lbl_boil_sg = QLabel(self.group_calculations)
        self.lbl_boil_sg.setObjectName(u"lbl_boil_sg")

        self.formLayout.setWidget(1, QFormLayout.LabelRole, self.lbl_boil_sg)

        self.calcBoilSg = QLineEdit(self.group_calculations)
        self.calcBoilSg.setObjectName(u"calcBoilSg")
        self.calcBoilSg.setFrame(False)
        self.calcBoilSg.setReadOnly(True)

        self.formLayout.setWidget(1, QFormLayout.FieldRole, self.calcBoilSg)

        self.lbl_calories = QLabel(self.group_calculations)
        self.lbl_calories.setObjectName(u"lbl_calories")

        self.formLayout.setWidget(2, QFormLayout.LabelRole, self.lbl_calories)

        self.calcCalories = QLineEdit(self.group_calculations)
        self.calcCalories.setObjectName(u"calcCalories")
        self.calcCalories.setFrame(False)
        self.calcCalories.setReadOnly(True)

        self.formLayout.setWidget(2, QFormLayout.FieldRole, self.calcCalories)

        self.gridLayout.addWidget(self.group_calculations, 1, 1, 1, 1)

        self.group_ranges = QGroupBox(self.centralwidget)
        self.group_ranges.setObjectName(u"group_ranges")
        sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy1.setHorizontalStretch(2)
        sizePolicy1.setVerticalStretch(3)
        sizePolicy1.setHeightForWidth(
            self.group_ranges.sizePolicy().hasHeightForWidth())
        self.group_ranges.setSizePolicy(sizePolicy1)
        self.verticalLayout = QVBoxLayout(self.group_ranges)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.lbl_og = QLabel(self.group_ranges)
        self.lbl_og.setObjectName(u"lbl_og")

        self.verticalLayout.addWidget(self.lbl_og)

        self.og = StyleRangeWidget(self.group_ranges)
        self.og.setObjectName(u"og")
        self.og.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.og)

        self.lbl_fg = QLabel(self.group_ranges)
        self.lbl_fg.setObjectName(u"lbl_fg")

        self.verticalLayout.addWidget(self.lbl_fg)

        self.fg = StyleRangeWidget(self.group_ranges)
        self.fg.setObjectName(u"fg")
        self.fg.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.fg)

        self.lbl_abv = QLabel(self.group_ranges)
        self.lbl_abv.setObjectName(u"lbl_abv")

        self.verticalLayout.addWidget(self.lbl_abv)

        self.abv = StyleRangeWidget(self.group_ranges)
        self.abv.setObjectName(u"abv")
        self.abv.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.abv)

        self.lbl_ibu = QLabel(self.group_ranges)
        self.lbl_ibu.setObjectName(u"lbl_ibu")

        self.verticalLayout.addWidget(self.lbl_ibu)

        self.ibu = StyleRangeWidget(self.group_ranges)
        self.ibu.setObjectName(u"ibu")
        self.ibu.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.ibu)

        self.lbl_srm = QLabel(self.group_ranges)
        self.lbl_srm.setObjectName(u"lbl_srm")

        self.verticalLayout.addWidget(self.lbl_srm)

        self.srm = SrmRangeWidget(self.group_ranges)
        self.srm.setObjectName(u"srm")
        self.srm.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.srm)

        self.lbl_ibu_gu = QLabel(self.group_ranges)
        self.lbl_ibu_gu.setObjectName(u"lbl_ibu_gu")

        self.verticalLayout.addWidget(self.lbl_ibu_gu)

        self.ibu_gu = IbuGuRangeWidget(self.group_ranges)
        self.ibu_gu.setObjectName(u"ibu_gu")
        self.ibu_gu.setMinimumSize(QSize(0, 32))

        self.verticalLayout.addWidget(self.ibu_gu)

        self.gridLayout.addWidget(self.group_ranges, 0, 1, 1, 1)

        self.tabs = QTabWidget(self.centralwidget)
        self.tabs.setObjectName(u"tabs")
        sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy2.setHorizontalStretch(5)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(
            self.tabs.sizePolicy().hasHeightForWidth())
        self.tabs.setSizePolicy(sizePolicy2)
        self.tabs.setTabShape(QTabWidget.Rounded)

        self.gridLayout.addWidget(self.tabs, 0, 0, 2, 1)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 1135, 21))
        self.menuFile = QMenu(self.menubar)
        self.menuFile.setObjectName(u"menuFile")
        self.menuHelp = QMenu(self.menubar)
        self.menuHelp.setObjectName(u"menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSaveAs)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addAction(self.actionContents)

        self.retranslateUi(MainWindow)

        self.tabs.setCurrentIndex(-1)

        QMetaObject.connectSlotsByName(MainWindow)
示例#27
0
 def light_mode(self):
     self.input.setMaximumWidth(250)
     self.input.setFixedSize(250, 150)
     self.gbox.setMaximumWidth(250)
     self.gbox.setFixedSize(250, 90)
     self.gbox3.setMaximumWidth(250)
     self.gbox3.setFixedSize(250, 90)
     self.gbox4.setMaximumWidth(250)
     self.gbox4.setFixedSize(250, 45)
     self.gbox_mode.setMaximumWidth(250)
     self.gbox_mode.setFixedSize(250, 50)
     self.gbox5.setMaximumWidth(270)
     self.input.setObjectName("input")
     self.input.setStyleSheet(
         "QGroupBox#input{border: 2px solid #e6e6e6;background-color:#f5f6f7;color: "
         + self.font_color + ";margin-top: 6px;}" +
         "QGroupBox#input::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox.setStyleSheet(
         "QGroupBox {border: 2px solid #e6e6e6;background-color:#f5f6f7;color: "
         + self.font_color + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox4.setStyleSheet(
         "QGroupBox {border: 2px solid #e6e6e6;background-color:#f5f6f7;color: "
         + self.font_color + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.gbox_mode.setStyleSheet(
         "QGroupBox {border: 2px solid #e6e6e6;background-color:#f5f6f7;color: "
         + self.font_color + ";margin-top: 6px;}" +
         "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
     )
     self.plot.setStyleSheet("color: " + self.font_color)
     self.setStyleSheet("background-color:white;")
     self.label1.setStyleSheet("background-color:#f5f6f7;color: " +
                               self.font_color)
     self.label2.setStyleSheet("background-color:#f5f6f7;color:" +
                               self.font_color)
     self.label3.setStyleSheet("background-color:#f5f6f7;color:" +
                               self.font_color)
     self.label4.setStyleSheet("background-color:#f5f6f7;color:" +
                               self.font_color)
     self.label5.setStyleSheet("background-color:#f5f6f7;color:" +
                               self.font_color)
     self.label6.setStyleSheet("background-color:#f5f6f7;color:" +
                               self.font_color)
     self.rbutton1.setStyleSheet("background-color:#f5f6f7;color:" +
                                 self.font_color)
     self.rbutton2.setStyleSheet("background-color:#f5f6f7;color:" +
                                 self.font_color)
     self.rbutton1.setFont(
         QFont(self.font_type, self.font_size, QFont.Normal))
     self.rbutton2.setFont(
         QFont(self.font_type, self.font_size, QFont.Normal))
     self.label1.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label2.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label3.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label4.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label5.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.label6.setFont(QFont(self.font_type, self.font_size,
                               QFont.Normal))
     self.text1.setStyleSheet("background-color:white")
     self.text2.setStyleSheet("background-color:white")
     self.text3.setStyleSheet("background-color:white")
     self.text4.setStyleSheet("background-color:white")
     self.text5.setStyleSheet("background-color:white")
     self.text6.setStyleSheet("background-color:white")
     self.text7.setStyleSheet("background-color:white")
     self.button_save.setStyleSheet(
         " QPushButton{border: 1px solid #adadad;Text-align:center;background:#e1e1e1; color:black}"
         "QPushButton::hover{border: 1px solid #adadad;Text-align:center;background:#d8d7d7}"
         "QPushButton::Pressed{border: 1px solid #adadad;Text-align:center;background:#f5f6f7}"
     )
     self.button.setStyleSheet(
         " QPushButton{border: 1px solid #adadad;Text-align:center;background:#e1e1e1; color:black}"
         "QPushButton::hover{border: 1px solid #adadad;Text-align:center;background:#d8d7d7}"
         "QPushButton::Pressed{border: 1px solid #adadad;Text-align:center;background:#f5f6f7}"
     )
     self.text1.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text2.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text3.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text4.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text5.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text6.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.text7.setFont(QFont(self.font_type, self.font_size, QFont.Normal))
     self.gbox5.setObjectName("GroupBox")
     self.gbox5.setStyleSheet(
         "QGroupBox#GroupBox{border: None;background-color:#f5f6f7}")
     f = open("plotter.txt", "w")
     f.write("light")
     f.close()
     self.s = "light"
     self.pw.setBackground(background=None)
     if self.after == True:
         self.plotx()
     pixmap2 = QPixmap("auto-button.png")
     button_icon2 = QIcon(pixmap2)
     self.button_2.setStyleSheet("border:none;background-color:#f5f6f7")
     self.button_2.setIcon(button_icon2)
     pixmap2 = QPixmap("help_light.png")
     button_icon2 = QIcon(pixmap2)
     self.button_help.setIcon(button_icon2)
     self.button_help.setStyleSheet("border:none;background-color:#f5f6f7")
     if self.check_text == True:
         self.gbox6.setStyleSheet(
             "QGroupBox {border: 2px solid #e6e6e6;background-color:#f5f6f7;color: "
             + self.font_color + ";margin-top: 6px;}" +
             "QGroupBox::title {subcontrol-origin:margin;left:8px;padding: 0px 0px 0px 0px;}"
         )
         self.text8.setStyleSheet(
             "border:None;background-color:#f5f6f7;color: " +
             self.font_color)
         self.text8.setFont(
             QFont(self.font_type, self.font_size, QFont.Normal))
示例#28
0
def build_gui_world_space_baker():
    '''
    Creates main window for world space baker
    '''
    def update_stored_settings():
        '''
        Updates settings dictionary with intfield values
        '''
        gt_world_space_baker_settings['start_time_range'] = cmds.intField(
            auto_key_start_int_field, q=True, value=True)
        gt_world_space_baker_settings['end_time_range'] = cmds.intField(
            auto_key_end_int_field, q=True, value=True)

    def object_load_handler():
        ''' 
        Function to handle load button. 
        It updates the UI to reflect the loaded data and stores loaded objects into the settings dictionary.
        
        '''

        # Check If Selection is Valid
        received_valid_element = False

        current_selection = cmds.ls(selection=True)

        if len(current_selection) == 0:
            cmds.warning(
                "Nothing selected. Please select at least one object.")
        else:
            received_valid_element = True

        # Update GUI
        if received_valid_element:
            gt_world_space_baker_settings[
                'stored_elements'] = current_selection
            if len(current_selection) == 1:
                load_message = current_selection[0]
            else:
                load_message = str(len(current_selection)) + ' objects'
            cmds.button(selection_status_btn,
                        l=load_message,
                        e=True,
                        bgc=(.6, .8, .6))
            cmds.button(ws_anim_extract_btn, e=True, en=True)
            cmds.rowColumnLayout(range_column, e=True, en=True)

        else:
            cmds.button(selection_status_btn,
                        l="Failed to Load",
                        e=True,
                        bgc=(1, .4, .4))
            cmds.button(ws_anim_extract_btn, e=True, en=False)
            cmds.rowColumnLayout(range_column, e=True, en=False)

    def get_auto_key_current_frame(target_integer_field='start',
                                   is_instance=False):
        '''
        Gets the current frame and auto fills an integer field.

                Parameters:
                    target_integer_field (optional, string) : Gets the current timeline frame and feeds it into the start or end integer field.
                                                              Can only be "start" or "end". Anything else will be understood as "end".
                    is_instance (optional, bool): Allow a bool argument to determine if the settings are supposed to be stored or not
                                                      This is used for secondary instances (multiple windows)

        '''
        current_time = cmds.currentTime(q=True)
        if target_integer_field == 'start':
            cmds.intField(auto_key_start_int_field, e=True, value=current_time)
        else:
            cmds.intField(auto_key_end_int_field, e=True, value=current_time)

        update_stored_settings()

    def validate_operation(operation='extract'):
        ''' Checks elements one last time before running the script '''

        update_stored_settings()

        if operation == 'extract':
            result = extract_world_space_data()
            if result:
                cmds.button(ws_anim_bake_btn, e=True, en=True)

                plural = 'object'
                if len(gt_world_space_baker_settings.get(
                        'stored_elements')) != 1:
                    plural = 'objects'
                message = str(
                    len(gt_world_space_baker_settings.get('stored_elements'))
                ) + ' ' + plural + ' stored. Frames: ' + str(
                    gt_world_space_baker_settings.get('start_time_range')
                ) + '-' + str(
                    gt_world_space_baker_settings.get('end_time_range'))
                cmds.text(stored_status_text, e=True, l=message)

                cmds.rowColumnLayout(status_column, e=True, en=True)

        elif operation == 'bake':
            bake_world_space_data()

        if operation == 'refresh':
            is_data_valid = True
            try:
                for obj in gt_world_space_baker_settings.get(
                        'stored_elements'):
                    if not cmds.objExists(obj):
                        is_data_valid = False

                if gt_world_space_baker_anim_storage and is_data_valid:
                    cmds.rowColumnLayout(status_column, e=True, en=True)
                    cmds.button(ws_anim_bake_btn, e=True, en=True)

                    plural = 'object'
                    if len(gt_world_space_baker_settings.get(
                            'stored_elements')) != 1:
                        plural = 'objects'
                    message = str(
                        len(
                            gt_world_space_baker_settings.get(
                                'stored_elements'))
                    ) + ' ' + plural + ' stored. Range: ' + str(
                        gt_world_space_baker_settings.get('start_time_range')
                    ) + '-' + str(
                        gt_world_space_baker_settings.get('end_time_range'))
                    cmds.text(stored_status_text, e=True, l=message)
            except:
                pass

    window_name = "build_gui_world_space_baker"
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name)

    # Main GUI Start Here =================================================================================

    # Build UI
    build_gui_world_space_baker = cmds.window(window_name, title=script_name + '  (v' + script_version + ')',\
                          titleBar=True, mnb=False, mxb=False, sizeable =True)

    cmds.window(window_name, e=True, s=True, wh=[1, 1])

    content_main = cmds.columnLayout(adj=True)

    # Title Text
    title_bgc_color = (.4, .4, .4)
    cmds.separator(h=10, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 10)],
                         p=content_main)  # Window Size Adjustment
    cmds.rowColumnLayout(nc=3,
                         cw=[(1, 10), (2, 200), (3, 50)],
                         cs=[(1, 10), (2, 0), (3, 0)],
                         p=content_main)  # Title Column
    cmds.text(" ", bgc=title_bgc_color)  # Tiny Empty Green Space
    cmds.text(script_name,
              bgc=title_bgc_color,
              fn="boldLabelFont",
              align="left")
    cmds.button(l="Help",
                bgc=title_bgc_color,
                c=lambda x: build_gui_help_world_space_baker())
    cmds.separator(h=5, style='none')  # Empty Space

    # Body ====================

    # 1. Selection
    cmds.rowColumnLayout(nc=1, cw=[(1, 240)], cs=[(1, 20)], p=content_main)
    cmds.text('1. Taget(s):')
    cmds.separator(h=10, style='none')  # Empty Space

    cmds.rowColumnLayout(nc=2, cw=[(1, 120), (2, 120)], cs=[(1, 0)])
    selection_load_btn = cmds.button(l="Load Selection",
                                     c=lambda x: object_load_handler(),
                                     w=115)
    selection_status_btn = cmds.button(l ="Not loaded yet", bgc=(.2, .2, .2), w=115, \
                       c=lambda x:select_existing_objects(gt_world_space_baker_settings.get('stored_elements')))

    # 2. Range
    range_column = cmds.rowColumnLayout(nc=1,
                                        cw=[(1, 240)],
                                        cs=[(1, 20)],
                                        p=content_main,
                                        en=False)

    cmds.separator(h=10, style='none')  # Empty Space
    cmds.separator(h=5)
    cmds.separator(h=7, style='none')  # Empty Space
    cmds.text('2. Animation Range:')
    cmds.separator(h=10, style='none')  # Empty Space

    anim_range_column = cmds.rowColumnLayout(nc=6,
                                             cw=[(1, 40), (2, 40), (3, 30),
                                                 (4, 30), (5, 40), (6, 30)],
                                             cs=[(1, 10), (4, 10)])
    cmds.text('Start:')
    auto_key_start_int_field = cmds.intField(
        value=gt_world_space_baker_settings.get('start_time_range'),
        cc=lambda x: update_stored_settings())
    cmds.button(l="Get", c=lambda x: get_auto_key_current_frame(), h=5)  #L
    cmds.text('End:')
    auto_key_end_int_field = cmds.intField(
        value=gt_world_space_baker_settings.get('end_time_range'),
        cc=lambda x: update_stored_settings())
    cmds.button(l="Get", c=lambda x: get_auto_key_current_frame('end'),
                h=5)  #L
    cmds.separator(h=10, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 240)], cs=[(1, 20)], p=content_main)
    cmds.separator(h=7, style='none')  # Empty Space
    ws_anim_extract_btn = cmds.button(l="Extract World Space",
                                      bgc=(.3, .3, .3),
                                      c=lambda x: validate_operation(),
                                      en=False)
    cmds.separator(h=7, style='none')  # Empty Space

    # 3. Status
    status_column = cmds.rowColumnLayout(nc=1,
                                         cw=[(1, 260)],
                                         cs=[(1, 10)],
                                         p=content_main,
                                         en=False)
    cmds.separator(h=7)  # Empty Space
    cmds.separator(h=10, style='none')  # Empty Space
    cmds.text('3. Stored Data Status:')
    cmds.separator(h=10, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 90), (2, 143), (4, 37)],
                         cs=[(1, 10), (2, 0), (3, 0), (4, 0)])
    cmds.text(l='Stored Keys:  ', align="center", fn="boldLabelFont")
    stored_status_text = cmds.text(l='No Data',
                                   align="center",
                                   fn="tinyBoldLabelFont")
    cmds.rowColumnLayout(nc=1, cw=[(1, 240)], cs=[(1, 20)], p=content_main)
    cmds.separator(h=6, style='none')  # Empty Space

    cmds.rowColumnLayout(nc=1, cw=[(1, 240)], cs=[(1, 20)], p=content_main)

    ws_anim_bake_btn = cmds.button(l="Bake World Space",
                                   bgc=(.3, .3, .3),
                                   c=lambda x: validate_operation('bake'),
                                   en=False)
    cmds.separator(h=15, style='none')  # Empty Space

    # Show and Lock Window
    cmds.showWindow(build_gui_world_space_baker)
    cmds.window(window_name, e=True, s=False)

    # Set Window Icon
    qw = omui.MQtUtil.findWindow(window_name)
    if python_version == 3:
        widget = wrapInstance(int(qw), QWidget)
    else:
        widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/buttonManip.svg')
    widget.setWindowIcon(icon)

    # Remove the focus from the textfield and give it to the window
    cmds.setFocus(window_name)

    validate_operation('refresh')
示例#29
0
    def init_ui(self):
        self.setWindowTitle(_('Report creating'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.layout = QFormLayout(self)

        self.label_template = QLabel(_('Template'))
        self.item_template = AdvComboBox()
        self.item_template.addItems(get_templates(config.template_dir('reports')))
        self.layout.addRow(self.label_template, self.item_template)
        if _settings['last_template'] is not None:
            self.item_template.setCurrentText(_settings['last_template'])

        self.item_custom_path = QPushButton(_('Choose template'))

        def select_custom_path():
            file_name = get_open_file_name(_('Open HTML template'), _("HTML file (*.html)"))
            self.item_template.setCurrentText(file_name)

        self.item_custom_path.clicked.connect(select_custom_path)
        self.layout.addRow(self.item_custom_path)

        self.item_open_in_browser = QCheckBox(_('Open in browser'))
        self.item_open_in_browser.setChecked(_settings['open_in_browser'])
        self.layout.addRow(self.item_open_in_browser)

        self.item_save_to_last_file = QCheckBox(_('Save to last file'))
        self.item_save_to_last_file.setChecked(_settings['save_to_last_file'])
        self.layout.addRow(self.item_save_to_last_file)
        if _settings['last_file'] is None:
            self.item_save_to_last_file.setDisabled(True)

        self.item_selected = QCheckBox(_('Send selected'))
        self.item_selected.setChecked(_settings['selected'])
        self.layout.addRow(self.item_selected)

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except FileNotFoundError as e:
                logging.error(str(e))
            except Exception as e:
                logging.error(str(e))
                logging.exception(e)
            self.close()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.button_ok = button_box.button(QDialogButtonBox.Ok)
        self.button_ok.setText(_('OK'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = button_box.button(QDialogButtonBox.Cancel)
        self.button_cancel.setText(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)
        self.layout.addRow(button_box)

        self.show()
        self.button_ok.setFocus()
示例#30
0
    def _add_additional_qactions_tool_bar_view(self):
        """Add QActions to toolBarView that cannot be added via QDesign"""

        # Library
        self.dock_library_qaction = self.ui.dockLibrary.toggleViewAction()
        library_icon = QIcon()
        library_icon.addPixmap(QPixmap(":/component"), QIcon.Normal, QIcon.Off)
        self.dock_library_qaction.setIcon(library_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_library_qaction)

        # Design
        self.dock_design_qaction = self.ui.dockDesign.toggleViewAction()
        design_icon = QIcon()
        design_icon.addPixmap(QPixmap(":/design"), QIcon.Normal, QIcon.Off)
        self.dock_design_qaction.setIcon(design_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_design_qaction)

        # Variables
        self.dock_variables_qaction = self.ui.dockVariables.toggleViewAction()
        variables_icon = QIcon()
        variables_icon.addPixmap(QPixmap(":/variables"), QIcon.Normal,
                                 QIcon.Off)
        self.dock_variables_qaction.setIcon(variables_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_variables_qaction)

        # Connectors
        self.dock_connectors_qaction = self.ui.dockConnectors.toggleViewAction(
        )
        connectors_icon = QIcon()
        connectors_icon.addPixmap(QPixmap(":/connectors"), QIcon.Normal,
                                  QIcon.Off)
        self.dock_connectors_qaction.setIcon(connectors_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_connectors_qaction)

        # Log
        self.dock_log_qaction = self.ui.dockLog.toggleViewAction()
        log_icon = QIcon()
        log_icon.addPixmap(QPixmap(":/log"), QIcon.Normal, QIcon.Off)
        self.dock_log_qaction.setIcon(log_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_log_qaction)
示例#31
0
def start(_exit: bool = False) -> None:
    show_ui = True
    if "-h" in sys.argv or "--help" in sys.argv:
        print(f"Usage: {os.path.basename(sys.argv[0])}")
        print("Flags:")
        print("  -h, --help\tShow this message")
        print("  -n, --no-ui\tRun the program without showing a UI")
        return
    elif "-n" in sys.argv or "--no-ui" in sys.argv:
        show_ui = False

    app = QApplication(sys.argv)

    logo = QIcon(LOGO)
    main_window = MainWindow()
    ui = main_window.ui
    main_window.setWindowIcon(logo)
    tray = QSystemTrayIcon(logo, app)
    tray.activated.connect(main_window.systray_clicked)

    menu = QMenu()
    action_dim = QAction("Dim display (toggle)")
    action_dim.triggered.connect(dim_all_displays)
    action_configure = QAction("Configure...")
    action_configure.triggered.connect(main_window.bring_to_top)
    menu.addAction(action_dim)
    menu.addAction(action_configure)
    menu.addSeparator()
    action_exit = QAction("Exit")
    action_exit.triggered.connect(app.exit)
    menu.addAction(action_exit)

    tray.setContextMenu(menu)

    ui.text.textChanged.connect(partial(queue_text_change, ui))
    ui.command.textChanged.connect(partial(update_button_command, ui))
    ui.keys.textChanged.connect(partial(update_button_keys, ui))
    ui.write.textChanged.connect(partial(update_button_write, ui))
    ui.change_brightness.valueChanged.connect(
        partial(update_change_brightness, ui))
    ui.switch_page.valueChanged.connect(partial(update_switch_page, ui))
    ui.imageButton.clicked.connect(partial(select_image, main_window))
    ui.removeButton.clicked.connect(partial(remove_image, main_window))
    ui.settingsButton.clicked.connect(partial(show_settings, main_window))

    api.streamdesk_keys.key_pressed.connect(handle_keypress)

    items = api.open_decks().items()
    if len(items) == 0:
        print("Waiting for Stream Deck(s)...")
        while len(items) == 0:
            time.sleep(3)
            items = api.open_decks().items()

    for deck_id, deck in items:
        ui.device_list.addItem(f"{deck['type']} - {deck_id}", userData=deck_id)
        dimmers[deck_id] = Dimmer(
            api.get_display_timeout(deck_id),
            api.get_brightness(deck_id),
            partial(change_brightness, deck_id),
        )
        dimmers[deck_id].reset()

    build_device(ui)
    ui.device_list.currentIndexChanged.connect(partial(build_device, ui))

    ui.pages.currentChanged.connect(partial(change_page, ui))

    ui.actionExport.triggered.connect(partial(export_config, main_window))
    ui.actionImport.triggered.connect(partial(import_config, main_window))
    ui.actionExit.triggered.connect(app.exit)

    timer = QTimer()
    timer.timeout.connect(partial(sync, ui))
    timer.start(1000)

    api.render()
    tray.show()

    if show_ui:
        main_window.show()

    if _exit:
        return
    else:
        app.exec_()
        api.close_decks()
        sys.exit()
示例#32
0
def build_gui_help_connect_attributes():
    window_name = "build_gui_help_connect_attributes"
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name, window=True)

    cmds.window(window_name,
                title=script_name + " Help",
                mnb=False,
                mxb=False,
                s=True)
    cmds.window(window_name, e=True, s=True, wh=[1, 1])

    cmds.columnLayout("main_column", p=window_name)

    # Title Text
    cmds.separator(h=12, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)],
                         p="main_column")  # Window Size Adjustment
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)],
                         p="main_column")  # Title Column
    cmds.text(script_name + " Help",
              bgc=(.4, .4, .4),
              fn="boldLabelFont",
              align="center")
    cmds.separator(h=10, style='none', p="main_column")  # Empty Space

    # Body ====================
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p="main_column")
    cmds.text(l='This script automates the creation of connections',
              align="left")
    cmds.text(l='between attributes from source (output) and target',
              align="left")
    cmds.text(l='(input).', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Use Selection for Source and Target (s):',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='When this option is activated, you no longer need to',
              align="left")
    cmds.text(l='load sources/target (s).', align="left")
    cmds.text(l='You can simply select: 1st: source, 2nd, 3rd... : target(s)',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Add Reverse Node:', align="left", fn="boldLabelFont")
    cmds.text(l='Adds a reverse node between connections.', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Disconnect:', align="left", fn="boldLabelFont")
    cmds.text(l='Break connections between selected nodes.', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Force Connection (Overrides Existing)',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='Connects nodes even if they already have a connection.',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Add Custom Node Between Connection: ',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='Allows user to create a node between connections.',
              align="left")
    cmds.text(l='Excellent for controlling dataflow.', align="left")
    cmds.text(l='-Custom Node: Which node to create', align="left")
    cmds.text(l='-Add Input Node: Creates one master control to update',
              align="left")
    cmds.text(l='all in betweens.', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Load Source/Target Objects:',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='Use these buttons to load the objects you want to use',
              align="left")
    cmds.text(l='as source and target (s).', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Source Attribute and Target Attributes:',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='Name of the attribute you want to connect.', align="left")
    cmds.text(l='Requirement: Use long or short name (no nice names)',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='List All Attributes & List Keyable Attributes:',
              align="left",
              fn="boldLabelFont")
    cmds.text(l='Returns a list of attributes that can be used to populate',
              align="left")
    cmds.text(l='the Source and Target Attributes fields.', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p="main_column")
    cmds.text('Guilherme Trevisan  ')
    cmds.text(
        l='<a href="mailto:[email protected]">[email protected]</a>',
        hl=True,
        highlightColor=[1, 1, 1])
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p="main_column")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='<a href="https://github.com/TrevisanGMW">Github</a>',
              hl=True,
              highlightColor=[1, 1, 1])
    cmds.separator(h=7, style='none')  # Empty Space

    # Close Button
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p="main_column")
    cmds.separator(h=10, style='none')
    cmds.button(l='OK', h=30, c=lambda args: close_help_gui())
    cmds.separator(h=8, style='none')

    # Show and Lock Window
    cmds.showWindow(window_name)
    cmds.window(window_name, e=True, s=False)

    # Set Window Icon
    qw = omui.MQtUtil.findWindow(window_name)
    widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/question.png')
    widget.setWindowIcon(icon)

    def close_help_gui():
        if cmds.window(window_name, exists=True):
            cmds.deleteUI(window_name, window=True)
示例#33
0
 def __init__(self, *args, **argv):
     super().__init__(*args, **argv)
     self.setFocusPolicy(Qt.NoFocus)
     self.resize(5, 5)  # 为了调用resizeevent
     self.setIcon(QIcon("../../images/itembutton.png"))
示例#34
0
    def _create_menu(self):
        file_menu = self.menuBar().addMenu("&File")
        exit_action = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut = "Ctrl+Q", triggered=qApp.quit)
        file_menu.addAction(exit_action)

        navigation_menu = self.menuBar().addMenu("&Navigation")

        style_icons = ':/qt-project.org/styles/commonstyle/images/'
        back_action = QAction(QIcon.fromTheme("go-previous",
                                             QIcon(style_icons + 'left-32.png')),
                             "Back", self,
                             shortcut = QKeySequence(QKeySequence.Back),
                             triggered = self._tab_widget.back)
        self._actions[QWebEnginePage.Back] = back_action
        back_action.setEnabled(False)
        navigation_menu.addAction(back_action)
        forward_action = QAction(QIcon.fromTheme("go-next",
                                                QIcon(style_icons + 'right-32.png')),
                                "Forward", self,
                                shortcut = QKeySequence(QKeySequence.Forward),
                                triggered = self._tab_widget.forward)
        forward_action.setEnabled(False)
        self._actions[QWebEnginePage.Forward] = forward_action

        navigation_menu.addAction(forward_action)
        reload_action = QAction(QIcon(style_icons + 'refresh-32.png'),
                               "Reload", self,
                               shortcut = QKeySequence(QKeySequence.Refresh),
                               triggered = self._tab_widget.reload)
        self._actions[QWebEnginePage.Reload] = reload_action
        reload_action.setEnabled(False)
        navigation_menu.addAction(reload_action)

        navigation_menu.addSeparator()

        new_tab_action = QAction("New Tab", self,
                             shortcut = 'Ctrl+T',
                             triggered = self.add_browser_tab)
        navigation_menu.addAction(new_tab_action)

        close_tab_action = QAction("Close Current Tab", self,
                                 shortcut = "Ctrl+W",
                                 triggered = self._close_current_tab)
        navigation_menu.addAction(close_tab_action)

        edit_menu = self.menuBar().addMenu("&Edit")

        find_action = QAction("Find", self,
                             shortcut = QKeySequence(QKeySequence.Find),
                             triggered = self._show_find)
        edit_menu.addAction(find_action)

        edit_menu.addSeparator()
        undo_action = QAction("Undo", self,
                             shortcut = QKeySequence(QKeySequence.Undo),
                             triggered = self._tab_widget.undo)
        self._actions[QWebEnginePage.Undo] = undo_action
        undo_action.setEnabled(False)
        edit_menu.addAction(undo_action)

        redo_action = QAction("Redo", self,
                             shortcut = QKeySequence(QKeySequence.Redo),
                             triggered = self._tab_widget.redo)
        self._actions[QWebEnginePage.Redo] = redo_action
        redo_action.setEnabled(False)
        edit_menu.addAction(redo_action)

        edit_menu.addSeparator()

        cut_action = QAction("Cut", self,
                            shortcut = QKeySequence(QKeySequence.Cut),
                            triggered = self._tab_widget.cut)
        self._actions[QWebEnginePage.Cut] = cut_action
        cut_action.setEnabled(False)
        edit_menu.addAction(cut_action)

        copy_action = QAction("Copy", self,
                             shortcut = QKeySequence(QKeySequence.Copy),
                             triggered = self._tab_widget.copy)
        self._actions[QWebEnginePage.Copy] = copy_action
        copy_action.setEnabled(False)
        edit_menu.addAction(copy_action)

        paste_action = QAction("Paste", self,
                             shortcut = QKeySequence(QKeySequence.Paste),
                             triggered = self._tab_widget.paste)
        self._actions[QWebEnginePage.Paste] = paste_action
        paste_action.setEnabled(False)
        edit_menu.addAction(paste_action)

        edit_menu.addSeparator()

        select_all_action = QAction("Select All", self,
                                  shortcut = QKeySequence(QKeySequence.SelectAll),
                                  triggered = self._tab_widget.select_all)
        self._actions[QWebEnginePage.SelectAll] = select_all_action
        select_all_action.setEnabled(False)
        edit_menu.addAction(select_all_action)

        self._bookmark_menu = self.menuBar().addMenu("&Bookmarks")
        add_bookmark_action = QAction("&Add Bookmark", self,
                                    triggered = self._add_bookmark)
        self._bookmark_menu.addAction(add_bookmark_action)
        add_tool_bar_bookmark_action = QAction("&Add Bookmark to Tool Bar", self,
                                           triggered = self._add_tool_bar_bookmark)
        self._bookmark_menu.addAction(add_tool_bar_bookmark_action)
        self._bookmark_menu.addSeparator()

        tools_menu = self.menuBar().addMenu("&Tools")
        download_action = QAction("Open Downloads", self,
                                 triggered = DownloadWidget.open_download_directory)
        tools_menu.addAction(download_action)

        window_menu = self.menuBar().addMenu("&Window")

        window_menu.addAction(self._bookmark_dock.toggleViewAction())

        window_menu.addSeparator()

        zoom_in_action = QAction(QIcon.fromTheme("zoom-in"),
                               "Zoom In", self,
                               shortcut = QKeySequence(QKeySequence.ZoomIn),
                               triggered = self._zoom_in)
        window_menu.addAction(zoom_in_action)
        zoom_out_action = QAction(QIcon.fromTheme("zoom-out"),
                                "Zoom Out", self,
                                shortcut = QKeySequence(QKeySequence.ZoomOut),
                                triggered = self._zoom_out)
        window_menu.addAction(zoom_out_action)

        reset_zoom_action = QAction(QIcon.fromTheme("zoom-original"),
                                  "Reset Zoom", self,
                                  shortcut = "Ctrl+0",
                                  triggered = self._reset_zoom)
        window_menu.addAction(reset_zoom_action)

        about_menu = self.menuBar().addMenu("&About")
        about_action = QAction("About Qt", self,
                              shortcut = QKeySequence(QKeySequence.HelpContents),
                              triggered=qApp.aboutQt)
        about_menu.addAction(about_action)
示例#35
0
    def createActions(self):

        self.newAct = QAction(QIcon.fromTheme("document-new", QIcon(':/images/new.png')), "&New", self,
                shortcut=QKeySequence.New, statusTip="Create a new file",
                triggered=self.newFile)

        self.openAct = QAction(QIcon.fromTheme("document-open", QIcon(':/images/open.png')), "&Open...", self,
                shortcut=QKeySequence.Open, statusTip="Open an existing file",
                triggered=self.open)

        self.saveAct = QAction(QIcon.fromTheme("document-save", QIcon(':/images/save.png')), "&Save", self,
                shortcut=QKeySequence.Save,
                statusTip="Save the document to disk", triggered=self.save)

        self.saveAsAct = QAction("Save &As...", self,
                shortcut=QKeySequence.SaveAs,
                statusTip="Save the document under a new name",
                triggered=self.saveAs)

        self.exitAct = QAction("E&xit", self, shortcut=QKeySequence.Quit,
                statusTip="Exit the application",
                triggered=QApplication.instance().closeAllWindows)

        self.cutAct = QAction(QIcon.fromTheme("edit-cut", QIcon(':/images/cut.png')), "Cu&t", self,
                shortcut=QKeySequence.Cut,
                statusTip="Cut the current selection's contents to the clipboard",
                triggered=self.cut)

        self.copyAct = QAction(QIcon.fromTheme("edit-copy", QIcon(':/images/copy.png')), "&Copy", self,
                shortcut=QKeySequence.Copy,
                statusTip="Copy the current selection's contents to the clipboard",
                triggered=self.copy)

        self.pasteAct = QAction(QIcon.fromTheme("edit-paste", QIcon(':/images/paste.png')), "&Paste", self,
                shortcut=QKeySequence.Paste,
                statusTip="Paste the clipboard's contents into the current selection",
                triggered=self.paste)

        self.closeAct = QAction("Cl&ose", self,
                statusTip="Close the active window",
                triggered=self.mdiArea.closeActiveSubWindow)

        self.closeAllAct = QAction("Close &All", self,
                statusTip="Close all the windows",
                triggered=self.mdiArea.closeAllSubWindows)

        self.tileAct = QAction("&Tile", self, statusTip="Tile the windows",
                triggered=self.mdiArea.tileSubWindows)

        self.cascadeAct = QAction("&Cascade", self,
                statusTip="Cascade the windows",
                triggered=self.mdiArea.cascadeSubWindows)

        self.nextAct = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
                statusTip="Move the focus to the next window",
                triggered=self.mdiArea.activateNextSubWindow)

        self.previousAct = QAction("Pre&vious", self,
                shortcut=QKeySequence.PreviousChild,
                statusTip="Move the focus to the previous window",
                triggered=self.mdiArea.activatePreviousSubWindow)

        self.separatorAct = QAction(self)
        self.separatorAct.setSeparator(True)

        self.aboutAct = QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        self.aboutQtAct = QAction("About &Qt", self,
                statusTip="Show the Qt library's About box",
                triggered=QApplication.instance().aboutQt)