Beispiel #1
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1155, 853)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab = QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        self.tab_2 = QWidget()
        self.tab_2.setObjectName(_fromUtf8("tab_2"))
        self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 1155, 20))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QMetaObject.connectSlotsByName(MainWindow)
    def __init__(self):
        super(BaseWindow, self).__init__(None)
        self.win = None
        self.warning = None
        self.askClose = None

        self.subwindowButton = QPushButton("Create new subwindow", self)
        self.subwindowButton.setObjectName("subwindowButton")

        self.warningButton = QPushButton("Create new warning message box",
                                         self)
        self.warningButton.setObjectName("warningButton")

        self.idButton = QPushButton("Print ID", self)
        self.idButton.setObjectName("idButton")

        self.closeButton = QPushButton("Close application", self)
        self.closeButton.setObjectName("closeButton")

        self.addContentWidget(self.subwindowButton)
        self.addContentWidget(self.warningButton)
        self.addContentWidget(self.idButton)
        self.addContentWidget(self.closeButton)

        QMetaObject.connectSlotsByName(self)
Beispiel #3
0
    def __init__(self, parent=None):
        super(FramesWidget, self).__init__(parent)
        self.config_frames = []
        self.frames_instances = []
        self.current_frame = 0

        self.widget_layout = QVBoxLayout(self)
        self.setLayout(self.widget_layout)

        self.frames_widget = QWidget(self)
        self.frames_widget.setContentsMargins(0, 0, 0, 0)
        self.frames_widget_layout = QGridLayout(self.frames_widget)
        self.frames_widget_layout.setContentsMargins(0, 0, 0, 0)
        self.widget_layout.addWidget(self.frames_widget)

        self.btn_box = QDialogButtonBox(self)
        self.btn_box.setObjectName("btn_box")
        self.btn_box.setStandardButtons(QDialogButtonBox.Reset
                                        | QDialogButtonBox.Cancel
                                        | QDialogButtonBox.Ok)
        self.btn_box.button(QDialogButtonBox.Reset).setText("Back")
        self.btn_box.button(QDialogButtonBox.Ok).setText("Next")
        self.widget_layout.addWidget(self.btn_box)

        self.btn_box.button(QDialogButtonBox.Reset).clicked.connect(
            self.on_btn_box_resetted)
        QMetaObject.connectSlotsByName(self)
Beispiel #4
0
    def start(self):
        if self.logger_name:
            self.logger = logging.getLogger(self.logger_name)  # noqa
        else:
            self.logger = logging.getLogger(self.__class__.__name__)  # noqa
        self.data = {"size_left": 0, "data": b""}  # noqa
        self.tcpSocket = QTcpSocket(self)  # noqa

        self.tcpSocket.setObjectName("qclient_socket")
        QMetaObject.connectSlotsByName(self)
        self.tcpSocket.setSocketOption(QAbstractSocket.KeepAliveOption, 1)
        self.tcpSocket.connectToHost(QHostAddress(self.ip), self.port,
                                     QIODevice.ReadWrite)
        if not self.tcpSocket.waitForConnected(3000):
            self.failed_to_connect.emit(self.ip, self.port)
            self.tcpSocket.disconnectFromHost()
            self.tcpSocket.close()
            self.logger.error("Failed to connect to {}:{}".format(
                self.ip, self.port))
            return

        self.close_signal.connect(self.close, Qt.BlockingQueuedConnection)
        self.write_signal.connect(self._write)
        self.connect_signal.connect(self._connectTo)
        self.disconnect_signal.connect(self._disconnect)
        self.reconnect_signal.connect(self._reconnect)
Beispiel #5
0
    def __init__(self, parent=None):
        super(TermsFrame, self).__init__(parent)
        self.setObjectName("botnet_termsframe_start")
        self.disable_next_on_enter = True

        self.widget_layout = QVBoxLayout(self)
        self.setLayout(self.widget_layout)

        self.terms = QTextEdit(self)
        self.terms.setReadOnly(True)
        self.terms.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.terms.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.terms.setLineWrapMode(QTextEdit.WidgetWidth)
        self.terms.setWordWrapMode(QTextOption.WrapAnywhere)
        with open(os.path.join(sys.path[0], "../LICENSE")) as f:
            self.terms.setText(f.read())
        self.widget_layout.addWidget(self.terms)

        self.accept = QCheckBox(self)
        self.accept.setChecked(False)
        self.accept.setText("Accept license")
        self.accept.setObjectName("license_checkbox")
        self.widget_layout.addWidget(self.accept)

        QMetaObject.connectSlotsByName(self)
Beispiel #6
0
    def __init__(self, parent=None):
        super(SetupDialog, self).__init__(parent)
        self.logger = logging.getLogger(self.__class__.__name__)

        self.message_box = None

        self.start_button = QPushButton("Start", self)
        self.start_button.setObjectName("start_button")
        self.start_button.setMinimumHeight(35)
        self.start_button.setVisible(True)
        self.addSubContentWidget(self.start_button)

        self.config_frame = FramesWidget(self)
        self.config_frame.add_frames([
            TermsFrame, GUIConfigFrame, C2ConfigFrame, InfoFrame, FinishFrame
        ])

        self.config_frame.setObjectName("config_frame")
        self.config_frame.setVisible(False)
        self.addSubContentWidget(self.config_frame)

        QMetaObject.connectSlotsByName(self)
        try:
            self.closeClicked.disconnect()
        except Exception:
            pass
        self.closeClicked.connect(self.on_config_frame_rejected)
Beispiel #7
0
    def __init__(self, parent=None):
        super(Console, self).__init__(parent)
        self.json_decode_warning = None

        self.widget = QWidget(self)
        self.console_layout = QVBoxLayout(self.widget)
        self.widget.setLayout(self.console_layout)

        self.output_label = QLabel(self.widget)
        self.output_label.setText("Output")
        self.output_edit = QTextEdit(self.widget)
        self.output_edit.setReadOnly(True)
        self.highlighter = Highlighter(self.output_edit.document())
        self.output_edit.setStyleSheet("background-color: rgb(0, 0, 0);")
        self.output_edit.setTextColor(QColor(0, 255, 0))
        self.output_edit.setFont(QFont(self.output_edit.currentFont().family(), 10))

        self.input_label = QLabel(self.widget)
        self.input_label.setText("Command")
        self.input_edit = QLineEdit(self.widget)
        self.input_edit.setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(0, 255, 0)")
        self.input_edit.setFont(QFont(self.output_edit.currentFont().family(), 10))

        self.send_button = QPushButton(self.widget)
        self.send_button.setObjectName("send_button")
        self.send_button.setText("Send command")

        self.console_layout.addWidget(self.output_label)
        self.console_layout.addWidget(self.output_edit)
        self.console_layout.addWidget(self.input_label)
        self.console_layout.addWidget(self.input_edit)
        self.console_layout.addWidget(self.send_button)

        self.addContentWidget(self.widget)
        QMetaObject.connectSlotsByName(self)
Beispiel #8
0
    def __init__(self, parent):
        super(FramelessWindowBase, self).__init__(parent)
        self.__rect = QApplication.instance().desktop().availableGeometry(self)

        self.__resizingEnabled = True
        self.__contentWidgets = []

        self.setMouseTracking(True)
        self.setAttribute(Qt.WA_NoSystemBackground)
        super().setContentsMargins(0, 0, 0, 0)
        super().setWindowFlags(Qt.Window
                               | Qt.FramelessWindowHint
                               | Qt.WindowSystemMenuHint
                               | Qt.WindowMinimizeButtonHint
                               | Qt.WindowMaximizeButtonHint
                               | Qt.WindowCloseButtonHint)

        self.__centralWidget = QWidget(self)
        self.__centralWidget.setObjectName("__centralWidget")
        self.__centralWidget.setContentsMargins(0, 0, 0, 0)
        self.__centralWidget.setMouseTracking(True)

        self.__centralLayout = QVBoxLayout(self.__centralWidget)
        self.__centralLayout.setAlignment(Qt.AlignBottom)
        self.__centralLayout.setContentsMargins(0, 0, 0, 0)
        self.__centralLayout.setSpacing(0)

        self.__bar = Titlebar(self)
        self.__bar.showRestoreButton(False)
        self.__bar.showMinimizeButton(False)
        self.__bar.showMaximizeButton(False)
        self.__centralLayout.addWidget(self.__bar)
        self.__centralLayout.setAlignment(self.__bar, Qt.AlignVCenter)

        self.__contentWidget = QWidget(self)
        self.__contentWidget.setObjectName("__contentWidget")
        self.__contentWidget.setSizePolicy(QSizePolicy.Expanding,
                                           QSizePolicy.Expanding)
        self.__contentWidget.setContentsMargins(2, 0, 2, 2)
        self.__contentWidgetLayout = QVBoxLayout(self.__contentWidget)
        self.__contentWidgetLayout.setContentsMargins(0, 0, 0, 0)
        self.__centralLayout.addWidget(self.__contentWidget)

        self.__centralWidget.setLayout(self.__centralLayout)
        self.__contentWidget.setAutoFillBackground(True)

        self.__bar.closeClicked.connect(self.closeClicked.emit)
        self.closeClicked.connect(self.close)

        self.__main_layout = QVBoxLayout(self)
        self.__main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.__main_layout)
        self.__main_layout.addWidget(self.__centralWidget)

        QMetaObject.connectSlotsByName(self)
        self.showSizeControl(True)
        self.resize(
            QSize(int(self.__rect.width() / 2), int(self.__rect.height() / 2)))
Beispiel #9
0
    def setup_ui(self):
        # create title bar, content
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))

        self.hboxTitle.setContentsMargins(0, 0, 0, 0)
        self.hboxTitle.setSpacing(0)

        self.lblTitle.setObjectName('lblTitle')
        self.lblTitle.setAlignment(Qt.AlignCenter)
        self.hboxTitle.addWidget(self.lblTitle)

        sp_buttons = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(sp_buttons)
        self.hboxTitle.addWidget(self.btnMinimize)

        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(sp_buttons)
        self.btnRestore.setVisible(False)
        self.hboxTitle.addWidget(self.btnRestore)

        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(sp_buttons)
        self.hboxTitle.addWidget(self.btnMaximize)

        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(sp_buttons)
        self.hboxTitle.addWidget(self.btnClose)

        self.vboxFrame.addWidget(self.titleBar)

        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        # set window flags
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint)

        if self._window.app.qt_version >= (5, ):
            self.setAttribute(Qt.WA_TranslucentBackground)

        # set stylesheet
        stylesheet = self.app.ui.get_stylesheet('frameless.qss')
        self.setStyleSheet(stylesheet)

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)
Beispiel #10
0
    def setupUi(self, Form):
        if Form.objectName():
            Form.setObjectName(u"Form")
        Form.resize(400, 300)
        Form.setMinimumSize(QSize(400, 300))
        Form.setMaximumSize(QSize(400, 300))
        self.textBrowser = QTextBrowser(Form)
        self.textBrowser.setObjectName(u"textBrowser")
        self.textBrowser.setGeometry(QRect(0, 0, 400, 300))

        self.retranslateUi(Form)

        QMetaObject.connectSlotsByName(Form)
    def __init__(self, parent=None):
        super(FramelessWindow, self).__init__(parent)
        self.__rect = QApplication.instance().desktop().availableGeometry(self)

        self.__titlebarHeight = 45
        self.__borderWidth = 3

        self.hwnd = None

        if QtWin.isCompositionEnabled():
            QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
        else:
            QtWin.resetExtendedFrame(self)
        QMetaObject.connectSlotsByName(self)
Beispiel #12
0
 def setup_ui(self, dialog):
     dialog.setObjectName("Dialog")
     dialog.resize(600, 200)
     dialog.setModal(True)
     self.layout = QHBoxLayout(dialog)
     self.layout.setObjectName("hbox_layout")
     self.waiting = QtWaitingSpinner(dialog, centerOnParent=False)
     self.waiting.setObjectName("waiting")
     self.label = QLabel('Loading model result...')
     font = self.label.font()
     font.setPointSize(16)
     self.label.setFont(font)
     self.label.setStyleSheet("QLabel { color : black; }")
     self.layout.addWidget(self.waiting)
     self.layout.addWidget(self.label)
     QMetaObject.connectSlotsByName(dialog)
Beispiel #13
0
    def setupUi(self, Form):
        if not Form.objectName():
            Form.setObjectName(u"Form")
        Form.resize(400, 300)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        Form.setMinimumSize(QSize(400, 300))
        Form.setMaximumSize(QSize(400, 300))
        self.textBrowser = QTextBrowser(Form)
        self.textBrowser.setObjectName(u"textBrowser")
        self.textBrowser.setGeometry(QRect(0, 0, 401, 301))

        self.retranslateUi(Form)

        QMetaObject.connectSlotsByName(Form)
Beispiel #14
0
    def __init__(self, parent=None):
        super(Titlebar, self).__init__(parent)
        self.setObjectName("titlebar")
        self.setMouseTracking(True)

        self.menus = []

        self.setAutoFillBackground(True)
        self.setFixedHeight(30)
        self.setContentsMargins(0, 0, 0, 0)
        self.setBackgroundRole(QPalette.Highlight)

        self.layout = QHBoxLayout(self)
        self.layout.setAlignment(Qt.AlignVCenter)
        self.layout.setAlignment(Qt.AlignLeft)
        self.layout.setContentsMargins(8, 0, 0, 0)
        self.layout.setSpacing(0)
        self.setLayout(self.layout)

        self.appLogoLabel = AppLogo(self)
        if qrainbowstyle.APP_ICON_PATH:
            self.appLogoLabel.setPixmap(QPixmap(qrainbowstyle.APP_ICON_PATH))
            self.layout.setContentsMargins(2, 0, 0, 0)
        self.layout.addWidget(self.appLogoLabel)
        if qrainbowstyle.ALIGN_BUTTONS_LEFT:
            self.appLogoLabel.setVisible(False)
            self.layout.setContentsMargins(8, 0, 0, 0)

        self.layout.insertStretch(50)
        self.buttonsWidget = ButtonsWidget(self)
        if qrainbowstyle.ALIGN_BUTTONS_LEFT:
            self.layout.insertWidget(0, self.buttonsWidget)
        else:
            self.layout.addWidget(self.buttonsWidget)

        # auto connect signals
        QMetaObject.connectSlotsByName(self)
        if self.window().parent() is not None:
            self.buttonsWidget.btnRestore.setVisible(False)
            self.buttonsWidget.btnMaximize.setVisible(False)
            self.buttonsWidget.btnMinimize.setVisible(False)
Beispiel #15
0
    def on_gui_client_config(self, config: dict):
        if config:
            self.content_widget.bot_double_clicked.connect(
                self.on_bot_double_clicked)
            self.content_widget.task_button_clicked.connect(
                self.on_task_button_clicked)
            self.content_widget.payload_button_clicked.connect(
                self.on_payload_button_clicked)
            self.content_widget.setupUi(config)
            self.addContentWidget(self.content_widget)

            self.console_window = Console(self)
            self.client.message.connect(self.console_window.write)
            self.client.shell_error.connect(self.on_gui_client_shell_error)
            self.client.shell_output.connect(self.on_gui_client_shell_output)
            self.console_window.message.connect(self.client.write)
            self.console_window.setVisible(False)

            self.spinner = WaitingSpinner(self,
                                          modality=Qt.WindowModal,
                                          disableParentWhenSpinning=True,
                                          roundness=70.0,
                                          fade=70.0,
                                          radius=15.0,
                                          lines=6,
                                          line_length=25.0,
                                          line_width=4.0,
                                          speed=1.0)
            self.content_widget.load_finished.connect(self.spinner.stop)
            self.spinner.start()

            self.menu = MainWindowMenu(self)
            self.addMenu(self.menu)

            self.tray = SystemTrayWidget(self)
            self.tray.exit_action_triggered.connect(self.on_close_requested)
            self.tray.hide_action_triggered.connect(self.hide)
            self.tray.show_action_triggered.connect(self.show)
            self.tray.show()
            QMetaObject.connectSlotsByName(self)
Beispiel #16
0
    def setupUi(self):
        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame = QWidget(self)
        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame = QVBoxLayout(self.windowFrame)
        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar = WindowDragger(self, self.windowFrame)
        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))

        self.hboxTitle = QHBoxLayout(self.titleBar)
        self.hboxTitle.setContentsMargins(0, 0, 0, 0)
        self.hboxTitle.setSpacing(0)

        self.lblTitle = QLabel('Title')
        self.lblTitle.setObjectName('lblTitle')
        self.lblTitle.setAlignment(Qt.AlignCenter)

        spButtons = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self.btnMinimize = QToolButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(spButtons)

        self.btnRestore = QToolButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(spButtons)
        self.btnRestore.setVisible(False)

        self.btnMaximize = QToolButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(spButtons)

        self.btnClose = QToolButton(self.titleBar)
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(spButtons)

        self.vboxFrame.addWidget(self.titleBar)

        self.windowContent = QWidget(self.windowFrame)
        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        if PLATFORM == "Darwin":
            self.hboxTitle.addWidget(self.btnClose)
            self.hboxTitle.addWidget(self.btnMinimize)
            self.hboxTitle.addWidget(self.btnRestore)
            self.hboxTitle.addWidget(self.btnMaximize)
            self.hboxTitle.addWidget(self.lblTitle)
        else:
            self.hboxTitle.addWidget(self.lblTitle)
            self.hboxTitle.addWidget(self.btnMinimize)
            self.hboxTitle.addWidget(self.btnRestore)
            self.hboxTitle.addWidget(self.btnMaximize)
            self.hboxTitle.addWidget(self.btnClose)

        # set window flags
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint)

        if QT_VERSION >= (5, ):
            self.setAttribute(Qt.WA_TranslucentBackground)

        # set stylesheet
        with open(_FL_STYLESHEET) as stylesheet:
            self.setStyleSheet(stylesheet.read())

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)
Beispiel #17
0
 def loadUi(uifile, baseinstance=None):
     loader = UiLoader(baseinstance, None)
     widget = loader.load(uifile)
     QMetaObject.connectSlotsByName(widget)
     return widget
Beispiel #18
0
    def setupUi(self, MainWindow, title):
        MainWindow.setWindowTitle(title)
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(500, 500)
        MainWindow.setMinimumSize(QSize(300, 350))
        self.centralWidget = QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.gridLayout = QGridLayout(self.centralWidget)
        self.gridLayout.setContentsMargins(11, 11, 11, 11)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_5.setSpacing(6)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.lines_selected_label = QLabel(self.centralWidget)
        self.lines_selected_label.setObjectName("lines_selected_label")
        self.horizontalLayout_5.addWidget(self.lines_selected_label)
        self.label = QLabel(self.centralWidget)
        self.label.setObjectName("label")
        self.horizontalLayout_5.addWidget(self.label)
        self.draw_button = QPushButton(self.centralWidget)
        self.draw_button.setObjectName("draw_button")
        self.horizontalLayout_5.addWidget(self.draw_button)
        self.erase_button = QPushButton(self.centralWidget)
        self.erase_button.setObjectName("erase_button")
        self.horizontalLayout_5.addWidget(self.erase_button)
        self.dismiss_button = QPushButton(self.centralWidget)
        self.dismiss_button.setObjectName("dismiss_button")
        self.horizontalLayout_5.addWidget(self.dismiss_button)
        self.gridLayout.addLayout(self.horizontalLayout_5, 4, 0, 1, 1)
        self.verticalLayout_11 = QVBoxLayout()
        self.verticalLayout_11.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_11.setSpacing(6)
        self.verticalLayout_11.setObjectName("verticalLayout_11")
        self.tabWidget = QTabWidget(self.centralWidget)
        self.tabWidget.setObjectName("tabWidget")
        self.verticalLayout_11.addWidget(self.tabWidget)
        self.gridLayout.addLayout(self.verticalLayout_11, 0, 0, 1, 1)
        self.horizontalLayout_7 = QHBoxLayout()
        self.horizontalLayout_7.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_7.setSpacing(6)
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.add_set_button = QPushButton(self.centralWidget)
        self.add_set_button.setObjectName("add_set_button")
        self.horizontalLayout_7.addWidget(self.add_set_button)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem)
        self.gridLayout.addLayout(self.horizontalLayout_7, 2, 0, 2, 1)
        MainWindow.setCentralWidget(self.centralWidget)
        self.menuBar = QMenuBar(MainWindow)
        self.menuBar.setGeometry(QRect(0, 0, 767, 22))
        self.menuBar.setObjectName("menuBar")
        self.menuFile = QMenu(self.menuBar)
        self.menuFile.setObjectName("menuFile")
        MainWindow.setMenuBar(self.menuBar)
        self.mainToolBar = QToolBar(MainWindow)
        self.mainToolBar.setMovable(False)
        self.mainToolBar.setFloatable(False)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(Qt.TopToolBarArea, self.mainToolBar)
        self.statusBar = QStatusBar(MainWindow)
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)
        self.actionOpen = QAction(MainWindow)
        icon = QIcon()
        icon.addPixmap(QPixmap(":/img/Open Folder-48.png"), QIcon.Normal,
                       QIcon.Off)
        self.actionOpen.setIcon(icon)
        self.actionOpen.setObjectName("actionOpen")
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.actionRemove = QAction(MainWindow)
        self.actionRemove.setObjectName("actionRemove")
        self.actionChange_Color = QAction(MainWindow)
        self.actionChange_Color.setObjectName("actionChange_Color")
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menuBar.addAction(self.menuFile.menuAction())
        self.mainToolBar.addAction(self.actionOpen)
        self.mainToolBar.addSeparator()

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
Beispiel #19
0
    def __init__(self, parent=None):
        super().__init__(parent)

        # Create viewer widget
        self._viewer = micro_view.MicroViewWidget()
        self._viewer.setObjectName("viewer")
        self._viewer.showLocalizationsChanged.connect(self.setShowPreview)

        # Create dock widgets
        fileChooser = file_chooser.FileChooser()
        fileChooser.selected.connect(self.open)
        self._fileModel = fileChooser.model()
        self._fileModel.rowsRemoved.connect(self._checkFileList)
        self._fileDock = QDockWidget(self.tr("File selection"), self)
        self._fileDock.setObjectName("fileDock")
        self._fileDock.setWidget(fileChooser)

        self._locOptionsWidget = locate_options.Container()
        self._locOptionsWidget.setObjectName("locOptionsWidget")
        self._locOptionsDock = QDockWidget(self.tr("Localization options"),
                                           self)
        self._locOptionsDock.setObjectName("locOptionsDock")
        self._locOptionsDock.setWidget(self._locOptionsWidget)

        self._locFilterWidget = locate_filter.FilterWidget()
        self._locFilterWidget.filterChanged.connect(self._filterLocalizations)
        self._locFilterDock = QDockWidget(self.tr("Localization filter"), self)
        self._locFilterDock.setObjectName("locFilterDock")
        self._locFilterDock.setWidget(self._locFilterWidget)

        locSaveWidget = locate_saver.SaveWidget()
        self._locSaveDock = QDockWidget(self.tr("Save localizations"), self)
        self._locSaveDock.setObjectName("locSaveDock")
        self._locSaveDock.setWidget(locSaveWidget)

        for d in (self._fileDock, self._locOptionsDock, self._locFilterDock,
                  self._locSaveDock):
            d.setFeatures(d.features() & ~QDockWidget.DockWidgetClosable)
            self.addDockWidget(Qt.LeftDockWidgetArea, d)
        self.setDockOptions(self.dockOptions() | QMainWindow.VerticalTabs)

        self.setCentralWidget(self._viewer)

        # set up the preview worker
        self._previewWorker = workers.PreviewWorker(self)
        self._locOptionsWidget.optionsChanged.connect(
            self._makePreviewWorkerWork)
        self._viewer.currentFrameChanged.connect(self._makePreviewWorkerWork)
        self._previewWorker.finished.connect(self._previewFinished)
        self._previewWorker.error.connect(self._previewError)
        self._previewWorker.enabled = True
        self._previewWorker.busyChanged.connect(self._setBusyCursor)

        # set up the batch worker
        self._batchWorker = workers.BatchWorker(self)
        self._batchWorker.fileFinished.connect(self._locateRunnerFinished)
        self._batchWorker.fileError.connect(self._locateRunnerError)

        # batch progress dialog
        self._progressDialog = batch_progress.BatchProgressDialog(self)

        self._batchWorker.fileFinished.connect(
            self._progressDialog.increaseValue)
        self._batchWorker.fileError.connect(self._progressDialog.increaseValue)
        self._progressDialog.canceled.connect(self._batchWorker.stop)

        # Some things to keep track of
        self._currentFile = QPersistentModelIndex()
        self._currentLocData = pd.DataFrame(columns=["x", "y"])
        self._roiPolygon = QPolygonF()

        # load settings and restore window geometry
        settings = QSettings("sdt", "locator")
        v = settings.value("MainWindow/geometry")
        if v is not None:
            self.restoreGeometry(v)
        v = settings.value("MainWindow/state")
        if v is not None:
            self.restoreState(v)

        # restore enable/disable preview
        show = settings.value("Viewer/showPreview", True, type=bool)
        self._viewer.showLocalizations = show

        QMetaObject.connectSlotsByName(self)
Beispiel #20
0
    def setupUi(self, MainWindow):
        if MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(701, 340)
        MainWindow.setMinimumSize(QSize(701, 340))
        MainWindow.setMaximumSize(QSize(701, 340))
        MainWindow.setDocumentMode(True)
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName(u"actionExit")
        self.actionHelp = QAction(MainWindow)
        self.actionHelp.setObjectName(u"actionHelp")
        self.actionAbout = QAction(MainWindow)
        self.actionAbout.setObjectName(u"actionAbout")
        self.actionLicense = QAction(MainWindow)
        self.actionLicense.setObjectName(u"actionLicense")
        self.actionSave = QAction(MainWindow)
        self.actionSave.setObjectName(u"actionSave")
        self.actionSave.setVisible(True)
        self.actionLoad = QAction(MainWindow)
        self.actionLoad.setObjectName(u"actionLoad")
        self.actionLoad.setVisible(True)
        self.actionCheck_for_update = QAction(MainWindow)
        self.actionCheck_for_update.setObjectName(u"actionCheck_for_update")
        self.actionCheck_for_update.setEnabled(False)
        self.actionDefault = QAction(MainWindow)
        self.actionDefault.setObjectName(u"actionDefault")
        self.actionClearDefault = QAction(MainWindow)
        self.actionClearDefault.setObjectName(u"actionClearDefault")
        self.actionClearDefault.setVisible(False)
        self.centralWidget = QWidget(MainWindow)
        self.centralWidget.setObjectName(u"centralWidget")
        self.horizontalLayoutWidget = QWidget(self.centralWidget)
        self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget")
        self.horizontalLayoutWidget.setGeometry(QRect(10, 0, 511, 261))
        self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setSpacing(6)
        self.horizontalLayout.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.groupBox_2 = QGroupBox(self.horizontalLayoutWidget)
        self.groupBox_2.setObjectName(u"groupBox_2")
        self.horizontalLayoutWidget_2 = QWidget(self.groupBox_2)
        self.horizontalLayoutWidget_2.setObjectName(
            u"horizontalLayoutWidget_2")
        self.horizontalLayoutWidget_2.setGeometry(QRect(10, 40, 231, 211))
        self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2)
        self.horizontalLayout_2.setSpacing(6)
        self.horizontalLayout_2.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.primary_brightness = QSlider(self.horizontalLayoutWidget_2)
        self.primary_brightness.setObjectName(u"primary_brightness")
        self.primary_brightness.setValue(99)
        self.primary_brightness.setOrientation(Qt.Vertical)

        self.horizontalLayout_2.addWidget(self.primary_brightness)

        self.primary_red = QSlider(self.horizontalLayoutWidget_2)
        self.primary_red.setObjectName(u"primary_red")
        self.primary_red.setValue(99)
        self.primary_red.setOrientation(Qt.Vertical)

        self.horizontalLayout_2.addWidget(self.primary_red)

        self.primary_green = QSlider(self.horizontalLayoutWidget_2)
        self.primary_green.setObjectName(u"primary_green")
        self.primary_green.setValue(99)
        self.primary_green.setOrientation(Qt.Vertical)

        self.horizontalLayout_2.addWidget(self.primary_green)

        self.primary_blue = QSlider(self.horizontalLayoutWidget_2)
        self.primary_blue.setObjectName(u"primary_blue")
        self.primary_blue.setValue(99)
        self.primary_blue.setOrientation(Qt.Vertical)

        self.horizontalLayout_2.addWidget(self.primary_blue)

        self.horizontalLayout.addWidget(self.groupBox_2)

        self.groupBox = QGroupBox(self.horizontalLayoutWidget)
        self.groupBox.setObjectName(u"groupBox")
        self.horizontalLayoutWidget_3 = QWidget(self.groupBox)
        self.horizontalLayoutWidget_3.setObjectName(
            u"horizontalLayoutWidget_3")
        self.horizontalLayoutWidget_3.setGeometry(QRect(20, 40, 231, 211))
        self.horizontalLayout_3 = QHBoxLayout(self.horizontalLayoutWidget_3)
        self.horizontalLayout_3.setSpacing(6)
        self.horizontalLayout_3.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.secondary_brightness = QSlider(self.horizontalLayoutWidget_3)
        self.secondary_brightness.setObjectName(u"secondary_brightness")
        self.secondary_brightness.setValue(99)
        self.secondary_brightness.setOrientation(Qt.Vertical)

        self.horizontalLayout_3.addWidget(self.secondary_brightness)

        self.secondary_red = QSlider(self.horizontalLayoutWidget_3)
        self.secondary_red.setObjectName(u"secondary_red")
        self.secondary_red.setContextMenuPolicy(Qt.CustomContextMenu)
        self.secondary_red.setValue(99)
        self.secondary_red.setOrientation(Qt.Vertical)

        self.horizontalLayout_3.addWidget(self.secondary_red)

        self.secondary_green = QSlider(self.horizontalLayoutWidget_3)
        self.secondary_green.setObjectName(u"secondary_green")
        self.secondary_green.setValue(99)
        self.secondary_green.setOrientation(Qt.Vertical)

        self.horizontalLayout_3.addWidget(self.secondary_green)

        self.secondary_blue = QSlider(self.horizontalLayoutWidget_3)
        self.secondary_blue.setObjectName(u"secondary_blue")
        self.secondary_blue.setValue(99)
        self.secondary_blue.setOrientation(Qt.Vertical)

        self.horizontalLayout_3.addWidget(self.secondary_blue)

        self.horizontalLayout.addWidget(self.groupBox)

        self.label = QLabel(self.centralWidget)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(20, 260, 71, 16))
        self.label_2 = QLabel(self.centralWidget)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setGeometry(QRect(100, 260, 21, 16))
        self.label_3 = QLabel(self.centralWidget)
        self.label_3.setObjectName(u"label_3")
        self.label_3.setGeometry(QRect(150, 260, 21, 16))
        self.label_4 = QLabel(self.centralWidget)
        self.label_4.setObjectName(u"label_4")
        self.label_4.setGeometry(QRect(200, 260, 16, 16))
        self.label_5 = QLabel(self.centralWidget)
        self.label_5.setObjectName(u"label_5")
        self.label_5.setGeometry(QRect(290, 260, 71, 16))
        self.label_6 = QLabel(self.centralWidget)
        self.label_6.setObjectName(u"label_6")
        self.label_6.setGeometry(QRect(370, 260, 21, 16))
        self.label_7 = QLabel(self.centralWidget)
        self.label_7.setObjectName(u"label_7")
        self.label_7.setGeometry(QRect(420, 260, 21, 16))
        self.label_8 = QLabel(self.centralWidget)
        self.label_8.setObjectName(u"label_8")
        self.label_8.setGeometry(QRect(470, 260, 16, 16))
        self.verticalLayoutWidget = QWidget(self.centralWidget)
        self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
        self.verticalLayoutWidget.setGeometry(QRect(529, 0, 213, 218))
        self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setSizeConstraint(QLayout.SetDefaultConstraint)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.label_9 = QLabel(self.verticalLayoutWidget)
        self.label_9.setObjectName(u"label_9")

        self.verticalLayout.addWidget(self.label_9)

        self.label_12 = QLabel(self.verticalLayoutWidget)
        self.label_12.setObjectName(u"label_12")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_12.sizePolicy().hasHeightForWidth())
        self.label_12.setSizePolicy(sizePolicy)

        self.verticalLayout.addWidget(self.label_12)

        self.primary_combobox = QComboBox(self.verticalLayoutWidget)
        self.primary_combobox.setObjectName(u"primary_combobox")
        sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.primary_combobox.sizePolicy().hasHeightForWidth())
        self.primary_combobox.setSizePolicy(sizePolicy1)
        self.primary_combobox.setMaximumSize(QSize(150, 28))

        self.verticalLayout.addWidget(self.primary_combobox)

        self.label_11 = QLabel(self.verticalLayoutWidget)
        self.label_11.setObjectName(u"label_11")

        self.verticalLayout.addWidget(self.label_11)

        self.secondary_combo = QComboBox(self.verticalLayoutWidget)
        self.secondary_combo.setObjectName(u"secondary_combo")
        self.secondary_combo.setMaximumSize(QSize(150, 28))

        self.verticalLayout.addWidget(self.secondary_combo)

        self.label_10 = QLabel(self.verticalLayoutWidget)
        self.label_10.setObjectName(u"label_10")

        self.verticalLayout.addWidget(self.label_10)

        self.comboBox = QComboBox(self.verticalLayoutWidget)
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.setObjectName(u"comboBox")
        self.comboBox.setMaximumSize(QSize(150, 28))

        self.verticalLayout.addWidget(self.comboBox)

        MainWindow.setCentralWidget(self.centralWidget)
        self.statusBar = QStatusBar(MainWindow)
        self.statusBar.setObjectName(u"statusBar")
        MainWindow.setStatusBar(self.statusBar)
        self.menuBar = QMenuBar(MainWindow)
        self.menuBar.setObjectName(u"menuBar")
        self.menuBar.setGeometry(QRect(0, 0, 701, 32))
        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.menuBar.addAction(self.menuFile.menuAction())
        self.menuBar.addAction(self.menuHelp.menuAction())
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionDefault)
        self.menuFile.addAction(self.actionClearDefault)
        self.menuFile.addAction(self.actionLoad)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menuHelp.addAction(self.actionHelp)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addAction(self.actionLicense)
        self.menuHelp.addAction(self.actionCheck_for_update)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
Beispiel #21
0
    def setupUi(self):
        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame = QWidget(self)
        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame = QVBoxLayout(self.windowFrame)
        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar = WindowDragger(self, self.windowFrame)
        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))

        self.hboxTitle = QHBoxLayout(self.titleBar)
        self.hboxTitle.setContentsMargins(0, 0, 0, 0)
        self.hboxTitle.setSpacing(0)

        self.lblTitle = QLabel('Title')
        self.lblTitle.setObjectName('lblTitle')
        self.lblTitle.setAlignment(Qt.AlignCenter)
        self.hboxTitle.addWidget(self.lblTitle)

        spButtons = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self.dragArea = QWidget(self.titleBar)
        self.dragArea.setObjectName('dragArea')
        self.dragAreaLayout = QHBoxLayout(self.dragArea)
        self.spacer = QSpacerItem(20, 0, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.dragArea.setVisible(False)
        self.dragAreaLayout.addItem(self.spacer)
        self.hboxTitle.addWidget(self.dragArea)

        self.btnCollapse = QToolButton(self.titleBar)
        self.btnCollapse.setObjectName('btnCollapse')
        self.btnCollapse.setSizePolicy(spButtons)
        self.btnCollapse.setVisible(False)
        self.hboxTitle.addWidget(self.btnCollapse)

        self.btnUncollapse = QToolButton(self.titleBar)
        self.btnUncollapse.setObjectName('btnUncollapse')
        self.btnUncollapse.setSizePolicy(spButtons)
        self.btnUncollapse.setVisible(False)
        self.hboxTitle.addWidget(self.btnUncollapse)

        self.btnMinimize = QToolButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(spButtons)
        self.hboxTitle.addWidget(self.btnMinimize)

        self.btnRestore = QToolButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(spButtons)
        self.btnRestore.setVisible(False)
        self.hboxTitle.addWidget(self.btnRestore)

        self.btnMaximize = QToolButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(spButtons)
        self.hboxTitle.addWidget(self.btnMaximize)

        self.btnClose = QToolButton(self.titleBar)
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(spButtons)
        self.hboxTitle.addWidget(self.btnClose)

        self.vboxFrame.addWidget(self.titleBar)

        self.windowContent = QWidget(self.windowFrame)
        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        # set window flags
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint)

        if QT_VERSION >= (5, ):
            self.setAttribute(Qt.WA_TranslucentBackground)

        self.updateFrameSheet()

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)
Beispiel #22
0
    def setupUi(self):

        size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame = QWidget(self)
        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame = QVBoxLayout(self.windowFrame)
        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar = WindowDragger(self, self.windowFrame)
        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))
        self.hboxTitle = QHBoxLayout(self.titleBar)
        self.hboxTitle.setContentsMargins(0, 0, 0, 0)

        #self.hboxTitle.setSpacing(0)

        self.btnClose = QToolButton(self.titleBar)
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.btnClose)

        self.btnMinimize = QToolButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.btnMinimize)

        #self.btnMinimize.setVisible(False)

        self.btnRestore = QToolButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.btnRestore)

        self.btnRestore.setVisible(False)

        self.btnMaximize = QToolButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.btnMaximize)

        # self.btnMaximize.setVisible(False)

        self.showbuttons()

        self.spacelabel = QLabel("|")  #dummy label for space
        self.spacelabel.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.spacelabel)

        QPixmapCache.clear()
        self.lblIcon = QLabel()
        self.pixmap = QPixmap("resources/images/rabbit_icon_16.png")
        self.lblIcon.setPixmap(self.pixmap)
        self.lblIcon.setSizePolicy(size_policy)
        self.hboxTitle.addWidget(self.lblIcon)

        #self.spacelabel = QLabel()  #dummy label for space
        #self.spacelabel.setSizePolicy(size_policy)
        #self.hboxTitle.addWidget(self.spacelabel)

        self.lblTitle = QLabel('Title')
        self.lblTitle.setObjectName('lblTitle')
        #self.lblTitle.setAlignment(Qt.AlignCenter)
        self.hboxTitle.addWidget(self.lblTitle)

        self.versionlabel = QLabel()
        self.versionlabel.setText("Version - {version}".format(
            version=self.parser.get(self.section_name, 'app.version')))
        #self.spacelabel.setSizePolicy(size_policy)
        self.versionlabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.hboxTitle.addWidget(self.versionlabel)

        self.vboxFrame.addWidget(self.titleBar)

        self.windowContent = QWidget(self.windowFrame)
        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        # set window flags
        #self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Tool)
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint | Qt.CustomizeWindowHint
                            | Qt.WindowTitleHint)

        self.window.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                                   | Qt.WindowSystemMenuHint
                                   | Qt.CustomizeWindowHint
                                   | Qt.WindowTitleHint)
        '''Qt::CustomizeWindowHint 
        | Qt::WindowTitleHint | Qt: 
        | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint'''

        if QT_VERSION >= (5, ):
            self.setAttribute(Qt.WA_TranslucentBackground)

        # set stylesheet
        with open(_FL_STYLESHEET) as stylesheet:
            self.setStyleSheet(stylesheet.read())

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)
Beispiel #23
0
    def setupUi(self, MainWindow, title):
        MainWindow.setWindowTitle(title)
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(600, 850)
        MainWindow.setMinimumSize(QSize(300, 350))
        self.centralWidget = QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.gridLayout = QGridLayout(self.centralWidget)
        self.gridLayout.setContentsMargins(11, 11, 11, 11)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_5.setSpacing(6)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.lines_selected_label = QLabel(self.centralWidget)
        self.lines_selected_label.setObjectName("lines_selected_label")
        self.horizontalLayout_5.addWidget(self.lines_selected_label)
        self.label = QLabel(self.centralWidget)
        self.label.setObjectName("label")
        self.horizontalLayout_5.addWidget(self.label)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem)
        self.draw_button = QPushButton(self.centralWidget)
        self.draw_button.setObjectName("draw_button")
        self.horizontalLayout_5.addWidget(self.draw_button)
        self.erase_button = QPushButton(self.centralWidget)
        self.erase_button.setObjectName("erase_button")
        self.horizontalLayout_5.addWidget(self.erase_button)
        self.dismiss_button = QPushButton(self.centralWidget)
        self.dismiss_button.setObjectName("dismiss_button")
        self.horizontalLayout_5.addWidget(self.dismiss_button)
        self.gridLayout.addLayout(self.horizontalLayout_5, 4, 0, 1, 1)
        self.verticalLayout_11 = QVBoxLayout()
        self.verticalLayout_11.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_11.setSpacing(6)
        self.verticalLayout_11.setObjectName("verticalLayout_11")
        self.tabWidget = QTabWidget(self.centralWidget)
        self.tabWidget.setObjectName("tabWidget")
        self.tabWidget.setTabsClosable(True)
        self.verticalLayout_11.addWidget(self.tabWidget)
        self.gridLayout.addLayout(self.verticalLayout_11, 0, 0, 1, 1)
        self.horizontalLayout_7 = QHBoxLayout()
        self.horizontalLayout_7.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_7.setSpacing(6)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem)
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.gridLayout.addLayout(self.horizontalLayout_7, 2, 0, 2, 1)
        MainWindow.setCentralWidget(self.centralWidget)

        # self.menuBar = QMenuBar(MainWindow)
        # self.menuBar.setGeometry(QRect(0, 0, 767, 22))
        # self.menuBar.setObjectName("menuBar")
        #
        # self.menuFile = QMenu(self.menuBar)
        # self.menuFile.setObjectName("menuFile")
        #
        # MainWindow.setMenuBar(self.menuBar)

        self.mainToolBar = QToolBar(MainWindow)
        self.mainToolBar.setMovable(False)
        self.mainToolBar.setFloatable(False)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(Qt.TopToolBarArea, self.mainToolBar)

        # self.statusBar = QStatusBar(MainWindow)
        # self.statusBar.setObjectName("statusBar")
        # MainWindow.setStatusBar(self.statusBar)

        self.actionOpen = QAction(MainWindow)
        icon = QIcon(os.path.join(ICON_PATH, "Open Folder-48.png"))
        self.actionOpen.setIcon(icon)
        self.actionOpen.setObjectName("actionOpen")

        self.actionExport = QAction(MainWindow)
        icon = QIcon(os.path.join(ICON_PATH, "Export-48.png"))
        self.actionExport.setIcon(icon)
        self.actionExport.setObjectName("actionExport")

        self.line_list_selector = QComboBox()
        self.line_list_selector.setToolTip(
            "Select line list from internal library")

        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.actionRemove = QAction(MainWindow)
        self.actionRemove.setObjectName("actionRemove")
        self.actionChange_Color = QAction(MainWindow)
        self.actionChange_Color.setObjectName("actionChange_Color")
        # self.menuFile.addAction(self.actionOpen)
        # self.menuFile.addSeparator()
        # self.menuFile.addAction(self.actionExit)
        # self.menuBar.addAction(self.menuFile.menuAction())
        self.mainToolBar.addAction(self.actionOpen)
        self.mainToolBar.addAction(self.actionExport)
        self.mainToolBar.addSeparator()
        self.mainToolBar.addWidget(self.line_list_selector)
        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
Beispiel #24
0
    def setupUi(self):
        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame = QWidget(self)
        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame = QVBoxLayout(self.windowFrame)
        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar = WindowDragger(self, self.windowFrame)
        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))

        self.hboxTitle = QHBoxLayout(self.titleBar)
        self.hboxTitle.setContentsMargins(0, 0, 0, 0)
        self.hboxTitle.setSpacing(0)

        self.lblTitle = QLabel('Title')
        self.lblTitle.setObjectName('lblTitle')
        self.lblTitle.setAlignment(Qt.AlignCenter)

        spButtons = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self.btnMinimize = QToolButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(spButtons)

        self.btnRestore = QToolButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(spButtons)

        self.btnMaximize = QToolButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(spButtons)

        self.btnClose = QToolButton(self.titleBar)
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(spButtons)

        self.vboxFrame.addWidget(self.titleBar)

        self.windowContent = QWidget(self.windowFrame)
        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        self.hboxTitle.addWidget(self.lblTitle)
        self.hboxTitle.addWidget(self.btnMinimize)
        self.hboxTitle.addWidget(self.btnRestore)
        self.hboxTitle.addWidget(self.btnMaximize)
        self.hboxTitle.addWidget(self.btnClose)

        # set window flags
        self.setWindowFlags(Qt.Window
                            | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowCloseButtonHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint)

        self.setAttribute(Qt.WA_TranslucentBackground)

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)