Beispiel #1
1
    def __init__(self):
        super(PugdebugExpressionViewer, self).__init__()

        # Action for adding a new expression
        self.add_action = QAction(QIcon.fromTheme('list-add'), "&Add", self)
        self.add_action.triggered.connect(self.handle_add_action)

        # Action for deleting selected expressions
        self.delete_action = QAction(
            QIcon.fromTheme('list-remove'),
            "&Delete", self
        )
        self.delete_action.setShortcut(QKeySequence("Del"))
        self.delete_action.triggered.connect(self.handle_delete_action)

        self.toolbar = QToolBar()
        self.toolbar.setIconSize(QSize(16, 16))
        self.toolbar.addAction(self.add_action)
        self.toolbar.addAction(self.delete_action)

        self.tree = QTreeWidget()
        self.tree.setColumnCount(3)
        self.tree.setHeaderLabels(['Expression', 'Type', 'Value'])
        self.tree.setSelectionMode(QAbstractItemView.ContiguousSelection)
        self.tree.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tree.customContextMenuRequested.connect(self.show_context_menu)

        layout = QVBoxLayout()
        layout.addWidget(self.toolbar)
        layout.addWidget(self.tree)
        self.setLayout(layout)

        self.restore_state()

        self.tree.itemChanged.connect(self.handle_item_changed)
Beispiel #2
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setDragMode(QGraphicsView.RubberBandDrag)

        self.proto_analyzer = None
        self.context_menu_item = None
        self.copied_items = []

        self.delete_action = QAction(self.tr("Delete selected items"), self)
        self.delete_action.setShortcut(QKeySequence.Delete)
        self.delete_action.triggered.connect(self.on_delete_action_triggered)
        self.delete_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.delete_action.setIcon(QIcon.fromTheme("edit-delete"))
        self.addAction(self.delete_action)

        self.select_all_action = QAction(self.tr("Select all"), self)
        self.select_all_action.setShortcut(QKeySequence.SelectAll)
        self.select_all_action.triggered.connect(self.on_select_all_action_triggered)
        self.delete_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.addAction(self.select_all_action)

        self.copy_action = QAction(self.tr("Copy selected items"), self)  # type: QAction
        self.copy_action.setShortcut(QKeySequence.Copy)
        self.copy_action.triggered.connect(self.on_copy_action_triggered)
        self.copy_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.copy_action.setIcon(QIcon.fromTheme("edit-copy"))
        self.addAction(self.copy_action)

        self.paste_action = QAction(self.tr("Paste"), self)  # type: QAction
        self.paste_action.setShortcut(QKeySequence.Paste)
        self.paste_action.triggered.connect(self.on_paste_action_triggered)
        self.paste_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.paste_action.setIcon(QIcon.fromTheme("edit-paste"))
        self.addAction(self.paste_action)
Beispiel #3
0
    def load_icons_set(self, use_light_icons: bool = False) -> None:
        """Load a given icons set (either the default one "dark", or the light one)."""
        if self.use_light_icons is use_light_icons:
            return

        suffix = ("", "_light")[use_light_icons]
        mask = str(find_icon("active.svg"))  # Icon mask for macOS
        for state in {
            "conflict",
            "disabled",
            "error",
            "idle",
            "notification",
            "paused",
            "syncing",
            "update",
        }:
            icon = QIcon()
            icon.addFile(str(find_icon(f"{state}{suffix}.svg")))
            if MAC:
                icon.addFile(mask, mode=QIcon.Selected)
            self.icons[state] = icon

        self.use_light_icons = use_light_icons
        self.manager.set_config("light_icons", use_light_icons)

        # Reload the current showed icon
        if self.icon_state:
            self.set_icon_state(self.icon_state, force=True)
    def __init__(self, project_manager, modulated_data, parent=None, testing_mode=False):
        super().__init__(project_manager, is_tx=True, parent=parent, testing_mode=testing_mode)

        self.graphics_view = self.ui.graphicsViewSend
        self.ui.stackedWidget.setCurrentWidget(self.ui.page_send)
        self.hide_receive_ui_items()

        self.ui.btnStart.setIcon(QIcon.fromTheme("media-playback-start"))
        self.setWindowTitle("Send Signal")
        self.setWindowIcon(QIcon.fromTheme("media-playback-start"))
        self.ui.btnStart.setToolTip("Send data")
        self.ui.btnStop.setToolTip("Stop sending")
        self.device_is_sending = False

        if modulated_data is not None:
            # modulated_data is none in continuous send mode
            self.ui.progressBar.setMaximum(len(modulated_data))
            samp_rate = self.ui.spinBoxSampleRate.value()
            signal = Signal.from_samples(modulated_data, "Modulated Preview", samp_rate)
            self.scene_manager = SignalSceneManager(signal, parent=self)
            self.send_indicator = self.scene_manager.scene.addRect(0, -2, 0, 4,
                                                                   QPen(QColor(Qt.transparent), Qt.FlatCap),
                                                                   QBrush(constants.SEND_INDICATOR_COLOR))
            self.send_indicator.stackBefore(self.scene_manager.scene.selection_area)
            self.scene_manager.init_scene()
            self.graphics_view.set_signal(signal)
            self.graphics_view.sample_rate = samp_rate

            self.init_device()

            self.graphics_view.setScene(self.scene_manager.scene)
            self.graphics_view.scene_manager = self.scene_manager

            self.create_connects()
Beispiel #5
0
def main(argv, simple) -> None:
    args = parse_args(argv[1:], simple)

    app = QApplication([])  # noqa: F841

    if args.list:
        for idx, path in enumerate(QIcon.themeSearchPaths()):
            for root, dirs, files in os.walk(path):
                for name in files:
                    if name.endswith(".png") or name.endswith(".svg"):
                        print(os.path.join(root, name))
    else:
        if args.ICON == []:
            print("{:>17} : {}".format("Theme", QIcon.themeName()))
            for idx, path in enumerate(QIcon.themeSearchPaths()):
                if idx == 0:
                    print("{:>17} : {!r}".format("ThemeSearchPath", path))
                else:
                    print("{:>17}   {!r}".format("", path))
        else:
            if args.mime_type:
                mimedb = QMimeDatabase()
                for mimetype in args.ICON:
                    mt = mimedb.mimeTypeForName(mimetype)
                    if mt.isValid():
                        iconname = mt.iconName()
                        print("{}: {}  {}".format(mimetype, iconname,
                                                  "OK"
                                                  if QIcon.hasThemeIcon(iconname)
                                                  else "FAILED"))
                    else:
                        print("{}: invalid mime-type".format(mimetype))
            else:
                for iconname in args.ICON:
                    print("{}: {}".format(iconname, "OK" if QIcon.hasThemeIcon(iconname) else "FAILED"))
Beispiel #6
0
def set_icon_theme():
    if sys.platform != "linux" or constants.SETTINGS.value("icon_theme_index", 0, int) == 0:
        # noinspection PyUnresolvedReferences
        import urh.ui.xtra_icons_rc
        QIcon.setThemeName("oxy")
    else:
        QIcon.setThemeName("")
    def __init__(self, config, *args, **kwargs):
        super().__init__(*args, **kwargs)
        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'tag_manage_widget.ui')
        uic.loadUi(ui_file_path, self)

        self.db_helper = DBCommandLineHelper()
        self.message_box = QMessageBox()

        self.tag_names_line_edit = TagNamesLineEdit()
        self.tag_names_line_edit.setPlaceholderText("Tag Names")
        self.cmp = None
        self.set_completer()
        self.selected_tag_names_layout.insertWidget(0, self.tag_names_line_edit)

        add_icon = QIcon()
        add_icon.addPixmap(QPixmap(config.images + '/add.png'), QIcon.Normal, QIcon.Off)
        self.new_tag_btn.setIcon(add_icon)
        self.tag_editor = None
        self.tag_list = None
        self.set_tag_list_widget()   # init data

        self.select_btn.clicked.connect(self.select_event)
        self.cancel_btn.clicked.connect(self.close)
        self.new_tag_btn.clicked.connect(self.new_tag_event)

        self.refresh_signal.connect(self.set_tag_list_widget, Qt.QueuedConnection)
Beispiel #8
0
    def __init__(self):
        self._app = QApplication([sys.argv[0]])

        from dbus.mainloop.pyqt5 import DBusQtMainLoop
        super(Magneto, self).__init__(main_loop_class = DBusQtMainLoop)

        self._window = QSystemTrayIcon(self._app)
        icon_name = self.icons.get("okay")
        self._window.setIcon(QIcon.fromTheme(icon_name))
        self._window.activated.connect(self._applet_activated)

        self._menu = QMenu(_("Magneto Entropy Updates Applet"))
        self._window.setContextMenu(self._menu)

        self._menu_items = {}
        for item in self._menu_item_list:
            if item is None:
                self._menu.addSeparator()
                continue

            myid, _unused, mytxt, myslot_func = item
            name = self.get_menu_image(myid)
            action_icon = QIcon.fromTheme(name)

            w = QAction(action_icon, mytxt, self._window,
                        triggered=myslot_func)
            self._menu_items[myid] = w
            self._menu.addAction(w)

        self._menu.hide()
    def create_context_menu(self) -> QMenu:
        menu = QMenu(self)
        index = self.model().mapToSource(self.currentIndex())  # type: QModelIndex
        if index.isValid():
            current_index_info = self.model().sourceModel().fileInfo(index)  # type: QFileInfo
            if current_index_info.isDir():
                if os.path.isfile(os.path.join(current_index_info.filePath(), constants.PROJECT_FILE)):
                    open_action = menu.addAction("Open project")
                    open_action.setIcon(QIcon(":/icons/data/icons/appicon.png"))
                else:
                    open_action = menu.addAction("Open folder")
                    open_action.setIcon(QIcon.fromTheme("folder-open"))
                open_action.triggered.connect(self.on_open_action_triggered)

        new_dir_action = menu.addAction("New folder")
        new_dir_action.setIcon(QIcon.fromTheme("folder"))
        new_dir_action.triggered.connect(self.create_directory)

        del_action = menu.addAction("Delete")
        del_action.setIcon(QIcon.fromTheme("edit-delete"))
        del_action.triggered.connect(self.remove)

        menu.addSeparator()
        open_in_explorer_action = menu.addAction("Open in file manager...")
        open_in_explorer_action.triggered.connect(self.on_open_explorer_action_triggered)

        return menu
Beispiel #10
0
 def initUI(self):
     #icon
     app_icon = QIcon()
     app_icon.addFile("key.png", QSize(256, 256))
     self.setWindowIcon(app_icon)
     #text preview
     self.Gen = self.parent.getGen()
     self.preview = QTextEdit()
     self.preview.setReadOnly(True)
     #gui elements
     pntBtn = QPushButton("Print", self)
     pntBtn.clicked.connect(self.printMKS)
     previewBtn = QPushButton("Preview", self)
     previewBtn.clicked.connect(self.previewMKS)
     #showBittings = QCheckBox("Master Bittings")
     #showTitlePage = QCheckBox("Title Page")
     showContact = QCheckBox("Contact Information")
     showContact.setEnabled(False)
     vert = QVBoxLayout()
     self.setLayout(vert)
     #vert.addWidget(showBittings)
     #vert.addWidget(showTitlePage)
     vert.addWidget(showContact)
     vert.addWidget(self.preview)
     vert.addWidget(pntBtn)
     vert.addWidget(previewBtn)
     self.setGeometry(300, 300, 290, 150)
     self.setWindowTitle('Print')
     self.formatPrint()
     self.show()
    def load(self, name, size = 128, forceCache = False):
        icon = QIcon()
        size = int(size)
        self.pixmap = QPixmap()
        if not type(name) in (list, tuple):
            name = [str(name)]
        if forceCache or self._forceCache:
            for _name in name:
                for _size in self.iconSizes:
                    if (QPixmapCache.find('$qt'+str(_name)+str(_size),
                        self.pixmap)):
                        logging.debug('Icon %s returned from cache' % _name)
                        return self.pixmap

        logging.debug('Getting icon : %s size: %s' % (','.join(name), size))
        pix = self.findIcon(name, size)
        if pix.isNull():
            for _size in self.iconSizes:
                pix = self.findIcon(name, _size)
                if not pix.isNull():
                    if size == _size:
                        return pix
                    icon.addPixmap(pix)
            if icon.isNull():
                return self.pixmap
            return icon.pixmap(QSize(size, size))
        return pix
 def __init__(self, color):
     QIcon.__init__(self)
     qcolor = QColor()
     qcolor.setNamedColor(color)
     pixmap = QPixmap(20, 20)
     pixmap.fill(qcolor)
     self.addPixmap(pixmap)
Beispiel #13
0
    def initUI(self):
        """
        initUI()
        """

        vbox = QVBoxLayout(self)
        grid1 = QGridLayout()
        grid1.setSpacing(10)

        self.text = QTextBrowser()
        self.text.setReadOnly(True)
        self.text.setOpenExternalLinks(True)
        self.text.append(self.message)
        self.text.moveCursor(QTextCursor.Start)
        self.text.ensureCursorVisible()

        vbox.addWidget(self.text)

        self.setLayout(vbox)
        self.setMinimumSize(550, 450)
        self.resize(550, 600)
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
        self.setWindowTitle(self.title)
        iconWT = QIcon()
        iconWT.addPixmap(QPixmap(":images/DXF2GCODE-001.ico"),
                         QIcon.Normal, QIcon.Off)
        self.setWindowIcon(QIcon(iconWT))

        self.exec_()
Beispiel #14
0
 def store_data(self, id, data):
     id = id.replace('/', '_')
     directory = ApplicationData.get('images')
     filename = os.path.join(directory, id + '.png')
     makedirs(directory)
     pixmap = QPixmap()
     if data is not None and pixmap.loadFromData(data):
         image_size = pixmap.size()
         if image_size.width() > self.max_size or image_size.height() > self.max_size:
             pixmap = pixmap.scaled(self.max_size, self.max_size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
         if imghdr.what(None, data) != 'png' or pixmap.size() != image_size:
             buffer = QBuffer()
             pixmap.save(buffer, 'png')
             data = str(buffer.data())
         with open(filename, 'wb') as f:
             f.write(data)
         icon = QIcon(pixmap)
         icon.filename = filename
         icon.content = data
         icon.content_type = 'image/png'
     else:
         unlink(filename)
         icon = None
     self.iconmap[id] = icon
     return icon
Beispiel #15
0
    def savePic(self):
        densityPic = ''.join([cwd,u'/bulletinTemp/',self.in_parameters[u'datetime'],u'/',
            self.in_parameters[u'target_area'],'.gdb',u'/',self.in_parameters[u'datetime'],
            self.in_parameters[u'target_area'],u'闪电密度空间分布.tif'])

        dayPic = ''.join([cwd,u'/bulletinTemp/',self.in_parameters[u'datetime'],u'/',
            self.in_parameters[u'target_area'],'.gdb',u'/',self.in_parameters[u'datetime'],
            self.in_parameters[u'target_area'],u'地闪雷暴日空间分布.tif'])

        directory = QFileDialog.getExistingDirectory(self,u'请选择图片保存位置',
                                                     u'E:/Documents/工作/雷电公报',
                                    QFileDialog.ShowDirsOnly|QFileDialog.DontResolveSymlinks)

        dest_density = os.path.join(directory,os.path.basename(densityPic))
        dest_day = os.path.join(directory,os.path.basename(dayPic))

        if os.path.isfile(dest_day) or os.path.isfile(dest_density):
            message = u"文件已经存在!"
            msgBox = QMessageBox()
            msgBox.setText(message)
            msgBox.setIcon(QMessageBox.Information)
            icon = QIcon()
            icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
            msgBox.setWindowIcon(icon)
            msgBox.setWindowTitle(" ")
            msgBox.exec_()
            return

        move(dayPic,directory)
        move(densityPic,directory)
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 10, 0, 10)
        self.layout().setSpacing(10)

        hPolicy = QSizePolicy.Ignored
        vPolicy = QSizePolicy.Expanding
        iconSize = QSize(48, 48)

        self.stopButton = QPushButton(self)
        self.stopButton.setToolTip('Stop all')
        self.stopButton.setFocusPolicy(Qt.NoFocus)
        self.stopButton.setSizePolicy(hPolicy, vPolicy)
        self.stopButton.setIcon(QIcon.fromTheme("media-playback-stop"))
        self.stopButton.setIconSize(iconSize)
        self.layout().addWidget(self.stopButton, 0, 0)

        self.pauseButton = QPushButton(self)
        self.pauseButton.setToolTip('Pause all')
        self.pauseButton.setFocusPolicy(Qt.NoFocus)
        self.pauseButton.setSizePolicy(hPolicy, vPolicy)
        self.pauseButton.setIcon(QIcon.fromTheme("media-playback-pause"))
        self.pauseButton.setIconSize(iconSize)
        self.layout().addWidget(self.pauseButton, 0, 1)

        self.restartButton = QPushButton(self)
        self.restartButton.setToolTip('Restart all')
        self.restartButton.setFocusPolicy(Qt.NoFocus)
        self.restartButton.setSizePolicy(hPolicy, vPolicy)
        self.restartButton.setIcon(QIcon.fromTheme("media-playback-start"))
        self.restartButton.setIconSize(iconSize)
        self.layout().addWidget(self.restartButton, 0, 2)
Beispiel #17
0
 def store_file(self, id, file):
     id = id.replace('/', '_')
     directory = ApplicationData.get('images')
     filename = os.path.join(directory, id + '.png')
     if filename == os.path.normpath(file):
         return self.iconmap.get(id, None)
     makedirs(directory)
     pixmap = QPixmap()
     if file is not None and pixmap.load(file):
         if pixmap.size().width() > self.max_size or pixmap.size().height() > self.max_size:
             pixmap = pixmap.scaled(self.max_size, self.max_size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
         buffer = QBuffer()
         pixmap.save(buffer, 'png')
         data = str(buffer.data())
         with open(filename, 'wb') as f:
             f.write(data)
         icon = QIcon(pixmap)
         icon.filename = filename
         icon.content = data
         icon.content_type = 'image/png'
     else:
         unlink(filename)
         icon = None
     self.iconmap[id] = icon
     return icon
Beispiel #18
0
 def run_case(self, devices):
     kw_case_list = []
     if not self.cases:
         return
     for case_id in self.cases:
         kw_case = KWCase()
         case = self.dBCommandLineHelper.query_case_by_id(case_id)
         kw_case.id = case.id
         kw_case.name = case.name
         kw_case.content = case.content
         kw_case.data = case.data
         kw_case_list.append(kw_case)
     # set icon
     stop_icon = QIcon()
     stop_icon.addPixmap(QPixmap(self.config.images + '/stop.png'), QIcon.Normal, QIcon.Off)
     self.run_stop_btn.setIcon(stop_icon)
     self.run_stop_btn.setText("Stop")
     self.running = True
     if not devices:
         return
     try:
         self.tester.select_devices(devices)
         self.tester.run(kw_case_list)
     except Exception as e:
         self.stop_case()
         self.add_log(str(e))
Beispiel #19
0
 def make_toolbar(self, list_of_actions=None):
     """Make or Update the main Tool Bar."""
     self.toolbar = QToolBar(self)
     self.left_spacer, self.right_spacer = QWidget(self), QWidget(self)
     self.left_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.right_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.toolbar.addAction("Menu",
                            lambda: self.menubar.exec_(QCursor.pos()))
     self.toolbar.addWidget(self.left_spacer)
     self.toolbar.addSeparator()
     self.toolbar.addAction(QIcon.fromTheme("help-contents"),
                            "Help and Docs", lambda: open_new_tab(__url__))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Qt 5",
                            lambda: QMessageBox.aboutQt(self))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Python 3",
                            lambda: open_new_tab('http://python.org/about'))
     self.toolbar.addAction(QIcon.fromTheme("application-exit"),
                            "Quit", self.close)
     self.toolbar.addSeparator()
     if list_of_actions and len(list_of_actions):
         for action in list_of_actions:  # if list_of_actions, add actions.
             self.toolbar.addAction(action)
         self.toolbar.addSeparator()
     self.toolbar.addWidget(self.right_spacer)
     self.addToolBar(self.toolbar)
     if sys.platform.startswith("win"):
         self.toolbar.hide()  # windows dont have QIcon.fromTheme,so hide.
     return self.toolbar
    def __init__(self, parent=None):
        super().__init__(parent)

        self.zoom_in_action = QAction(self.tr("Zoom in"), self)
        self.zoom_in_action.setShortcut(QKeySequence.ZoomIn)
        self.zoom_in_action.triggered.connect(self.on_zoom_in_action_triggered)
        self.zoom_in_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.zoom_in_action.setIcon(QIcon.fromTheme("zoom-in"))
        self.addAction(self.zoom_in_action)

        self.zoom_out_action = QAction(self.tr("Zoom out"), self)
        self.zoom_out_action.setShortcut(QKeySequence.ZoomOut)
        self.zoom_out_action.triggered.connect(self.on_zoom_out_action_triggered)
        self.zoom_out_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.zoom_out_action.setIcon(QIcon.fromTheme("zoom-out"))
        self.addAction(self.zoom_out_action)

        self.redraw_timer = QTimer()
        self.redraw_timer.setSingleShot(True)
        self.redraw_timer.timeout.connect(self.redraw_view)

        self.zoomed.connect(self.on_signal_zoomed)

        self.scene_y_min = float("nan")  # NaN = AutoDetect
        self.scene_y_max = float("nan")  # NaN = AutoDetect

        self.scene_x_zoom_stretch = 1
Beispiel #21
0
 def set_icons(self):
     self.ui.add_question_type_button.setIcon(
         QIcon.fromTheme(
             'list-add',
             QIcon(':/icons/list-add.svg')
         )
     )
     self.ui.remove_question_type_button.setIcon(
         QIcon.fromTheme(
             'list-remove',
             QIcon(':/icons/list-remove.svg')
         )
     )
     self.ui.move_up_question_type_button.setIcon(
         QIcon.fromTheme(
             'go-up',
             QIcon(':/icons/go-up.svg')
         )
     )
     self.ui.move_down_question_type_button.setIcon(
         QIcon.fromTheme(
             'go-down',
             QIcon(':/icons/go-down.svg')
         )
     )
Beispiel #22
0
    def optionsAccepted(self, id):
        if id == self.otherId:

            #MouseWidget
            self.page(1).execute()
            #ThemeWidget
            self.page(2).execute()
            #MenuWidget
            self.page(3).execute()
            #WallpaperWidget
            self.page(4).execute()
            #AvatarWidget
            self.page(5).execute()


            p = QProcess()
            p.startDetached("kquitapp5 plasmashell")
            p.waitForStarted(2000)
            p.startDetached("plasmashell")

        if id == self.sumId:
            self.setButtonText(QWizard.NextButton, self.tr("Apply Settings"))
            self.button(QWizard.NextButton).setIcon(QIcon.fromTheme("dialog-ok-apply"))
            self.summaryVisible.emit()
        else:
            self.setButtonText(QWizard.NextButton, self.tr("Next"))
            self.button(QWizard.NextButton).setIcon(QIcon.fromTheme("arrow-right"))
Beispiel #23
0
    def changeIcon(self):
        icon = QIcon()

        for row in range(self.imagesTable.rowCount()):
            item0 = self.imagesTable.item(row, 0)
            item1 = self.imagesTable.item(row, 1)
            item2 = self.imagesTable.item(row, 2)

            if item0.checkState() == Qt.Checked:
                if item1.text() == "Normal":
                    mode = QIcon.Normal
                elif item1.text() == "Active":
                    mode = QIcon.Active
                elif item1.text() == "Disabled":
                    mode = QIcon.Disabled
                else:
                    mode = QIcon.Selected

                if item2.text() == "On":
                    state = QIcon.On
                else:
                    state = QIcon.Off

                fileName = item0.data(Qt.UserRole)
                image = QImage(fileName)
                if not image.isNull():
                    icon.addPixmap(QPixmap.fromImage(image), mode, state)

        self.previewArea.setIcon(icon)
Beispiel #24
0
    def data(self, column, role=Qt.DisplayRole):

        data = abstractItem.data(self, column, role)
        E = self.enum

        if role == Qt.DisplayRole or role == Qt.EditRole:
            if data == "" and column == E.revisions:
                return []

            else:
                return data

        elif role == Qt.DecorationRole and column == E.title:
            if self.customIcon():
                return QIcon.fromTheme(self.data(E.customIcon))
            if self.isFolder():
                return QIcon.fromTheme("folder")
            elif self.isText():
                return QIcon.fromTheme("text-x-generic")

        elif role == Qt.CheckStateRole and column == E.compile:
            return Qt.Checked if self.compile() else Qt.Unchecked

        elif role == Qt.FontRole:
            f = QFont()
            if column == E.wordCount and self.isFolder():
                f.setItalic(True)
            elif column == E.goal and self.isFolder() and not self.data(E.setGoal):
                f.setItalic(True)
            if self.isFolder():
                f.setBold(True)
            return f
Beispiel #25
0
    def create_context_menu(self):
        menu = QMenu()
        menu.setToolTipsVisible(True)
        self._add_zoom_actions_to_menu(menu)

        if self.something_is_selected:
            filter_bw = Filter.read_configured_filter_bw()
            text = self.tr("Apply bandpass filter (filter bw={0:n})".format(filter_bw))
            create_from_frequency_selection = menu.addAction(text)
            create_from_frequency_selection.triggered.connect(self.on_create_from_frequency_selection_triggered)
            create_from_frequency_selection.setIcon(QIcon.fromTheme("view-filter"))

            try:
                cancel_button = " or ".join(k.toString() for k in QKeySequence.keyBindings(QKeySequence.Cancel))
            except Exception as e:
                logger.debug("Error reading cancel button: " + str(e))
                cancel_button = "Esc"

            create_from_frequency_selection.setToolTip("You can abort filtering with <b>{}</b>.".format(cancel_button))

        configure_filter_bw = menu.addAction(self.tr("Configure filter bandwidth..."))
        configure_filter_bw.triggered.connect(self.on_configure_filter_bw_triggered)
        configure_filter_bw.setIcon(QIcon.fromTheme("configure"))

        menu.addSeparator()

        export_fta_action = menu.addAction("Export spectrogram...")
        export_fta_action.triggered.connect(self.on_export_fta_action_triggered)

        return menu
Beispiel #26
0
    def create_context_menu(self) -> QMenu:
        menu = QMenu()
        if self.context_menu_pos is None:
            return menu

        selected_label_index = self.model().get_selected_label_index(row=self.rowAt(self.context_menu_pos.y()),
                                                                     column=self.columnAt(self.context_menu_pos.x()))

        if self.model().row_count > 0:
            if selected_label_index == -1:
                label_action = menu.addAction("Create label...")
                label_action.setIcon(QIcon.fromTheme("list-add"))
            else:
                label_action = menu.addAction("Edit label...")
                label_action.setIcon(QIcon.fromTheme("configure"))

            label_action.triggered.connect(self.on_create_or_edit_label_action_triggered)
            menu.addSeparator()

            zoom_menu = menu.addMenu("Zoom font size")
            zoom_menu.addAction(self.zoom_in_action)
            zoom_menu.addAction(self.zoom_out_action)
            zoom_menu.addAction(self.zoom_original_action)
            menu.addSeparator()

        return menu
Beispiel #27
0
 def __init__ (self, parent):
     super().__init__(parent)
     self.search = SearchWidget(self)
     self.search.searched.connect(self.populatelist)
     
     self.nodelist = QListWidget(self)
     self.nodelist.setSortingEnabled(True)
     self.nodelist.setIconSize(QSize(*(FlGlob.mainwindow.style.boldheight,)*2))
     self.nodelist.currentItemChanged.connect(self.selectnode)
     self.nodelist.itemSelectionChanged.connect(self.onselectionchange)
     self.nodelist.itemActivated.connect(self.activatenode)
     self.nodelist.setSelectionMode(QAbstractItemView.ExtendedSelection)
     
     remwidget = QToolBar(self)
     remselected = QAction("Remove Selected", self)
     remselected.setIcon(QIcon.fromTheme("edit-delete"))
     remselected.setToolTip("Remove selected")
     remselected.triggered.connect(self.remselected)
     self.remselaction = remselected
     remtrash = QAction("Remove Trash", self)
     remtrash.setIcon(QIcon.fromTheme("edit-clear"))
     remtrash.setToolTip("Clear all trash")
     remtrash.triggered.connect(self.remtrash)
     self.remtrashaction = remtrash
     remwidget.addAction(remselected)
     remwidget.addAction(remtrash)
     
     layout = QVBoxLayout(self)
     layout.addWidget(self.search)
     layout.addWidget(self.nodelist)
     layout.addWidget(remwidget)
     self.view = None
     self.active = False
     self.setEnabled(False)
Beispiel #28
0
    def initUI(self):
        self.setWindowTitle('Twitter Client')
        self.setWindowIcon(QIcon("twitter.svg"))
        QIcon.setThemeName("Adwaita")

        lay = QVBoxLayout(self)
        scr = QScrollArea(self)
        scr.setWidgetResizable(True)
        scr.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

        lay2 = QVBoxLayout()
        self.setLayout(lay)
        placehold = QWidget()
        lay.addWidget(scr)
        scr.setWidget(placehold)
        placehold.setLayout(lay2)
        self.lay = lay2

        lay2.setSpacing(0)
        lay.setSpacing(0)
        lay.setContentsMargins(0, 0, 0, 0)

        but = QPushButton("Refresh")
        lay.addWidget(but)
        but.pressed.connect(self.fetch_tweets)

        self.show()
Beispiel #29
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.participants = []
        self.__sample_rate = None  # For default sample rate in insert sine dialog
        self.protocol = None  # gets overwritten in epic graphic view

        self.autoRangeY = True
        self.save_enabled = False  # Signal is can be saved
        self.create_new_signal_enabled = False
        self.participants_assign_enabled = False
        self.cache_qad = False  # cache qad demod after edit operations?

        self.__signal = None  # type: Signal

        self.stored_item = None  # For copy/paste
        self.paste_position = 0  # Where to paste? Set in contextmenuevent

        self.init_undo_stack(QUndoStack())

        self.addAction(self.undo_action)
        self.addAction(self.redo_action)

        self.copy_action = QAction(self.tr("Copy selection"), self)  # type: QAction
        self.copy_action.setShortcut(QKeySequence.Copy)
        self.copy_action.triggered.connect(self.on_copy_action_triggered)
        self.copy_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.copy_action.setIcon(QIcon.fromTheme("edit-copy"))
        self.addAction(self.copy_action)

        self.paste_action = QAction(self.tr("Paste"), self)  # type: QAction
        self.paste_action.setShortcut(QKeySequence.Paste)
        self.paste_action.triggered.connect(self.on_paste_action_triggered)
        self.paste_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.paste_action.setIcon(QIcon.fromTheme("edit-paste"))
        self.addAction(self.paste_action)

        self.delete_action = QAction(self.tr("Delete selection"), self)
        self.delete_action.setShortcut(QKeySequence.Delete)
        self.delete_action.triggered.connect(self.on_delete_action_triggered)
        self.delete_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.delete_action.setIcon(QIcon.fromTheme("edit-delete"))
        self.addAction(self.delete_action)

        self.save_as_action = QAction(self.tr("Save Signal as..."), self)  # type: QAction
        self.save_as_action.setIcon(QIcon.fromTheme("document-save-as"))
        self.save_as_action.setShortcut(QKeySequence.SaveAs)
        self.save_as_action.triggered.connect(self.save_as_clicked.emit)
        self.save_as_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        self.addAction(self.save_as_action)

        self.insert_sine_action = QAction(self.tr("Insert sine wave..."), self)
        font = self.insert_sine_action.font()
        font.setBold(True)
        self.insert_sine_action.setFont(font)
        self.insert_sine_action.triggered.connect(self.on_insert_sine_action_triggered)

        self.insert_sine_plugin = InsertSinePlugin()
        self.insert_sine_plugin.insert_sine_wave_clicked.connect(self.on_insert_sine_wave_clicked)
Beispiel #30
0
def icon_from_theme(theme_name, icon_name):
    QIcon.setThemeSearchPaths([os.path.join(HOME_DIR, ".icons"),
        os.path.join(HOME_DIR, ".local/share/icons"),
        "/usr/local/share/icons",
        "/usr/share/icons",
        ":/icons"])
    QIcon.setThemeName(theme_name)
    return QIcon.fromTheme(icon_name)
Beispiel #31
0
    def initUI(self):
        self.setWindowTitle(self._company + ' - ' + 'Multi Items Creator Window')
        self.setWindowIcon(QIcon(Constants.BASE_PATH + '/img/daesung.ico'))

        lblAssetName = QLabel('자산명')
        lblProdDate = QLabel('제조일')
        lblReceiptDate = QLabel('입고일')
        lblMgrClass = QLabel('관리부문')
        lblMSOffice = QLabel('MS Office')
        lblHancomOffice = QLabel('한컴 Office')
        lblDisk = QLabel('디스크')
        lblMem = QLabel('메모리')
        lblAcctNum = QLabel('회계관리번호')
        lblBarcode = QLabel('바코드')
        lblAssetNote = QLabel('비고')

        cmbAssetName = QComboBox()
        self._dateProd = QDateEdit()
        self._dateProd.setFixedWidth(150)
        self._dateReceipt = QDateEdit()
        self._dateReceipt.setFixedWidth(150)
        cmbMgrClass = QComboBox()
        cmbDisk = QComboBox()
        cmbMem = QComboBox()
        cmbMSOffice = QComboBox()
        cmbHancomOffice = QComboBox()
        txtAcctNum = QLineEdit()
        txtBarcode = QLineEdit()
        txtAssetNote = QLineEdit()

        # 일련번호 추가/삭제는 Enter key, Delete key, Copy&Paste로 제어
        serialNumBox = QGroupBox('일련번호')
        serialNumLayout = QVBoxLayout()
        self._serialNumItem = QLineEdit()
        self._serialNumList = QListWidget()
        serialNumLayout.addWidget(self._serialNumItem)
        serialNumLayout.addWidget(self._serialNumList)
        serialNumBox.setLayout(serialNumLayout)
        serialNumBox.setFixedWidth(200)

        inputLayout = QGridLayout()
        inputLayout.addWidget(lblAssetName, 0, 0)
        inputLayout.addWidget(cmbAssetName, 0, 1)
        inputLayout.addWidget(lblMgrClass, 0, 2)
        inputLayout.addWidget(cmbMgrClass, 0, 3)
        inputLayout.addWidget(lblProdDate, 1, 0)
        inputLayout.addWidget(self._dateProd, 1, 1)
        inputLayout.addWidget(lblReceiptDate, 1, 2)
        inputLayout.addWidget(self._dateReceipt, 1, 3)
        inputLayout.addWidget(lblMem, 2, 0)
        inputLayout.addWidget(cmbMem, 2, 1)
        inputLayout.addWidget(lblDisk, 2, 2)
        inputLayout.addWidget(cmbDisk, 2, 3)
        inputLayout.addWidget(lblMSOffice, 3, 0)
        inputLayout.addWidget(cmbMSOffice, 3, 1)
        inputLayout.addWidget(lblHancomOffice, 3, 2)
        inputLayout.addWidget(cmbHancomOffice, 3, 3)
        inputLayout.addWidget(lblAcctNum, 4, 0)
        inputLayout.addWidget(txtAcctNum, 4, 1)
        inputLayout.addWidget(lblBarcode, 4, 2)
        inputLayout.addWidget(txtBarcode, 4, 3)
        inputLayout.addWidget(lblAssetNote, 5, 0)
        inputLayout.addWidget(txtAssetNote, 5, 1, 1, 3)
        inputLayout.addWidget(serialNumBox, 0, 4, 6, 1)

        winLayout = QVBoxLayout()
        # winLayout.addWidget(serialNumBox)
        winLayout.addLayout(inputLayout)
        self.setLayout(winLayout)
Beispiel #32
0
 def __init__(self, main_window):
     main_window.update_form = QDialog()
     main_window.update_form.setWindowTitle('Update Rebel Info')
     main_window.update_form.setWindowIcon(QIcon('image/logo.png'))
     self.main_window = main_window
     self.initUI(main_window)
Beispiel #33
0
        msg = """
        使用说明书:
        
        1) .dcm后缀添加与撤销:
            添加步骤:菜单->选择文件/文件夹->添加.dcm后缀
            撤销步骤:添加结束后未关闭此软件时,可有一次撤销处理
        
        2) 匿名化与反匿名化处理:
            匿名化:菜单->秘钥->输入自定义加密字符串->主页面->选择匿名处理项->点击匿名按钮
            反匿名化: 解密编码部分有问题,当前版本暂不支持
            
        3)注意:
            当前版本匿名化为对称加密算法的处理,一定要保管好加解密字符串,以防泄露或者用于后续反匿名化操作
            撤销.dcm 后缀的添加,只有上一个操作步骤为添加.dcm 后缀,且软件未关闭时有效
            
            copyright@泰戈尔, 2021
        """
        QMessageBox.information(self, "关于", msg,
                                QMessageBox.Yes | QMessageBox.No,
                                QMessageBox.Yes)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    iconPath = os.path.join(os.path.dirname(sys.modules[__name__].__file__),
                            'dicomhelper.icns')
    app.setWindowIcon(QIcon(iconPath))
    win = Main()
    win.setWindowTitle("嘎嘣的DICOM小助手🍒")
    win.show()
    sys.exit(app.exec_())
Beispiel #34
0
    def initUI(self):
        # Initialize basic window options.
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        # Center the window.
        qtRectangle = self.frameGeometry()
        centerPoint = QDesktopWidget().availableGeometry().center()
        qtRectangle.moveCenter(centerPoint)
        self.move(qtRectangle.topLeft())

        # Creates a menu bar, (file, edit, options, etc...)
        mainMenu = self.menuBar()

        # Menus for window.
        fileMenu = mainMenu.addMenu('File')
        editMenu = mainMenu.addMenu('Edit')
        viewMenu = mainMenu.addMenu('View')
        helpMenu = mainMenu.addMenu('Help')

        # FILE MENU ---------------------------------------

        # Open button.
        openButton = QAction(QIcon(), 'Open', self)
        openButton.setShortcut('Ctrl+O')
        openButton.setStatusTip('Open file')
        openButton.triggered.connect(self.openFile)

        # Save button.
        saveButton = QAction(QIcon(), 'Save', self)
        saveButton.setShortcut('Ctrl+S')
        saveButton.setStatusTip('Open file')
        saveButton.triggered.connect(self.saveFile)

        # Optional exit stuff.
        exitButton = QAction(QIcon(), 'Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.setStatusTip('Exit application')
        exitButton.triggered.connect(self.close)

        fileMenu.addAction(openButton)
        fileMenu.addAction(saveButton)
        fileMenu.addAction(exitButton)

        # EDIT MENU ---------------------------------------

        # Jump to Offset
        offsetButton = QAction(QIcon(), 'Jump to Offset', self)
        offsetButton.setShortcut('Ctrl+J')
        offsetButton.setStatusTip('Jump to Offset')
        offsetButton.triggered.connect(self.offsetJump)

        editMenu.addAction(offsetButton)

        # Creating a widget for the central widget thingy.
        centralWidget = QWidget()
        centralWidget.setLayout(self.createMainView())

        self.setCentralWidget(centralWidget)

        # Show our masterpiece.
        self.show()
Beispiel #35
0
 def initUI(self):
     self.setWindowTitle('ARAF')
     self.setWindowIcon(QIcon('raspi.png'))
     self.show()
Beispiel #36
0
	def __init__(self,lgser,Mainwindow):
		self.lg=lgser
		file_read = read.Read()
		self.file_data = list()
		self.verticalLayoutWidget = QtWidgets.QWidget(lgser.centralwidget)
		self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 0, 620, 21))
		self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
		self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
		self.verticalLayout.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout.setObjectName("verticalLayout")
		self.lineEdit = QtWidgets.QLineEdit(self.verticalLayoutWidget)
		self.lineEdit.setObjectName("lineEdit")
		self.verticalLayout.addWidget(self.lineEdit)
		self.lineEdit.setPlaceholderText(str(os.getcwd()))
		#button_dir
		# self.verticalLayoutWidget_4 = QtWidgets.QWidget(lgser.centralwidget)
		# self.verticalLayoutWidget_4.setGeometry(QtCore.QRect(640, 0, 21, 21))
		# self.verticalLayoutWidget_4.setObjectName("verticalLayoutWidget_4")
		# self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_4)
		# self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
		# self.verticalLayout_4.setObjectName("verticalLayout_4")
		self.pushButton = QtWidgets.QPushButton(lgser.centralwidget)
		self.pushButton.setGeometry(640, 0, 21, 21)
		self.pushButton.setObjectName("pushButton")
		self.pushButton.setIcon(QIcon("open.png")) 
		self.pushButton.setFlat(True)
		self.pushButton.clicked.connect(lambda:self.change_workdir(Mainwindow))
		#button_readfile
		# self.verticalLayoutWidget_5 = QtWidgets.QWidget(lgser.centralwidget)
		# self.verticalLayoutWidget_5.setGeometry(QtCore.QRect(670, 0, 21, 21))
		# self.verticalLayoutWidget_5.setObjectName("verticalLayoutWidget_5")
		# self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_5)
		# self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
		# self.verticalLayout_5.setObjectName("verticalLayout_5")
		self.pushButton2 = QtWidgets.QPushButton(lgser.centralwidget)
		self.pushButton2.setGeometry(670, 0, 21, 21)
		self.pushButton2.setObjectName("pushButton2")
		self.pushButton2.setIcon(QIcon("preview.png")) 
		self.pushButton2.setFlat(True)
		self.pushButton2.clicked.connect(lambda:self.read_file(Mainwindow,file_read))
		#button3_readdata
		# self.verticalLayoutWidget_9 = QtWidgets.QWidget(lgser.centralwidget)
		# self.verticalLayoutWidget_9.setGeometry(QtCore.QRect(10, 30, 190, 130))
		# self.verticalLayoutWidget_9.setMaximumSize(370, 150)
		# self.verticalLayoutWidget_9.setObjectName("verticalLayoutWidget_9")
		# self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_9)
		# self.verticalLayout_9.setContentsMargins(0, 0, 0, 0)
		# self.verticalLayout_9.setObjectName("verticalLayout_9")
		self.pushButton3 = QtWidgets.QPushButton(lgser.centralwidget)
		self.pushButton3.setGeometry(10, 30, 90, 30)
		self.pushButton3.setObjectName("pushButton3")
		self.pushButton3.setIcon(QIcon("file.png")) 
		self.pushButton3.setFlat(True)
		self.pushButton3.clicked.connect(self.read_data)
		self.pushButton3.show()
		#button4_clear
		# self.verticalLayoutWidget_11 = QtWidgets.QWidget(lgser.centralwidget)
		# self.verticalLayoutWidget_11.setGeometry(QtCore.QRect(110, 30, 190, 130))
		# self.verticalLayoutWidget_11.setObjectName("verticalLayoutWidget_11")
		# self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_11)
		# self.verticalLayout_11.setContentsMargins(0, 0, 0, 0)
		# self.verticalLayout_11.setObjectName("verticalLayout_11")
		self.pushButton4 = QtWidgets.QPushButton(lgser.centralwidget)
		self.pushButton4.setGeometry(110, 30, 90, 30)
		self.pushButton4.setObjectName("pushButton3")
		self.pushButton4.setIcon(QIcon("clear.png")) 
		self.pushButton4.setFlat(True)
		self.pushButton4.clicked.connect(self.clear_data)
		#############filelist system#############
		self.verticalLayoutWidget_10 = QtWidgets.QWidget(lgser.centralwidget)
		self.verticalLayoutWidget_10.setGeometry(QtCore.QRect(10, 70, 190, 370))
		self.verticalLayoutWidget_10.setObjectName("verticalLayoutWidget_10")
		self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_10)
		self.verticalLayout_10.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout_10.setObjectName("verticalLayout_10")
		self.tabWidget = QtWidgets.QTabWidget(self.verticalLayoutWidget_10)
		self.tabWidget.setTabPosition(QTabWidget.West)
		self.tabWidget.setObjectName("tabWidget")
		self.verticalLayout_10.addWidget(self.tabWidget)
Beispiel #37
0
def makeIconButton(parent, icon, text):
    button = QPushButton(parent)
    button.setIcon(QIcon("Assets/{}.svg".format(icon)))
    button.setIconSize(QSize(24, 24))
    button.setToolTip(text)
    return button
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/IndicadoresGeosaude/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
    def initUI(self):

        self.setWindowTitle('Icon')
        self.setWindowIcon(QIcon('web.png'))
        self.setGeometry(300, 300, 300, 200)
        self.show()
Beispiel #40
0
def main():
    t = time.time()
    if GENERATE_UI and not hasattr(sys, 'frozen'):
        try:
            autohacker_dir = os.path.abspath(
                os.path.join(os.path.dirname(sys.argv[0]), "..", ".."))
            sys.path.append(autohacker_dir)
            sys.path.append(os.path.join(autohacker_dir, "src"))

            import generate_ui

            generate_ui.gen()  # Im Release rausnehmen

            print("Time for generating UI: %.2f seconds" % (time.time() - t),
                  file=sys.stderr)
        except (ImportError, FileNotFoundError):
            print(
                "Will not regenerate UI, because script cant be found. This is okay in "
                "release.",
                file=sys.stderr)

    urh_exe = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
    urh_exe = os.readlink(urh_exe) if os.path.islink(urh_exe) else urh_exe

    urh_dir = os.path.join(os.path.dirname(urh_exe), "..", "..")
    prefix = os.path.abspath(os.path.normpath(urh_dir))

    src_dir = os.path.join(prefix, "src")
    if os.path.exists(src_dir) and not prefix.startswith("/usr") \
            and not re.match(r"(?i)c:\\program", prefix):
        # Started locally, not installed
        print("Using modules from {0}".format(src_dir), file=sys.stderr)
        sys.path.insert(0, src_dir)

    try:
        import urh.cythonext.signalFunctions
        import urh.cythonext.path_creator
        import urh.cythonext.util
    except ImportError:
        print("Could not find C++ extensions, trying to build them.",
              file=sys.stderr)
        old_dir = os.curdir
        os.chdir(os.path.join(src_dir, "urh", "cythonext"))

        from urh.cythonext import build
        build.main()

        os.chdir(old_dir)

    from urh.controller.MainController import MainController
    from urh import constants

    if constants.SETTINGS.value("use_fallback_theme", False, bool):
        os.environ['QT_QPA_PLATFORMTHEME'] = 'fusion'

    app = QApplication(sys.argv)

    # noinspection PyUnresolvedReferences
    import urh.ui.xtra_icons_rc  # Use oxy theme always
    QIcon.setThemeName("oxy")

    constants.SETTINGS.setValue("default_theme",
                                QApplication.style().objectName())

    if constants.SETTINGS.value("use_fallback_theme", False, bool):
        QApplication.setStyle(QStyleFactory.create("Fusion"))

    mainwindow = MainController()
    mainwindow.showMaximized()
    #mainwindow.setFixedSize(1920, 1080 - 30)  # Youtube

    # Systemfarben als Zeichenfarbe setzen
    widget = QWidget()
    bgcolor = widget.palette().color(QPalette.Background)
    fgcolor = widget.palette().color(QPalette.Foreground)
    selection_color = widget.palette().color(QPalette.Highlight)
    constants.BGCOLOR = bgcolor
    constants.LINECOLOR = fgcolor
    constants.SELECTION_COLOR = selection_color

    if "autoclose" in sys.argv[1:]:
        # Autoclose after 1 second, this is useful for automated testing
        timer = QTimer()
        timer.timeout.connect(app.quit)
        timer.start(1000)

    os._exit(app.exec_(
    ))  # sys.exit() is not enough on Windows and will result in crash on exit
    def initWidgets(self):
        """
            Sets parameters for all widgets
        """
        global mainFont, colors, postfixPrice
        font = QFont(mainFont)
        font.setBold(False)
        color0 = colors[0]
        color1 = colors[1]
        color2 = colors[2]
        color3 = colors[3]

        self.setFixedSize(440, 600)
        self.setStyleSheet('background-color: {0};'.format(color1))
        self.setWindowTitle('Добавить продукт')
        self.setWindowIcon(QIcon('images/edit_icon.png'))

        # comboBox for selecting the group of entered product
        font.setBold(False)
        font.setPointSize(12)
        self.groupBox.setFont(font)
        self.groupBox.setObjectName('groupBox')
        self.groupBox.setStyleSheet('background-color: {0};'
                                    'border: 2px solid black;'
                                    'border-radius: 3;'.format(color3)
                                    )
        self.groupBox.setFixedHeight(22)
        self.groupBox.currentIndexChanged.connect(self.groupChanged)

        # label over the groupBox
        font.setBold(False)
        font.setPointSize(14)
        self.groupLabel.setFont(font)
        self.groupLabel.setObjectName('groupLabel')
        self.groupLabel.setFixedHeight(22)
        self.groupLabel.setAlignment(Qt.AlignCenter)
        self.groupLabel.setText('группа')

        # field for input the product name
        font.setBold(False)
        font.setPointSize(12)
        self.nameInput.setFont(font)
        self.nameInput.setObjectName('nameInput')
        self.nameInput.setStyleSheet('background-color: {0};'
                                     'border: 2px solid black;'
                                     'border-radius: 3;'.format(color3)
                                     )
        self.nameInput.setFixedHeight(22)
        self.nameInput.setPlaceholderText('имя')
        self.nameInput.setAlignment(Qt.AlignCenter)
        self.nameInput.setMaxLength(30)
        self.nameInput.textChanged.connect(self.nameChanged)

        # label over the nameLabel
        font.setBold(False)
        font.setPointSize(14)
        self.nameLabel.setFont(font)
        self.nameLabel.setObjectName('nameLabel')
        self.nameLabel.setAlignment(Qt.AlignCenter)
        self.nameLabel.setText('продукт')
        self.nameLabel.setFixedHeight(22)

        # field to input the product price
        font.setBold(False)
        font.setPointSize(14)
        self.priceInput.setFont(font)
        self.priceInput.setObjectName('priceInput')
        self.priceInput.setAlignment(Qt.AlignCenter)
        self.priceInput.setStyleSheet('background-color: {0};'
                                      'border: 2px solid black;'
                                      'border-radius: 3;'.format(color3)
                                      )
        self.priceInput.setFixedSize(120, 32)
        self.priceInput.setMaxLength(4)
        self.priceInput.setPlaceholderText(postfixPrice)
        self.priceInput.textChanged.connect(self.priceChanged)

        # label over the priceInput
        font.setBold(False)
        font.setPointSize(14)
        self.priceLabel.setFont(font)
        self.priceLabel.setObjectName('priceLabel')
        self.priceLabel.setAlignment(Qt.AlignCenter)
        self.priceLabel.setText('цена')
        self.priceLabel.setFixedSize(120, 32)

        # button to add the product to the product table
        font.setBold(False)
        font.setPointSize(11)
        self.addButton.setFont(font)
        self.addButton.setObjectName('addButton')
        self.addButton.setStyleSheet('background-color: ' + color0 + ';')
        self.addButton.setText('добавить')
        self.addButton.setFixedSize(120, 40)
        self.addButton.clicked.connect(self.addProduct)

        # table of added products
        font.setBold(False)
        font.setPointSize(13)
        self.productTable.setFont(font)
        self.productTable.setObjectName('productTable')
        self.productTable.setStyleSheet('background-color:' + color3 + ';')
        self.productTable.setColumnCount(3)
        self.productTable.setHorizontalHeaderLabels(['продукт', 'цена', ' '])
        self.productTable.verticalHeader().setVisible(False)
        self.productTable.setColumnWidth(0, 180)
        self.productTable.setColumnWidth(1, 160)
        header = self.productTable.horizontalHeader()
        header.setFont(font)
        header.setStyleSheet('::section{Background-color:' + color2 + '}')
        header.setSectionResizeMode(0, QHeaderView.Fixed)
        header.setSectionResizeMode(1, QHeaderView.Fixed)
        header.setSectionResizeMode(2, QHeaderView.Stretch)
        self.productTable.setSelectionMode(QAbstractItemView.NoSelection)
        self.productTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
Beispiel #42
0
    def __init__(self,
                 muscle_segmentation_window,
                 activate_registration=True,
                 activate_radiomics=True):
        super(ToolboxWindow, self).__init__()
        self.setupUi(self)

        self.state_buttons_dict = {
            self.addpaint_button: self.ADD_STATE,
            self.removeerase_button: self.REMOVE_STATE,
            self.translateContour_button: self.TRANSLATE_STATE,
            self.rotateContour_button: self.ROTATE_STATE
        }

        self.muscle_segmentation_window = muscle_segmentation_window

        self.setWindowFlag(Qt.WindowCloseButtonHint, False)

        if platform.system() == 'Darwin':
            self.menubar.setNativeMenuBar(
                False)  # native menu bar behaves weirdly in Mac OS
            icon = QIcon()
            icon.addPixmap(
                QPixmap(os.path.join(UI_PATH, 'images', 'circle.png')),
                QIcon.Normal, QIcon.Off)
            self.circlebrush_button.setIcon(icon)
            icon1 = QIcon()
            icon1.addPixmap(
                QPixmap(os.path.join(UI_PATH, 'images', 'square.png')),
                QIcon.Normal, QIcon.Off)
            self.squarebrush_button.setIcon(icon1)
            self.setWindowFlag(Qt.CustomizeWindowHint, True)

        self.setWindowTitle("Segmentation Toolbox")
        self.splashWidget.setVisible(False)
        self.all_rois = {}
        self.current_roi = ""
        self.current_subroi = 0
        self.suppress_roi_change_emit = False
        self.valid_roi_selected = False
        self.roi_combo.currentTextChanged.connect(self.send_roi_changed)
        self.roi_combo.currentTextChanged.connect(self.repopulate_subrois)
        self.subroi_combo.currentTextChanged.connect(self.send_roi_changed)
        self.roi_add_button.clicked.connect(self.add_roi)
        self.subroi_add_button.clicked.connect(self.subroi_added.emit)
        self.roi_remove_button.clicked.connect(self.delete_roi)
        self.subroi_remove_button.clicked.connect(self.delete_subroi)

        self.addpaint_button.clicked.connect(self.manage_edit_toggle)
        self.removeerase_button.clicked.connect(self.manage_edit_toggle)
        self.translateContour_button.clicked.connect(self.manage_edit_toggle)
        self.rotateContour_button.clicked.connect(self.manage_edit_toggle)

        self.eraseFromAllROIs_checkbox.setVisible(False)

        self.edit_state = self.NO_STATE
        self.temp_edit_state = None

        self.removeall_button.clicked.connect(self.clear_roi)

        self.classification_combo.currentTextChanged.connect(
            self.on_classification_changed)
        self.classification_all_button.clicked.connect(
            self.on_classification_change_all)
        self.autosegment_button.clicked.connect(self.on_do_segmentation)

        self.undoButton.clicked.connect(self.undo.emit)
        self.redoButton.clicked.connect(self.redo.emit)

        self.optimizeButton.clicked.connect(self.contour_optimize.emit)
        self.simplifyButton.clicked.connect(self.contour_simplify.emit)

        self.calcTransformsButton.clicked.connect(self.do_registration)
        self.propagateForwardButton.clicked.connect(
            self.contour_propagate_fw.emit)
        self.propagateBackButton.clicked.connect(
            self.contour_propagate_bw.emit)

        if not activate_registration:
            self.registrationGroup.setVisible(False)

        self.editmode_combo.currentTextChanged.connect(
            lambda: self.set_edit_mode(self.editmode_combo.currentText()))
        self.editmode_combo.setCurrentText('Mask')
        self.set_edit_mode('Mask')

        self.brushsize_slider.valueChanged.connect(self.brushsliderCB)
        self.brushsize_slider.setValue(5)
        self.brushsliderCB(5)

        self.grow_button.clicked.connect(self.mask_grow.emit)
        self.shrink_button.clicked.connect(self.mask_shrink.emit)

        self.splash_movie = QMovie(SPLASH_ANIMATION_PATH)
        self.splash_label.setMovie(self.splash_movie)

        ## Menus

        self.actionImport_ROIs.triggered.connect(self.importROI_clicked)
        self.actionExport_ROIs.triggered.connect(self.exportROI_clicked)

        self.actionLoad_data.triggered.connect(self.loadData_clicked)

        self.actionSave_as_Dicom.triggered.connect(
            lambda: self.export_masks_dir('dicom'))
        self.actionSave_as_Compact_Dicom.triggered.connect(
            lambda: self.export_masks_dir('compact_dicom'))
        self.actionSaveNPY.triggered.connect(
            lambda: self.export_masks_dir('npy'))
        self.actionSave_as_Nifti.triggered.connect(
            lambda: self.export_masks_dir('nifti'))
        self.actionSaveNPZ.triggered.connect(self.export_masks_npz)
        self.actionSave_as_Compact_Nifti.triggered.connect(
            self.export_masks_compact_nifti)

        self.actionAbout.triggered.connect(self.about)
        self.actionOpen_online_documentation.triggered.connect(
            lambda: webbrowser.open(DOCUMENTATION_URL))
        self.actionHelp_shortcuts.triggered.connect(self.show_shortcuts)

        self.actionCalculate_statistics.triggered.connect(
            self.calculate_statistics)
        if not activate_radiomics:
            self.actionPyRadiomics.setVisible(False)

        self.actionPyRadiomics.triggered.connect(self.calculate_radiomics)

        self.actionIncremental_Learn.triggered.connect(
            self.do_incremental_learn)

        self.actionImport_masks.triggered.connect(self.load_mask_clicked)
        self.actionImport_multiple_masks.triggered.connect(
            self.load_multi_mask_clicked)

        self.actionPreferences.triggered.connect(self.edit_preferences)
        self.action_Restore_factory_settings.triggered.connect(
            self.clear_preferences)

        self.actionCopy_roi.triggered.connect(self.do_copy_roi)
        self.actionCombine_roi.triggered.connect(self.do_combine_roi)
        self.actionMultiple_combine.triggered.connect(
            self.do_combine_multiple_roi)
        self.actionRemove_overlap.triggered.connect(
            self.roi_remove_overlap.emit)

        self.actionCopy_roi.setEnabled(False)
        self.actionCombine_roi.setEnabled(False)
        self.actionMultiple_combine.setEnabled(False)
        self.actionRemove_overlap.setEnabled(False)

        self.action_Upload_data.triggered.connect(self.do_upload_data)

        self.actionImport_model.triggered.connect(self.do_import_model)

        self.actionOpen_transform_calculator.triggered.connect(
            self.open_transform_calculator)

        self.reload_config()
        self.config_changed.connect(self.reload_config)

        self.opacitySlider.setValue(config.GlobalConfig['MASK_LAYER_ALPHA'] *
                                    100)
        self.opacitySlider.valueChanged.connect(self.set_opacity_config)

        self.general_enable(False)

        self.resize(self.mainUIWidget.sizeHint())
Beispiel #43
0
    def initUI(self):
        # Write GUI initialization code

        self.setGeometry(self.left, self.top, self.width, self.height)
        self.setWindowTitle(self.title)

        # ****************add the label for image*********************
        wid = QWidget(self)
        self.setCentralWidget(wid)

        self.groupBox = QGroupBox()
        self.hBoxlayout = QHBoxLayout()

        self.qlabel1 = QLabel('Image', self)
        self.qlabel1.setStyleSheet(
            "border: 1px inset grey; min-height: 200px; ")
        self.qlabel1.setAlignment(Qt.AlignCenter)
        self.hBoxlayout.addWidget(self.qlabel1)

        self.groupBox.setLayout(self.hBoxlayout)

        vBox = QVBoxLayout()
        vBox.addWidget(self.groupBox)
        wid.setLayout(vBox)

        # ****************menu bar***********
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('File')
        filters = menubar.addMenu('Filters')
        geometric_transform = menubar.addMenu('Geometric Transform')

        openAction = QAction('Open Image', self)
        openAction.triggered.connect(self.openImage)
        fileMenu.addAction(openAction)

        openAction2 = QAction('Save Image', self)
        openAction2.triggered.connect(self.saveImage)
        fileMenu.addAction(openAction2)

        exitAct = QAction(QIcon('exit.png'), '&Exit', self)
        exitAct.setShortcut('Ctrl+Q')
        exitAct.setStatusTip('Exit application')
        exitAct.triggered.connect(qApp.quit)
        fileMenu.addAction(exitAct)

        ## ************ AVERAGE FILTERS ************ ##
        average_filters = QMenu('Average Filters', self)
        three_avg = QAction('3x3', self)
        five_avg = QAction('5x5', self)
        seven_avg = QAction('7x7', self)
        nine_avg = QAction('9x9', self)
        eleven_avg = QAction('11x11', self)
        thirteen_avg = QAction('13x13', self)
        fifteen_avg = QAction('15x15', self)

        three_avg.triggered.connect(self.average_3)
        five_avg.triggered.connect(self.average_5)
        seven_avg.triggered.connect(self.average_7)
        nine_avg.triggered.connect(self.average_9)
        eleven_avg.triggered.connect(self.average_11)
        thirteen_avg.triggered.connect(self.average_13)
        fifteen_avg.triggered.connect(self.average_15)

        average_filters.addAction(three_avg)
        average_filters.addAction(five_avg)
        average_filters.addAction(seven_avg)
        average_filters.addAction(nine_avg)
        average_filters.addAction(eleven_avg)
        average_filters.addAction(thirteen_avg)
        average_filters.addAction(fifteen_avg)

        filters.addMenu(average_filters)
        ## **************************************** ##

        ## ************ GAUSSIAN FILTERS ************ ##
        gaussian_filters = QMenu('Gaussian Filters', self)
        three_gaus = QAction('3x3', self)
        five_gaus = QAction('5x5', self)
        seven_gaus = QAction('7x7', self)
        nine_gaus = QAction('9x9', self)
        eleven_gaus = QAction('11x11', self)
        thirteen_gaus = QAction('13x13', self)
        fifteen_gaus = QAction('15x15', self)

        three_gaus.triggered.connect(self.gaussian_3)
        five_gaus.triggered.connect(self.gaussian_5)
        seven_gaus.triggered.connect(self.gaussian_7)
        nine_gaus.triggered.connect(self.gaussian_9)
        eleven_gaus.triggered.connect(self.gaussian_11)
        thirteen_gaus.triggered.connect(self.gaussian_13)
        fifteen_gaus.triggered.connect(self.gaussian_15)

        gaussian_filters.addAction(three_gaus)
        gaussian_filters.addAction(five_gaus)
        gaussian_filters.addAction(seven_gaus)
        gaussian_filters.addAction(nine_gaus)
        gaussian_filters.addAction(eleven_gaus)
        gaussian_filters.addAction(thirteen_gaus)
        gaussian_filters.addAction(fifteen_gaus)

        filters.addMenu(gaussian_filters)
        ## **************************************** ##

        ## ************ MEDIAN FILTERS ************ ##
        median_filters = QMenu('Median Filters', self)
        three_med = QAction('3x3', self)
        five_med = QAction('5x5', self)
        seven_med = QAction('7x7', self)
        nine_med = QAction('9x9', self)
        eleven_med = QAction('11x11', self)
        thirteen_med = QAction('13x13', self)
        fifteen_med = QAction('15x15', self)

        three_med.triggered.connect(self.median_3)
        five_med.triggered.connect(self.median_5)
        seven_med.triggered.connect(self.median_7)
        nine_med.triggered.connect(self.median_9)
        eleven_med.triggered.connect(self.median_11)
        thirteen_med.triggered.connect(self.median_13)
        fifteen_med.triggered.connect(self.median_15)

        median_filters.addAction(three_med)
        median_filters.addAction(five_med)
        median_filters.addAction(seven_med)
        median_filters.addAction(nine_med)
        median_filters.addAction(eleven_med)
        median_filters.addAction(thirteen_med)
        median_filters.addAction(fifteen_med)

        filters.addMenu(median_filters)
        ## **************************************** ##

        ### 5. create rotate, scale and translate menu ###
        rotate = QMenu('Rotate', self)
        scale = QMenu('Scale', self)
        translate = QMenu('Translate', self)

        rotate_right = QAction('Rotate 10 Degree Right', self)
        rotate_left = QAction('Rotate 10 Degree Left', self)
        twox = QAction('2x', self)
        oneovertwox = QAction('1/2x', self)
        right = QAction('Right', self)
        left = QAction('Left', self)

        ### add function when the action is triggered ###
        rotate_right.triggered.connect(self.rotate_right)
        rotate_left.triggered.connect(self.rotate_left)
        twox.triggered.connect(self.scale_twox)
        oneovertwox.triggered.connect(self.scale_oneovertwox)
        right.triggered.connect(self.trans_right)
        left.triggered.connect(self.trans_left)

        ###  add action ###
        rotate.addAction(rotate_right)
        rotate.addAction(rotate_left)
        scale.addAction(twox)
        scale.addAction(oneovertwox)
        translate.addAction(right)
        translate.addAction(left)

        geometric_transform.addMenu(rotate)
        geometric_transform.addMenu(scale)
        geometric_transform.addMenu(translate)

        # ------------------------------------

        self.show()
Beispiel #44
0
def read_QIcon(icon_basename):
    return QIcon(icon_path(icon_basename))
Beispiel #45
0
    def __init__(self, device, *args, **kwargs):
        super().__init__()
        self.setAllowedAreas(Qt.BottomDockWidgetArea)
        self.setWindowTitle("Console [{}]".format(device.p["FriendlyName1"]))
        self.device = device

        self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()),
                                  QSettings.IniFormat)

        console_font_size = self.settings.value("console_font_size", 9, int)
        console_font.setPointSize(console_font_size)

        console_word_wrap = self.settings.value("console_word_wrap", True,
                                                bool)

        w = QWidget()

        vl = VLayout()

        self.console = QPlainTextEdit()
        self.console.setTabChangesFocus(True)
        self.console.setWordWrapMode(console_word_wrap)

        self.console.setReadOnly(True)
        self.console.setFont(console_font)

        self.console_hl = JSONHighLighter(self.console.document())

        hl_command_mqttlog = HLayout(0)

        self.command = QLineEdit()
        self.command.setFont(console_font)
        self.command.setPlaceholderText(
            "Type the command and press ENTER to send.")
        self.command.returnPressed.connect(self.command_enter)
        self.command.textChanged.connect(self.command_changed)
        self.command.installEventFilter(self)

        command_cpl = QCompleter(sorted(commands))
        command_cpl.setCaseSensitivity(Qt.CaseInsensitive)
        command_cpl.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
        self.command.setCompleter(command_cpl)
        # command_cpl.popup().installEventFilter(self)

        command_cpl.activated.connect(self.command.clear, Qt.QueuedConnection)

        pbSave = QPushButton(QIcon("GUI/icons/save.png"), "")
        pbSave.setFlat(True)
        pbSave.setToolTip("Save console")
        pbSave.clicked.connect(self.save_console)

        pbClear = QPushButton(QIcon("GUI/icons/clear.png"), "")
        pbClear.setFlat(True)
        pbClear.setToolTip("Clear console")
        pbClear.clicked.connect(self.clear_console)

        self.cbMQTTLog = QComboBox()
        self.cbMQTTLog.addItems([
            "Disabled", "Error", "Error/Info (default)", "Error/Info/Debug",
            "Error/Info/More debug", "All"
        ])
        mqttlog = self.device.p.get("MqttLog", -1)

        if mqttlog != -1:
            self.cbMQTTLog.setCurrentIndex(int(mqttlog))
        else:
            self.cbMQTTLog.setEnabled(False)

        self.cbMQTTLog.currentIndexChanged.connect(self.change_mqttlog)

        hl_command_mqttlog.addWidgets([
            self.command, pbSave, pbClear,
            QLabel("MQTT Log level"), self.cbMQTTLog
        ])

        vl.addWidget(self.console)
        vl.addLayout(hl_command_mqttlog)

        w.setLayout(vl)
        self.setWidget(w)
    def __init__(self):
        self.setupUi(self)

        self.icon_path = self.get_resource("images")
        now = QtCore.QDateTime.currentDateTime()
        self.dateTimeEdit.setDateTime(now)

        self.dateTimeEdit.setMaximumDateTime(
            QtCore.QDateTime.currentDateTime())
        self.dateTimeEdit.setMinimumDateTime(
            QtCore.QDateTime(2000, 1, 1, 0, 0, 0))

        self.dateTimeEdit_2.setDateTime(now)
        self.dateTimeEdit_2.setMinimumDateTime(now)

        self.dateTimeEdit_3.setDateTime(now)
        self.dateTimeEdit_3.setMinimumDateTime(now)

        self.dateTimeEdit_4.setDateTime(now)
        self.dateTimeEdit_4.setMinimumDateTime(now)

        self.dateTimeEdit_2.setStyleSheet(
            "QDateTimeEdit::disabled {background-color: rgb(186, 189, 182);color: gray;}"
            "QDateTimeEdit::enabled {background-color: rgb(186, 189, 182);color: rgb(0, 0, 0);}"
        )
        self.dateTimeEdit_3.setStyleSheet(
            "QDateTimeEdit::disabled {background-color: rgb(186, 189, 182);color: gray;}"
            "QDateTimeEdit::enabled {background-color: rgb(186, 189, 182);color: rgb(0, 0, 0);}"
        )
        self.dateTimeEdit_4.setStyleSheet(
            "QDateTimeEdit::disabled {background-color: rgb(186, 189, 182);color: gray;}"
            "QDateTimeEdit::enabled {background-color: rgb(186, 189, 182);color: rgb(0, 0, 0);}"
        )
        self.dateTimeEdit.setStyleSheet(
            "QDateTimeEdit::disabled {background-color: rgb(186, 189, 182);color: gray;}"
            "QDateTimeEdit::enabled {background-color: rgb(186, 189, 182);color: rgb(0, 0, 0);}"
        )

        regex = QtCore.QRegExp("[a-zA-Z ]+")
        validator = QtGui.QRegExpValidator(regex)
        self.lineEdit_7.setValidator(validator)

        self.tableWidget.setColumnCount(4)
        header = self.tableWidget.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents)

        self.tableWidget_2.setColumnCount(4)
        header = self.tableWidget_2.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)

        self.tableWidget_3.setColumnCount(2)
        header = self.tableWidget_3.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)

        self.tableWidget_4.setColumnCount(3)
        header = self.tableWidget_4.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)

        self.tableWidget_5.setColumnCount(6)
        header = self.tableWidget_5.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeToContents)

        self.onlyDouble = QDoubleValidator()
        self.lineEdit_2.setValidator(self.onlyDouble)

        self.onlyDouble = QDoubleValidator()
        self.lineEdit_15.setValidator(self.onlyDouble)

        self.onlyDouble = QDoubleValidator()
        self.lineEdit_12.setValidator(self.onlyDouble)

        self.onlyDouble = QDoubleValidator()
        self.lineEdit_16.setValidator(self.onlyDouble)

        # Tabwidget
        self.tableWidget.setShowGrid(False)
        # self.tableWidget.verticalHeader().setVisible(False)

        self.tableWidget_2.setShowGrid(False)
        # self.tableWidget_2.verticalHeader().setVisible(False)

        self.tableWidget_3.setShowGrid(False)
        # self.tableWidget_3.verticalHeader().setVisible(False)

        self.tableWidget_4.setShowGrid(False)
        # self.tableWidget_4.verticalHeader().setVisible(False)

        self.tableWidget_5.setShowGrid(False)
        # self.tableWidget_5.verticalHeader().setVisible(False)

        self.tableWidget_6.setShowGrid(False)

        stylesheet = "QHeaderView::section{Background-color:#16A085;border-radius:5px;font: 13pt;color: beige; margin:5px}" \
                     "QTableWidget::QTableCornerButton::section {background: red;border: 2px outset red;border: 0;}" \
                     "QTableWidget::indicator:unchecked {background-color: #d7d6d5;border: 0;}" \
                     "QTableWidget {border: 0;}" \
                     "QTableWidget::item { border-radius:12px;font: 15pt;color: beige; }"

        self.tableWidget.setStyleSheet(stylesheet)
        self.tableWidget_6.setStyleSheet(stylesheet)

        stylesheet_4 = "QHeaderView::section{Background-color:#16A085;border-radius:5px;font: 13pt;color: beige; margin:5px}" \
                       "QTableWidget::QTableCornerButton::section {background: red;border: 2px outset red;border: 0;}" \
                       "QTableWidget::indicator:unchecked {background-color: #d7d6d5;border: 0;}" \
                       "QTableWidget {border: 0;}" \
                       "QTableWidget::item { border-radius:12px;font: 15pt;color: beige; }"

        self.tableWidget_4.setStyleSheet(stylesheet_4)

        stylesheet_5 = "QHeaderView::section{Background-color:#16A085;border-radius:5px;font: 13pt;color: beige; margin:5px}" \
                       "QTableWidget::QTableCornerButton::section {background: red;border: 2px outset red;border: 0;}" \
                       "QTableWidget::indicator:unchecked {background-color: #d7d6d5;border: 0;}" \
                       "QTableWidget {border: 0;}" \
                       "QTableWidget::item { border-radius:12px;font: 15pt;color: beige; }"

        self.tableWidget_5.setStyleSheet(stylesheet_5)

        stylesheet = "QHeaderView::section{Background-color:#16A085;border-radius:5px;font: 13pt;color: beige; margin:5px}" \
                     "QTableWidget::QTableCornerButton::section {background: red;border: 2px outset red;border: 0;}" \
                     "QTableWidget::indicator:unchecked {background-color: #d7d6d5;border: 0;}" \
                     "QTableWidget {border: 0;}" \
                     "QTableWidget::item { border-radius:12px;font: 15pt;color: beige; }"

        self.tableWidget_3.setStyleSheet(stylesheet)

        stylesheet_ = "QHeaderView::section{Background-color:#16A085;border-radius:5px;font: 13pt;color: beige; margin:5px}" \
                      "QTableWidget::QTableCornerButton::section {background: red;border: 2px outset red;border: 0;}" \
                      "QTableWidget::indicator:unchecked {background-color: #d7d6d5;border: 0;}" \
                      "QTableWidget {border: 0;}" \
                      "QTableWidget::item { border-radius:12px;font: 15pt;color: beige; }"

        self.tableWidget_2.setStyleSheet(stylesheet_)

        self.tabWidget_3.setTabIcon(
            0, QtGui.QIcon(self.icon_path + '/chain_icon.png'))
        self.tabWidget_3.setTabIcon(
            1, QtGui.QIcon(self.icon_path + '/wallet_icon.png'))
        self.tabWidget_3.setTabIcon(
            2, QtGui.QIcon(self.icon_path + '/credit.png'))
        self.tabWidget_3.setTabIcon(
            3, QtGui.QIcon(self.icon_path + '/loop_icon.png'))
        self.tabWidget_3.setTabIcon(
            4, QtGui.QIcon(self.icon_path + '/persons.png'))
        self.tabWidget_3.setTabIcon(
            5, QtGui.QIcon(self.icon_path + '/setting_icon.png'))
        self.tabWidget_3.setTabIcon(
            6, QtGui.QIcon(self.icon_path + '/exit_icon.png'))
        self.tabWidget_3.setTabIcon(
            7, QtGui.QIcon(self.icon_path + '/log_icon.png'))

        self.tabWidget.setStyleSheet("QTabWidget::pane { border: 0; }")
        self.tabWidget_3.tabBar().setStyleSheet('''
                                        QTabBar { font: bold 15pt; font-family: Courier; color: rgb(238, 238, 236); }
                                        QTabBar::tab { border-radius: 10px;   margin: 5px; }
                                        QTabBar::tab:selected {background-color:  #2C3E50; color: white}
                                        QTabBar::tab::disabled {width: 0; height: 0; margin: 0; padding: 0; border: none;}
                                        QTabBar::tab:hover {background-color : #16A085;}
                                    ''')
        self.tabWidget_3.setStyleSheet('''
                                         QTabBar { font: bold 12pt; font-family: Courier; color: rgb(238, 238, 236); }
                                         QTabBar::tab { border-radius: 10px;   }
                                         QTabBar::tab::disabled {width: 0; height: 0; margin: 0; padding: 0; border: none;}
                                         QTabWidget::pane {top: 0px;}
                                         QTabWidget::pane { border: 0; }
        
                                         QTabBar::tab:selected {background-color:  #2C3E50; color: white}
                                         QTabBar::tab:hover {background-color : #16A085;}
                                     ''')

        self.tabWidget_4.setStyleSheet('''
                                QTabWidget { background: transparent;  }
                                QTabWidget::pane {border: 0px solid lightgray;border-radius: 20px;top:-1px;}
                                QTabBar::tab {border: 1px solid beige;padding: 15px;}
                                QTabBar::tab:selected {}''')

        self.tabWidget_4.tabBar().setStyleSheet('''
                                        QTabBar { font: 12pt; font-family: Courier; color: rgb(238, 238, 236); }
                                        QTabBar::tab { border-radius: 10px; }
                                        QTabBar::tab:hover {background-color:  #2C3E50; color: white}
                                        QTabBar::tab::disabled {width: 0; height: 0; margin: 0; padding: 0; border: none;}
                                        QTabBar::tab:selected {background-color : #16A085;}
                                    ''')

        self.tabWidget_3.setIconSize(QtCore.QSize(50, 50))
        # Button
        self.pushButton_21.setIcon(QIcon(self.icon_path + "/connect_icon.png"))
        self.pushButton_21.setIconSize(QtCore.QSize(50, 50))

        self.pushButton_4.setText("")

        self.pushButton_17.setIcon(QIcon(self.icon_path + "/start_icon.png"))
        self.pushButton_17.setIconSize(QtCore.QSize(50, 50))

        self.pushButton_11.setIcon(QIcon(self.icon_path + "/stop_icon.png"))
        self.pushButton_11.setIconSize(QtCore.QSize(60, 60))

        self.icon_path = self.icon_path.replace("\\", "/")

        self.pushButton_31.setStyleSheet("QPushButton          {image: url(" + self.icon_path + "/search_icon.png); border: 0; width: 40px; height: 40px;}"\
                                        "QPushButton::hover   {image: url(" + self.icon_path + "/search_hover.png);border:0px}"\
                                        "QPushButton::pressed {image: url(" + self.icon_path + "/search_press.png);border:0px}")
        self.pushButton_33.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/search_icon.png); border: 0; width: 40px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/search_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/search_press.png);border:0px}")
        self.pushButton_43.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/search_icon.png); border: 0; width: 40px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/search_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/search_press.png);border:0px}")
        self.pushButton_14.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/copy_key_icon.png); border: 0; width: 20px; height: 20px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/copy_key_icon_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/copy_key_icon_press.png);border:0px}")
        self.pushButton_7.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/copy_wallet_icon_.png); border: 0; width: 20px; height: 20px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/copy_wallet_icon_hover_.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/copy_wallet_icon_press_.png);border:0px}")
        self.pushButton_39.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/copy_wallet_icon_.png); border: 0; width: 30px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/copy_wallet_icon_hover_.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/copy_wallet_icon_press_.png);border:0px}")
        self.pushButton_40.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/copy_key_icon.png); border: 0; width: 30px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/copy_key_icon_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/copy_key_icon_press.png);border:0px}")
        self.pushButton_4.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/exit_icon_reg.png);border:0px; width: 7px; height: 7px;border-radius: 200px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/exit_icon_hoever.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/exit_icon_press.png);border:0px}")
        self.pushButton_13.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/coin_lock_icon.png); border: 0; width: 10px; height: 10px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/coin_lock_icon_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/coin_lock_icon_press.png);border:0px}")
        self.pushButton_20.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/coin_unlock_icon.png); border: 0; width: 10px; height: 10px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/coin_unlock_icon_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/coin_unlock_icon_press.png);border:0px}")
        self.pushButton_18.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/send_coin_icon.png); border: 0; width: 20px; height: 20px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/send_coin_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/send_coin_press.png);border:0px}")

        self.pushButton_19.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/copy_wallet_icon.png); border: 0; width: 30px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/copy_wallet_icon_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/copy_wallet_icon_press.png);border:0px}")

        self.pushButton_27.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/request_credit.png); border: 0; width: 30px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/request_credit_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/request_credit_press.png);border:0px}")

        self.pushButton_32.setStyleSheet(
            "QPushButton          {image: url(" + self.icon_path +
            "/request_credit.png); border: 0; width: 30px; height: 30px;}"
            "QPushButton::hover   {image: url(" + self.icon_path +
            "/request_credit_hover.png);border:0px}"
            "QPushButton::pressed {image: url(" + self.icon_path +
            "/request_credit_press.png);border:0px}")

        self.pushButton_15.setIcon(
            QIcon(self.icon_path + "/circle-inactive.png"))
        self.pushButton_15.setStyleSheet(
            "border-color: red;border-radius: 10px")

        self.pushButton_16.setIcon(
            QIcon(self.icon_path + "/circle-inactive.png"))
        self.pushButton_16.setStyleSheet(
            "border-color: red;border-radius: 10px")

        self.pushButton_3.setStyleSheet(
            "border-color: red;border-radius: 10px")

        self.pushButton_22.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_36.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")
        self.pushButton_37.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")
        self.pushButton_38.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")
        self.pushButton_45.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_48.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_46.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")
        self.pushButton_2.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color:  #5DADE2;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")
        self.pushButton_12.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color:  #5DADE2;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_8.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_8.setIconSize(QtCore.QSize(40, 400))

        self.pushButton_8.setStyleSheet("\
                    QPushButton          {color: beige; border: solid; border-style: outset; border-color: #5DADE2 ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_29.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_29.setIconSize(QtCore.QSize(50, 50))
        self.pushButton_29.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: bold 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 1px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 1px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 1px; border-radius: 10px;}\
                    ")

        self.pushButton_42.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_42.setIconSize(QtCore.QSize(30, 30))
        self.pushButton_42.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 1px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 1px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 1px; border-radius: 10px;}\
                    ")

        self.pushButton_30.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_30.setIconSize(QtCore.QSize(20, 20))
        self.pushButton_30.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: bold 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 1px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 1px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 1px; border-radius: 10px;}\
                    ")
        self.pushButton_34.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_34.setIconSize(QtCore.QSize(50, 50))
        self.pushButton_34.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: bold 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 1px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 1px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 1px; border-radius: 10px;}\
                    ")

        self.pushButton_35.setIcon(QIcon(self.icon_path + "/refresh_icon.png"))
        self.pushButton_35.setIconSize(QtCore.QSize(20, 20))
        self.pushButton_35.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_41.setStyleSheet("\
                            QPushButton          {background-color: #16A085 ;font: 15pt;color: beige; border: solid; border-style: outset; border-color: #5DADE2;border-width: 1px; border-radius: 10px;}\
                            QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 1px; border-radius: 10px;}\
                            QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 1px; border-radius: 10px;}\
                            ")

        self.pushButton_10.setStyleSheet('''
                    QPushButton          {background-color: #16A085 ;border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    QPushButton::hover   {border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                    QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    ''')

        self.pushButton_44.setStyleSheet('''
                    QPushButton          {background-color: #16A085 ;border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    QPushButton::hover   {border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                    QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    ''')

        self.pushButton_47.setStyleSheet('''
                    QPushButton          {background-color: #16A085 ;border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    QPushButton::hover   {border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                    QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    ''')

        self.pushButton_21.setStyleSheet("\
                    QPushButton          {background-color: #16A085 ;font: bold 15pt;color: beige; border: solid; border-style: outset; border-color:  #5DADE2;border-width: 2px; border-radius: 10px;}\
                    QPushButton::hover   {color: lawngreen; border: solid; border-style: outset; border-color: forestgreen ;border-width: 2px; border-radius: 10px;}\
                    QPushButton::pressed {color: lawngreen; border: solid; border-style: outset; border-color: lawngreen ;border-width: 2px; border-radius: 10px;}\
                    ")

        self.pushButton_23.setStyleSheet('''
                    QPushButton          {background-color: #16A085 ;border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                    QPushButton::hover   {border-style: outset; border-color: green;border-width: 2px; border-radius: 10px; }
                    QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                    ''')

        self.pushButton_24.setStyleSheet('''
                            QPushButton          {background-color: #16A085 ;border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                            QPushButton::hover   {border-style: outset; border-color: green;border-width: 2px; border-radius: 10px; }
                            QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                            ''')
        self.pushButton_25.setStyleSheet('''
                            QPushButton          {background-color: #16A085 ;border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                            QPushButton::hover   {border-style: outset; border-color: green;border-width: 2px; border-radius: 10px; }
                            QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                            ''')
        self.pushButton_26.setStyleSheet('''
                            QPushButton          {background-color: #16A085 ;border-style: outset; border-color: blue;border-width: 2px; border-radius: 10px; }
                            QPushButton::hover   {border-style: outset; border-color: green;border-width: 2px; border-radius: 10px; }
                            QPushButton::pressed {border-style: outset; border-color: red;border-width: 2px; border-radius: 10px; }
                            ''')

        self.pushButton.setIcon(QIcon(self.icon_path + "/mcl_.png"))
        self.pushButton.setIconSize(QtCore.QSize(60, 60))
        self.pushButton.setText("")
        self.pushButton.setStyleSheet("border-color: red;border-radius: 10px")

        # Label
        # ---------------------------------------------
        self.label_20.setStyleSheet("border:0;")
        self.label_23.setStyleSheet("border:0;")
        self.label_24.setStyleSheet("border:0;")

        # Line Edit
        # ---------------------------------------------
        self.lineEdit_12.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_16.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_15.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_14.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_10.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_39.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_38.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_31.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_9.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_28.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )

        self.lineEdit_21.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_24.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_13.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_2.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_25.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )
        self.lineEdit_4.setStyleSheet(
            "font-size: 15px;border: 1px solid #16A085; border-radius: 10px;color:white"
        )

        self.lineEdit_31.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_32.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_33.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_36.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )

        self.lineEdit_22.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_27.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_5.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_23.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_26.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_34.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )
        self.lineEdit_35.setStyleSheet(
            "font-size: 15px;border: 1px solid blue; border-radius: 10px;color:white"
        )

        self.lineEdit_29.setStyleSheet(
            "QLineEdit::disabled {font-size: 11px;border: 1px solid blue; border-radius: 5px;color:gray}"
            "QLineEdit::enabled {font-size: 11px;border: 1px solid #16A085; border-radius: 5px;color:white}"
        )

        self.lineEdit_30.setStyleSheet(
            "QLineEdit::disabled {font-size: 11px;border: 1px solid blue; border-radius: 5px;color:gray}"
            "QLineEdit::enabled {font-size: 11px;border: 1px solid #16A085; border-radius: 5px;color:white}"
        )

        self.lineEdit_6.setStyleSheet(
            "border: 1px solid #16A085; border-radius: 10px;color:white")

        self.label_19.setStyleSheet(
            "QLabel {font-size: 20px;background-color: #16A085; border-radius: 20px;}"
        )

        self.label_54.setStyleSheet("QLabel {font-size: 11px; color:white}")
        self.label_55.setStyleSheet("QLabel {font-size: 11px; color:white}")
        self.label_82.setStyleSheet("QLabel {font-size: 18px; color:white}")
        self.label_85.setStyleSheet("QLabel {font-size: 18px; color:white}")

        self.label_21.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_33.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_31.setStyleSheet("QLabel {font-size: 20px; color:white}")

        self.label_46.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_47.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_48.setStyleSheet("QLabel {font-size: 20px; color:white}")

        self.label_30.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_32.setStyleSheet("QLabel {font-size: 20px; color:white}")

        self.label_34.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_22.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_41.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_42.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_49.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_51.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_43.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_53.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_44.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_7.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_17.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_67.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_68.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_69.setStyleSheet("QLabel {font-size: 20px; color:white}")
        self.label_72.setStyleSheet("QLabel {font-size: 15px; color:white}")
        self.label_73.setStyleSheet("QLabel {font-size: 15px; color:white}")
        self.label_74.setStyleSheet("QLabel {font-size: 15px; color:white}")

        self.label_28.setStyleSheet(
            "QLabel {font: medium; font-size: 25px;background-color: #16A085; border-radius: 10px;}"
        )

        # Frame
        # ---------------------------------------------
        self.frame_2.setStyleSheet(
            "QFrame {border-style: outset;border-width: 2px;border-color: beige;border-radius: 10px;color: rgb(238, 238, 236);}"
        )

        self.frame_16.setStyleSheet(
            '''QFrame {border-style: outset;border-width: 2px;border-color: beige;border-radius: 10px;color: rgb(238, 238, 236);}'''
        )
        self.frame.setStyleSheet('''QFrame {border:0;}''')
        self.frame_20.setStyleSheet(
            '''QFrame {border-style: outset;border-width: 2px;border-color: beige;border-radius: 10px}'''
        )

        self.frame_3.setStyleSheet('''
                    QFrame {border-style: outset;border-width: 2px;border-color: blue;border-radius: 30px; background:transparent; ; }
                    QLineEdit {border: 1px solid #16A085; border-radius: 10px}
        
                    ''')

        self.frame_13.setStyleSheet('''QFrame {border:0;}''')
        self.frame_21.setStyleSheet('''QFrame {border:0;}''')
        self.frame_11.setStyleSheet(
            "border-radius: 20px; background-color: #16A085;color: rgb(238, 238, 236);"
        )

        # Groupbox
        # ---------------------------------------------
        self.groupBox.setTitle("")
        self.groupBox.setStyleSheet(
            "border-radius: 20px; background:transparent;  ")

        self.groupBox_10.setStyleSheet('''
                            QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 1ex;}
                            QGroupBox::title {color:white;top: -8px;left: 10px;}
                            ''')
        self.groupBox_16.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_12.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 0px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_17.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 0px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                              ''')
        self.groupBox_7.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_13.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_19.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')

        self.groupBox_14.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_15.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_11.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_5.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_6.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_2.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_8.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_9.setStyleSheet('''
                             QGroupBox {color:white;border: solid;border-width: 2px;border-color: beige;border-radius: 10px;font: 15px consolas;margin-top: 2ex;}
                             QGroupBox::title {color:white;top: -8px;left: 10px;}
                              ''')
        self.groupBox_4.setStyleSheet('''
                        QRadioButton {color:beige;font: 20px consolas;}
                        QRadioButton::indicator {width: 25px; height: 25px;color:beige;}
                        QGroupBox {border:0;}
                        ''')
        self.comboBox_2.setStyleSheet('''
                        QComboBox::down-arrow{border: solid;border-width: 5px;border-color: #16A085;border-radius: 0px}
                        QComboBox{color:beige;border: solid;border-style: outset;border-width: 1px;border-color: #16A085;
                                 border-top-left-radius : 0px;
                                 border-top-right-radius : 0px;
                                 border-bottom-left-radius:0px;
                                 border-bottom-right-radius : 0px;}                        
                        QListView{background-color: teal;color:white;border: solid;border-style: outset;border-width: 2px;border-color: beige;border-radius: 5px;}
                                 ''')
        self.stackedWidget.setStyleSheet('''QFrame {border:0;}''')
        self.stackedWidget_2.setStyleSheet('''
                    QStackedWidget > QWidget{border-radius: 10px;}
                    QFrame {border:0;}''')

        self.frame_28.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color:  #021C1E}"
        )
        self.frame_37.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color:  #021C1E}"
        )
        self.frame_39.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color: #021C1E; }"
        )
        self.frame_40.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color: #021C1E; }"
        )
        self.frame_41.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color: #021C1E; }"
        )
        self.frame_38.setStyleSheet(
            "QFrame {border-style: outset;border-width: 0px;border-color: beige;border-radius: 10px; background-color: #021C1E; }"
        )

        #Here we hide the button with designer. Then we create our own button.
        self.pushButton_6.setVisible(False)
        self.pushButton_9.setVisible(False)

        from customizedItem.SwitchButton import MySwitch
        self.pushButton_6 = MySwitch(self.frame_18)
        self.pushButton_6.setObjectName("pushButton_6")
        self.horizontalLayout_12.addWidget(self.pushButton_6)

        self.pushButton_9 = MySwitch(self.frame_19)
        self.pushButton_9.setObjectName("pushButton_9")
        self.horizontalLayout_13.addWidget(self.pushButton_9)

        self.checkBox.setStyleSheet(
            "QCheckBox {font-size: 15px; color:white}"
            "QCheckBox::indicator:pressed {background-color : lightgreen;}")
Beispiel #47
0
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/PolyFromPointsLines/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
Beispiel #48
0
    def __init__(
        self,
        model_path=None,
        loaded_model=None,
        show_meshes=True,
        show_global_center_of_mass=True,
        show_segments_center_of_mass=True,
        show_global_ref_frame=True,
        show_local_ref_frame=True,
        show_markers=True,
        markers_size=0.010,
        show_muscles=True,
        show_analyses_panel=True,
        **kwargs,
    ):
        """
        Class that easily shows a biorbd model
        Args:
            loaded_model: reference to a biorbd loaded model (if both loaded_model and model_path, load_model is selected
            model_path: path of the model to load
        """

        # Load and store the model
        if loaded_model is not None:
            if not isinstance(loaded_model, biorbd.Model):
                raise TypeError(
                    "loaded_model should be of a biorbd.Model type")
            self.model = loaded_model
        elif model_path is not None:
            self.model = biorbd.Model(model_path)
        else:
            raise ValueError("loaded_model or model_path must be provided")

        # Create the plot
        self.vtk_window = VtkWindow(background_color=(0.5, 0.5, 0.5))
        self.vtk_model = VtkModel(self.vtk_window,
                                  markers_color=(0, 0, 1),
                                  markers_size=markers_size)
        self.is_executing = False
        self.animation_warning_already_shown = False

        # Set Z vertical
        cam = self.vtk_window.ren.GetActiveCamera()
        cam.SetFocalPoint(0, 0, 0)
        cam.SetPosition(5, 0, 0)
        cam.SetRoll(-90)

        # Get the options
        self.show_markers = show_markers
        self.show_global_ref_frame = show_global_ref_frame
        self.show_global_center_of_mass = show_global_center_of_mass
        self.show_segments_center_of_mass = show_segments_center_of_mass
        self.show_local_ref_frame = show_local_ref_frame
        if self.model.nbMuscles() > 0:
            self.show_muscles = show_muscles
        else:
            self.show_muscles = False
        if sum([
                len(i)
                for i in self.model.meshPoints(np.zeros(self.model.nbQ()))
        ]) > 0:
            self.show_meshes = show_meshes
        else:
            self.show_meshes = 0

        # Create all the reference to the things to plot
        self.nQ = self.model.nbQ()
        self.Q = np.zeros(self.nQ)
        self.markers = Markers(np.ndarray((3, self.model.nbMarkers(), 1)))
        if self.show_markers:
            self.Markers = InterfacesCollections.Markers(self.model)
            self.global_center_of_mass = Markers(np.ndarray((3, 1, 1)))
        if self.show_global_center_of_mass:
            self.CoM = InterfacesCollections.CoM(self.model)
            self.segments_center_of_mass = Markers(
                np.ndarray((3, self.model.nbSegment(), 1)))
        if self.show_segments_center_of_mass:
            self.CoMbySegment = InterfacesCollections.CoMbySegment(self.model)
        if self.show_meshes:
            self.mesh = []
            self.meshPointsInMatrix = InterfacesCollections.MeshPointsInMatrix(
                self.model)
            for i, vertices in enumerate(
                    self.meshPointsInMatrix.get_data(Q=self.Q,
                                                     compute_kin=False)):
                triangles = np.ndarray((len(self.model.meshFaces()[i]), 3),
                                       dtype="int32")
                for k, patch in enumerate(self.model.meshFaces()[i]):
                    triangles[k, :] = patch.face()
                self.mesh.append(Mesh(vertex=vertices, triangles=triangles.T))
        self.model.updateMuscles(self.Q, True)
        self.muscles = []
        for group_idx in range(self.model.nbMuscleGroups()):
            for muscle_idx in range(
                    self.model.muscleGroup(group_idx).nbMuscles()):
                musc = self.model.muscleGroup(group_idx).muscle(muscle_idx)
                tp = np.zeros(
                    (3, len(musc.position().musclesPointsInGlobal()), 1))
                self.muscles.append(Mesh(vertex=tp))
        self.musclesPointsInGlobal = InterfacesCollections.MusclesPointsInGlobal(
            self.model)
        self.rt = []
        self.allGlobalJCS = InterfacesCollections.AllGlobalJCS(self.model)
        for rt in self.allGlobalJCS.get_data(Q=self.Q, compute_kin=False):
            self.rt.append(Rototrans(rt))

        if self.show_global_ref_frame:
            self.vtk_model.create_global_ref_frame()

        self.show_analyses_panel = show_analyses_panel
        if self.show_analyses_panel:
            self.muscle_analyses = []
            self.palette_active = QPalette()
            self.palette_inactive = QPalette()
            self.set_viz_palette()
            self.animated_Q = []

            self.play_stop_push_button = []
            self.is_animating = False
            self.is_recording = False
            self.start_icon = QIcon(
                QPixmap(f"{os.path.dirname(__file__)}/ressources/start.png"))
            self.pause_icon = QIcon(
                QPixmap(f"{os.path.dirname(__file__)}/ressources/pause.png"))
            self.record_icon = QIcon(
                QPixmap(f"{os.path.dirname(__file__)}/ressources/record.png"))
            self.add_icon = QIcon(
                QPixmap(f"{os.path.dirname(__file__)}/ressources/add.png"))
            self.stop_icon = QIcon(
                QPixmap(f"{os.path.dirname(__file__)}/ressources/stop.png"))

            self.double_factor = 10000
            self.sliders = list()
            self.movement_slider = []

            self.active_analyses_widget = None
            self.analyses_layout = QHBoxLayout()
            self.analyses_muscle_widget = QWidget()
            self.add_options_panel()

        # Update everything at the position Q=0
        self.set_q(self.Q)
Beispiel #49
0
    def __init__(self, parent=None):
        super(MyWindow, self).__init__(parent)
        #uic.loadUi('gui_template.ui',self)

        try:
            self.path_home = os.path.expanduser("~\\Desktop\\")
        except Exception:
            self.path_home = ""

        for curren_dir in ["interim_image"]:
            if os.path.exists(curren_dir):
                if os.path.isdir(curren_dir):
                    print(curren_dir + " is here")
                else:
                    try:
                        os.mkdir(curren_dir)
                    except OSError:
                        print("Error generate dir " + curren_dir)
            else:
                try:
                    os.mkdir(curren_dir)
                except OSError:
                    print("Error generate dir " + curren_dir)

        # Load last path for files
        try:
            with open('last_path.json', "r") as f:
                path_dict = {i: j for i, j in json.load(f).items()}
            self.path_image = path_dict["path_image"]
            self.path_dir_images = path_dict["path_dir_images"]
            self.path_dir_dirs = path_dict["path_dir_dirs"]
            self.path_excel = path_dict["path_excel"]
            self.path_excels = path_dict["path_excels"]
            self.path_vez_excel = path_dict["path_vez_excel"]
            self.path_ro_excel = path_dict["path_ro_excel"]
            self.path_ro_word = path_dict["path_ro_word"]
        except Exception:
            self.path_image = self.path_home
            self.path_dir_images = self.path_home
            self.path_dir_dirs = self.path_home
            self.path_excel = self.path_home
            self.path_excels = self.path_home
            self.path_vez_excel = self.path_home
            self.path_ro_excel = self.path_home
            self.path_ro_word = self.path_home

        self.lv_c = 5
        self.t_c = 0.5
        self.imnam = "слои"

        desktop = QApplication.desktop()
        wd = desktop.width()
        hg = desktop.height()
        ww = 1000
        wh = 500
        if ww > wd: ww = int(0.7 * wd)
        if wh > hg: wh = int(0.7 * hg)
        x = (wd - ww) // 2
        y = (hg - wh) // 2
        self.setGeometry(x, y, ww, wh)

        topVBoxLayout = QVBoxLayout(self)
        topVBoxLayout.setContentsMargins(0, 0, 0, 0)

        SPFrame = QFrame()
        SPFrame.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        SPFrame.setMinimumSize(QSize(150, 100))

        self.ImFrame = QFrame()
        self.ImFrame.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        #self.ImFrame.setMinimumSize(QSize(300, 100))

        TbFrame = QFrame()
        TbFrame.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        TbFrame.setMinimumSize(QSize(0, 100))

        RFrame = QFrame()
        RFrame.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        RFrame.setMinimumSize(QSize(0, 100))

        self.listView = CustomList()  #QListView()
        self.listView.clicked.connect(self.OpenPict)
        self.select_able = True
        self.listView.setcloseEditorSignal(self.Rename)
        #self.listView.editingFinished.connect(self.Rename)
        #self.listView.edit.connect(self.Rename)

        BoxLayout1 = QVBoxLayout()
        self.progress_bar = QProgressBar()
        self.progress_bar.setAlignment(Qt.AlignHCenter)
        BoxLayout1.addWidget(self.progress_bar)
        BoxLayout1.addWidget(self.listView)

        SPFrame.setLayout(BoxLayout1)

        self.Table = CustomTable()  #QTableWidget()
        self.Table.setcloseEditorSignal(
            lambda: self.WriteTable(who_edited="table"))
        #self.Table.itemChanged(lambda:print("change2"))
        self.Table.cellClicked[int, int].connect(self.PosChangedCell)
        self.Table.setColumnCount(3)
        self.Table.setHorizontalHeaderLabels(["p", "h", "d"])
        self.Table.setRowCount(30)
        self.Table.setColumnWidth(0, 50)
        self.Table.setColumnWidth(1, 50)
        self.Table.setColumnWidth(2, 50)
        self.Table.setItemDelegate(DownloadDelegate(self))
        BoxLayout2 = QHBoxLayout()
        BoxLayout2.addWidget(self.Table)
        TbFrame.setLayout(BoxLayout2)

        self.pe1 = QLabel("Рэ1=")
        self.pe2 = QLabel("Рэ2=")
        self.pe = QLabel("Рэ=")
        lb1 = QLabel("Длинна вертикального")
        lb2 = QLabel("заземлителя lв, м")
        lb3 = QLabel("Глубина заложения")
        lb4 = QLabel("вертикального заземлителя t, м")
        lb5 = QLabel("Эквивалентное сопротивление")
        lb6 = QLabel("Двухслойная модель")
        lb7 = QLabel("Однослойная модель")
        lb8 = QLabel("Шаблон искомого изображения")
        lb9 = QLabel("Название проекта")
        lb10 = QLabel("Название ВЛ")
        self.vl = QDoubleSpinBox()
        self.vl.setValue(self.lv_c)
        self.vl.valueChanged.connect(self.WriteTable)
        self.t = QDoubleSpinBox()
        self.t.setValue(self.t_c)
        self.t.valueChanged.connect(self.WriteTable)
        self.pe1_le = QLineEdit()
        self.pe2_le = QLineEdit()
        self.pe_le = QLineEdit()
        self.ImageName = QLineEdit()
        self.ImageName.setText(self.imnam)
        self.NPrj = QLineEdit()
        self.NVL = QLineEdit()
        self.ImageName.editingFinished.connect(self.ReadImName)
        spacerItem = QSpacerItem(2, 20, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        BoxLayout3 = QVBoxLayout()
        BoxLayout4 = QHBoxLayout()
        BoxLayout5 = QHBoxLayout()
        BoxLayout6 = QHBoxLayout()
        BoxLayout3.addWidget(lb8)
        BoxLayout3.addWidget(self.ImageName)
        BoxLayout3.addWidget(lb9)
        BoxLayout3.addWidget(self.NPrj)
        BoxLayout3.addWidget(lb10)
        BoxLayout3.addWidget(self.NVL)
        BoxLayout3.addWidget(lb1)
        BoxLayout3.addWidget(lb2)
        BoxLayout3.addWidget(self.vl)
        BoxLayout3.addWidget(lb3)
        BoxLayout3.addWidget(lb4)
        BoxLayout3.addWidget(self.t)
        BoxLayout3.addWidget(lb5)
        BoxLayout3.addWidget(lb6)
        BoxLayout4.addWidget(self.pe1)
        BoxLayout4.addWidget(self.pe1_le)
        BoxLayout3.addLayout(BoxLayout4)
        BoxLayout5.addWidget(self.pe2)
        BoxLayout5.addWidget(self.pe2_le)
        BoxLayout3.addLayout(BoxLayout5)
        BoxLayout3.addWidget(lb7)
        BoxLayout6.addWidget(self.pe)
        BoxLayout6.addWidget(self.pe_le)
        BoxLayout3.addLayout(BoxLayout6)
        BoxLayout3.addItem(spacerItem)
        RFrame.setLayout(BoxLayout3)

        Splitter1 = QSplitter(Qt.Horizontal)
        Splitter1.addWidget(SPFrame)
        Splitter1.addWidget(self.ImFrame)
        Splitter1.addWidget(TbFrame)
        Splitter1.addWidget(RFrame)
        Splitter1.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        Splitter1.setStretchFactor(1, 4)
        Splitter1.setStretchFactor(1, 1)

        topVBoxLayout.addWidget(Splitter1)

        self.central_widget = QWidget()
        self.central_widget.setLayout(topVBoxLayout)
        self.setCentralWidget(self.central_widget)

        #self.resize()
        #self.central_widget.show()
        self.PaintForm = MyFrame(False, parent=self.ImFrame)

        self.statusBar()
        menubar = self.menuBar()

        exitAction = QAction('&Выход', self)  #QIcon('exit.png'),
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Выход и программы')
        exitAction.triggered.connect(lambda: self.closeEvent(QCloseEvent()))

        Open0Action = QAction('&Открыть изображение',
                              self)  #QIcon('exit.png'),
        Open0Action.setShortcut('Ctrl+1')
        Open0Action.setStatusTip(
            'Результаты ВЭЗ предоставлены одиночными изображениями')
        Open0Action.triggered.connect(self.Op0)

        Open1Action = QAction('&Открыть папку изображений',
                              self)  #QIcon('exit.png'),
        Open1Action.setShortcut('Ctrl+2')
        Open1Action.setStatusTip(
            'Результаты ВЭЗ предоставлены одиночными изображениями')
        Open1Action.triggered.connect(lambda: self.Op12(0))

        Open2Action = QAction('&Открыть папку каталогов',
                              self)  #QIcon('exit.png'),
        Open2Action.setShortcut('Ctrl+3')
        Open2Action.setStatusTip('Результаты ВЭЗ предоставлены набором файлов')
        Open2Action.triggered.connect(lambda: self.Op12(1))

        Open3Action = QAction('&Открыть файл Ecxel', self)  #QIcon('exit.png'),
        Open3Action.setShortcut('Ctrl+4')
        Open3Action.setStatusTip('Результаты ВЭЗ файле Ecxel')
        Open3Action.triggered.connect(self.Op3)

        Open4Action = QAction('&Открыть файлы Ecxel',
                              self)  #QIcon('exit.png'),
        Open4Action.setShortcut('Ctrl+5')
        Open4Action.setStatusTip('Результаты ВЭЗ в нескольких файлах Ecxel')
        Open4Action.triggered.connect(self.Op4)

        NewPick = QAction("Добавить точку", self)
        NewPick.setShortcut('Ctrl+A')
        NewPick.setStatusTip('Добавить новую точку')
        NewPick.triggered.connect(self.NewPick)

        DelPick = QAction("Удалить точку", self)
        DelPick.setShortcut('Ctrl+D')
        DelPick.setStatusTip('Удалить точку из списка')
        DelPick.triggered.connect(self.DelPick)

        ReRead = QAction("Прочитать изображение", self)
        ReRead.setShortcut('Ctrl+R')
        ReRead.setStatusTip('Принудительно считывает информацию с изображения')
        ReRead.triggered.connect(self.ReReadImage)

        Select = QAction("Выбрать все точки", self)
        Select.setShortcut('Ctrl+W')
        Select.setStatusTip('Выбираем все точки из списка')
        Select.triggered.connect(self.select)

        ClearTable = QAction("Очистить таблицу", self)
        ClearTable.setShortcut('Ctrl+Shift+D')
        ClearTable.setStatusTip('Очищает текущую таблицу')
        ClearTable.triggered.connect(self.ClearTable)

        SetLvCheck = QAction("Установить lв выбранным точкам", self)
        SetLvCheck.setShortcut('Ctrl+E')
        SetLvCheck.setStatusTip('Изменяет lв выбраных точек на текущее')
        SetLvCheck.triggered.connect(self.SetLvCheck)

        SetTCheck = QAction("Установить t выбранным точкам", self)
        SetTCheck.setShortcut('Ctrl+T')
        SetTCheck.setStatusTip('Изменяет t выбраных точек на текущее')
        SetTCheck.triggered.connect(self.SetTCheck)

        Save1VEZExcel = QAction("Сохранить ВЭЗ в Excel", self)
        Save1VEZExcel.setShortcut('Ctrl+6')
        Save1VEZExcel.setStatusTip('Сохраняет выбраные ВЭЗ в Excel файл')
        Save1VEZExcel.triggered.connect(lambda: self.Save1VEZExcel(1))

        Save2VEZExcel = QAction("Сохранить Pэ в Excel", self)
        Save2VEZExcel.setShortcut('Ctrl+7')
        Save2VEZExcel.setStatusTip('Сохраняет выбраные Рэ в Excel файл')
        Save2VEZExcel.triggered.connect(lambda: self.Save1VEZExcel(2))

        Save3VEZExcel = QAction("Сохранить Pэ в Word", self)
        Save3VEZExcel.setShortcut('Ctrl+8')
        Save3VEZExcel.setStatusTip('Сохраняет выбраные Рэ в Word файл')
        Save3VEZExcel.triggered.connect(lambda: self.Save1VEZExcel(3))

        EditWord = QAction("Редактировать шаблон Word", self)
        EditWord.setShortcut('Ctrl+G')
        EditWord.setStatusTip('Запускает окно для редактирования шаблона Word')
        EditWord.triggered.connect(self.EditWord)

        zoomIn = QAction("Увеличить изображение", self)
        zoomIn.setShortcut('Ctrl++')
        zoomIn.setStatusTip('Увеличивает открытое изображение')
        zoomIn.triggered.connect(self.PaintForm.zoomIn)

        zoomOut = QAction("Уменьшить изображение", self)
        zoomOut.setShortcut('Ctrl+-')
        zoomOut.setStatusTip('Уменьшает открытое изображение')
        zoomOut.triggered.connect(self.PaintForm.zoomOut)

        Rotate1 = QAction("Повернуть изображение по ч.с", self)
        Rotate1.setShortcut('Ctrl+Shift++')
        Rotate1.setStatusTip('Поворачивает изображение по часовой стрелке')
        Rotate1.triggered.connect(lambda: self.PaintForm.Rotate(1))

        Rotate2 = QAction("Повернуть изображение против ч.с", self)
        Rotate2.setShortcut('Ctrl+Shift+-')
        Rotate2.setStatusTip(
            'Поворачивает изображение ппротив часовой стрелке')
        Rotate2.triggered.connect(lambda: self.PaintForm.Rotate(-1))

        NormalSize = QAction("Вернуть исходный размер", self)
        NormalSize.setShortcut('Ctrl+F')
        NormalSize.setStatusTip('Вернуть исходный размер изображения')
        NormalSize.triggered.connect(self.PaintForm.normalSize)

        fileMenu = menubar.addMenu('&Файл')
        fileMenu.addAction(Open0Action)
        fileMenu.addAction(Open1Action)
        fileMenu.addAction(Open2Action)
        fileMenu.addAction(Open3Action)
        fileMenu.addAction(Open4Action)
        fileMenu.addAction(exitAction)

        editMenu = menubar.addMenu('&Правка')
        editMenu.addAction(NewPick)
        editMenu.addAction(DelPick)
        editMenu.addAction(ReRead)
        editMenu.addAction(Select)
        editMenu.addAction(SetLvCheck)
        editMenu.addAction(SetTCheck)
        editMenu.addAction(ClearTable)

        imageMenu = menubar.addMenu('&Изображение')
        imageMenu.addAction(zoomIn)
        imageMenu.addAction(zoomOut)
        imageMenu.addAction(Rotate1)
        imageMenu.addAction(Rotate2)
        imageMenu.addAction(NormalSize)

        reportMenu = menubar.addMenu('&Отчёт')
        reportMenu.addAction(Save1VEZExcel)
        reportMenu.addAction(Save2VEZExcel)
        reportMenu.addAction(Save3VEZExcel)
        reportMenu.addAction(EditWord)

        self.setWindowTitle('VEZRead')
        self.setWindowIcon(QIcon('images\\op1.png'))

        self.d = {}
        self.sp_m = []
        self.file_path = []
        self.file_name = []
        self.arr = []
        self.stst = []
        self.arr_lv = []
        self.arr_t = []
        self.adres = None
        self.ski = QStandardItemModel()
        self.listView.setModel(self.ski)
        self.listView.pressed.connect(self.presseditem)

        self.sel = True
        self.block = True
        self.back_colors = ((255, 255, 255, 255), (255, 0, 0, 50),
                            (255, 255, 0, 50), (0, 255, 0, 50))

        self.pos_changed_cell = (0, 0)
Beispiel #50
0
    def initUI(self):

        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        wr = config.wr
        hr = config.wr

        tabs = QTabWidget()
        tabs.setStyleSheet(styles.tab_style)

        # ---------------------------------------------------------------------
        #                           PLOTTING TAB
        # ---------------------------------------------------------------------

        # Main plotting window
        splitter = QSplitter()

        plot_view = LayoutWidget(QGridLayout, margin=5, spacing=10)

        # Main plot window (row, column, row extent, column extent)
        self.plot = plot_view.addWidget(
            PlotCanvas(self, width=10 * wr, height=4 * hr, dpi=100 * wr), 0, 1,
            5, 5)
        shadow = QGraphicsDropShadowEffect(blurRadius=10 * wr,
                                           xOffset=3 * wr,
                                           yOffset=3 * hr)
        self.plot.setGraphicsEffect(shadow)
        self.plot.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        toolbar = plot_view.addWidget(QToolBar("Tools", self), 0, 0, 5, 1)
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setStyleSheet(styles.toolbar_style)

        toolbar_icons = [
            ":measure.svg", ":fit.svg", ":table.svg", ":correlations.svg",
            ":template.svg", ":normal.svg"
        ]
        toolbar_labels = [
            '&Measure', '&Fit', '&To Table', '&Correlations',
            '&Download Template', '&Statisitical Tests'
        ]
        toolbar_actions = [
            self.toggle_cursor, self.fit_curve, self.create_table,
            self.open_correlation, self.download_template, self.open_tests
        ]
        for i, icon in enumerate(toolbar_icons):
            toolbar_action = QAction(QIcon(icon), toolbar_labels[i], self)
            toolbar_action.triggered.connect(toolbar_actions[i])
            toolbar.addAction(toolbar_action)

        splitter.addWidget(plot_view.widget)

        data_entry = LayoutWidget(QVBoxLayout, margin=5, spacing=10)
        self.data_button, self.data_list, _, self.condition_data_list, _, self.calibration_file, _ = data_entry.addWidgets(
            [
                Button('Add Data',
                       tooltip='Import data for plotting',
                       clicked=self.open_data_files),
                List(scroll=True),
                TopLabel('Condition Data:'),
                List(scroll=True),
                Button('Add Calibration Curve',
                       tooltip='Set OD to CD conversion from file',
                       clicked=self.open_calibration_file),
                DelLabel('', clicked=self.remove_calibration_file),
                BigButton('Plot!',
                          tooltip='Plot the data!',
                          clicked=self.update_plot)
            ])

        self.data_button.setContextMenuPolicy(Qt.CustomContextMenu)
        self.data_button.customContextMenuRequested.connect(
            self.on_context_menu)

        self.clear_menu = QMenu(self)
        self.clear_action = QAction('Clear all', self)
        self.clear_menu.addAction(self.clear_action)

        self.calibration_file.setFixedHeight(40 * hr)

        splitter.addWidget(data_entry.widget)

        tabs.addTab(splitter, 'Plotting')

        # ---------------------------------------------------------------------
        #                           OPTIONS TABS
        # ---------------------------------------------------------------------

        # --------------- AXIS CONFIGURATION

        # Axis configuration
        axis_options = LayoutWidget(QVBoxLayout, style=styles.white_background)
        axis_h = LayoutWidget(QHBoxLayout)

        self.figure_title = axis_options.addWidget(TextEntry('Figure title:'))

        x_options = LayoutWidget(QVBoxLayout)
        x_options.addWidget(TopLabel('X (time):'))

        # X axis config
        x_form = Form()
        self.xaxis_dropdown, self.xaxis_name, self.xaxis_unit, self.xaxis_min, self.xaxis_max, self.xaxis_log = x_form.addRows(
            [
                DropDown('Variable:', config.xaxis_units, index=2),
                TextEntry('Label:'),
                TextEntry('Unit name:', tooltip='Enter "none" for no units'),
                TextEntry('Range min:', default=config.xmin),
                TextEntry('Range max:', default=config.xmax),
                CheckBox('Log scale')
            ],
            padding=[False, False, False, False, False, True])

        x_options.addWidget(x_form.widget)
        axis_h.addWidget(x_options.widget)

        y_options = LayoutWidget(QVBoxLayout)
        y_options.addWidget(TopLabel('Y (growth):'))
        # Y axis config
        y_form = Form()
        self.yaxis_dropdown, self.yaxis_name, self.yaxis_unit, self.yaxis_min, self.yaxis_max = y_form.addRows(
            [
                DropDown('Variable:', []),
                TextEntry('Label:'),
                TextEntry('Unit name:', tooltip='Enter "none" for no units'),
                TextEntry('Range min:', default=config.ymin),
                TextEntry('Range max:', default=config.ymax)
            ])

        # Y axis log scale
        ylog_hbox = LayoutWidget(QHBoxLayout)
        ylog_hbox.layout.setSpacing(15 * wr)
        ylog_hbox.layout.setContentsMargins(0, 0, 1 * wr, 1 * hr)
        self.yaxis_log, self.yaxis_normlog = ylog_hbox.addWidgets(
            [CheckBox('Log scale'),
             CheckBox('ln(Y/Y0)')])
        y_form.addRow(ylog_hbox.widget, pad=True)

        y_options.addWidget(y_form.widget)
        axis_h.addWidget(Spacer())
        axis_h.addWidget(y_options.widget)

        z_options = LayoutWidget(QVBoxLayout)
        z_options.addWidget(TopLabel('Y2 (conditions):'))
        # Condition Y axis drop down menu
        z_form = Form()
        self.condition_yaxis_dropdown, self.condition_yaxis_name, self.condition_yaxis_unit, self.condition_yaxis_min, self.condition_yaxis_max, self.condition_yaxis_log = z_form.addRows(
            [
                DropDown('Variable:', []),
                TextEntry('Label:'),
                TextEntry('Unit name:', tooltip='Enter "none" for no units'),
                TextEntry('Range min:', default=config.condition_ymin),
                TextEntry('Range max:', default=config.condition_ymax),
                CheckBox('Log scale')
            ],
            padding=[False, False, False, False, False, True])

        z_options.addWidget(z_form.widget)
        axis_h.addWidget(Spacer())
        axis_h.addWidget(z_options.widget)
        axis_options.addWidget(axis_h.widget)
        axis_options.addWidget(Spacer())

        tabs.addTab(axis_options.widget, 'Axes')

        # --------------- DATA CONFIGURATION

        # Data configuration options
        data_options = LayoutWidget(QHBoxLayout, style=styles.white_background)
        data_form = Form()

        self.smooth_data, self.align_data, self.y_alignment, self.initial_y, self.growth_average, self.condition_average, self.show_events = data_form.addRows(
            [
                CheckBox('Data smoothing off/on',
                         tooltip='Apply Savitzky-Golay to noisy data'),
                CheckBox('Alignment at time = 0 on/off',
                         tooltip='Start growth curves at 0 time'),
                TextEntry('Align at Y:',
                          default=config.y_alignment,
                          tooltip='Align all growth curves at given Y value'),
                TextEntry('Set initial Y:',
                          default=config.initial_y,
                          tooltip='Start growth curves at a given Y value'),
                TextEntry('Growth data time average:',
                          default=config.growth_average,
                          tooltip='Average over a given time window'),
                TextEntry('Condition data time average:',
                          default=config.condition_average,
                          tooltip='Average over a given time window'),
                CheckBox('Show events off/on')
            ],
            padding=[True, True, False, False, False, False, True])

        data_options.addWidget(data_form.widget)

        # Remove any obvious outliers from the growth data
        outlier_options = LayoutWidget(QVBoxLayout)
        outlier_options.addWidget(TopLabel('Data outliers:'))
        outlier_form = Form()
        self.auto_remove, self.remove_above, self.remove_below = outlier_form.addRows(
            [
                CheckBox('Auto-remove outliers off/on'),
                TextEntry('Remove above:', default=config.remove_above),
                TextEntry('Remove below:', default=config.remove_below)
            ],
            padding=[True, False, False])
        outlier_options.addWidget(outlier_form.widget)
        outlier_options.addWidget(Spacer())

        data_options.addWidget(outlier_options.widget)
        data_options.addWidget(Spacer())

        tabs.addTab(data_options.widget, 'Data')

        # --------------- LEGEND CONFIGURATION

        # Legend configuration options
        legend_options = LayoutWidget(QHBoxLayout,
                                      style=styles.white_background)

        # Legend on/off checkbox
        growth_options = LayoutWidget(QVBoxLayout)
        growth_options.addWidget(TopLabel('Growth Legend:'))
        growth_form = Form()
        self.legend_toggle, self.legend_names, self.legend_title, self.extra_info, self.only_extra = growth_form.addRows(
            [
                CheckBox('Legend on'),
                DropDown(
                    'Labels:', [],
                    tooltip='Edit names by changing text and pressing return',
                    edit=True),
                TextEntry(
                    'Heading:',
                    tooltip='Show extra information from the file in the legend'
                ),
                DropDown('Extra text:', config.info_options),
                CheckBox('Remove labels')
            ],
            padding=[True, False, False, False, True])

        growth_options.addWidget(growth_form.widget)
        growth_options.addWidget(Spacer())
        legend_options.addWidget(growth_options.widget)

        # Condition legend configuration
        condition_options = LayoutWidget(QVBoxLayout)
        condition_options.addWidget(TopLabel('Condition legend:'))
        condition_form = Form()
        self.condition_legend_toggle, self.condition_legend_names, self.condition_legend_title, self.condition_extra_info, self.condition_only_extra = condition_form.addRows(
            [
                CheckBox('Legend on'),
                DropDown(
                    'Labels:', [],
                    tooltip='Edit names by changing text and pressing return',
                    edit=True),
                TextEntry('Heading:'),
                DropDown(
                    'Extra text:',
                    config.info_options,
                    tooltip='Show extra information from the file in the legend'
                ),
                CheckBox('Remove labels')
            ],
            padding=[True, False, False, False, True])

        condition_options.addWidget(condition_form.widget)
        condition_options.addWidget(Spacer())
        legend_options.addWidget(condition_options.widget)
        legend_options.addWidget(Spacer())

        tabs.addTab(legend_options.widget, 'Legend')

        # --------------- STYLE CONFIGURATION

        # Style configuration
        style_options = LayoutWidget(QHBoxLayout,
                                     style=styles.white_background)

        # Plot style dropdown menu
        style_form = Form(align=True)
        self.style_dropdown, self.font_dropdown, self.axis_colour, self.grid_toggle = style_form.addRows(
            [
                DropDown('Style:', config.style_options),
                DropDown('Font style:', config.font_options),
                TextEntry('Condition axis color:'),
                CheckBox('Grid on/off')
            ],
            padding=[False, False, False, True])

        style_options.addWidget(style_form.widget)

        # Sized
        style_numeric_form = Form(align=True)
        self.title_size, self.legend_size, self.label_size, self.line_width, self.marker_size, self.capsize, self.save_dpi = style_numeric_form.addRows(
            [
                SpinBox('Title font size:',
                        start=config.title_size,
                        min_val=0,
                        max_val=100),
                SpinBox('Legend font size:',
                        start=config.legend_size,
                        min_val=0,
                        max_val=100),
                SpinBox('Label font size:',
                        start=config.label_size,
                        min_val=0,
                        max_val=100),
                SpinBox('Line width:',
                        start=config.line_width,
                        min_val=0,
                        max_val=20),
                SpinBox('Marker size:',
                        start=config.marker_size,
                        min_val=0,
                        max_val=20),
                SpinBox('Error cap size:',
                        start=config.capsize,
                        min_val=0,
                        max_val=20),
                SpinBox('Saved figure DPI:',
                        start=config.save_dpi,
                        min_val=10,
                        max_val=2000)
            ])

        style_options.addWidget(style_numeric_form.widget)

        tabs.addTab(style_options.widget, 'Style')

        # --------------- STATS CONFIGURATION

        # Stats configuration
        stats_form = Form(align=True, style=styles.white_background)
        self.std_err, self.sig_figs, self.show_fit_text, self.show_fit_result, self.show_fit_errors = stats_form.addRows(
            [
                RadioButton(
                    'Standard deviation',
                    'Standard error',
                    tooltip=
                    'Show standard deviation or the standard error on the mean in plots and measurements'
                ),
                SpinBox('Significant figures:',
                        start=config.sig_figs,
                        min_val=0,
                        max_val=20),
                CheckBox(
                    'Show fit model text',
                    tooltip='Checked = display equation for fitted model\n'
                    'Unchecked = don'
                    't display equation'),
                CheckBox(
                    'Show fit parameters',
                    tooltip='Checked = show fitted values of model parameters\n'
                    'Unchecked = don'
                    't show fit parameters'),
                CheckBox(
                    'Show fit errors',
                    tooltip='Checked = show uncertainties on fit parameters\n'
                    'Unchecked = don'
                    't show uncertainties')
            ],
            padding=[True, False, True, True, True])

        tabs.addTab(stats_form.widget, 'Stats')

        # --------------- ADVANCED CONFIGURATION

        # Advanced configuration
        advanced_options = LayoutWidget(QHBoxLayout,
                                        style=styles.white_background)

        sg_form = Form(align=True, style=styles.white_background)
        _, self.sg_window_size, self.sg_order, self.sg_deriv, self.sg_rate = sg_form.addRows(
            [
                TopLabel('Savitsky-Golay smoothing:'),
                TextEntry('Window size', default=config.sg_window_size),
                TextEntry('Order of polynomial', default=config.sg_order),
                TextEntry('Order of derivative', default=config.sg_deriv),
                TextEntry('Sample spacing', default=config.sg_rate)
            ])

        adv_outlier_form = Form(align=True, style=styles.white_background)
        self.outlier_threshold = adv_outlier_form.addRow(
            TextEntry('Auto outlier threshold',
                      default=config.outlier_threshold))

        advanced_options.addWidget(sg_form.widget)
        advanced_options.addWidget(adv_outlier_form.widget)
        tabs.addTab(advanced_options.widget, 'Advanced')

        # ----------------------------------
        self.setCentralWidget(tabs)
        self.show()
Beispiel #51
0
 def icon(self):
     return QIcon(":/plugins/crayfish/images/crayfish.png")
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/EspuConsulte/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
Beispiel #53
0
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QToolTip
from PyQt5.QtGui import QIcon, QFont
import sys


class Tooltip(QMainWindow):
    def __init__(self):
        super(Tooltip, self).__init__()
        QToolTip.setFont(QFont("SansSerif", 12))
        self.setToolTip("要加油")
        self.setGeometry(300, 300, 200, 200)
        self.setWindowTitle("提示信息")


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Tooltip()
    app.setWindowIcon(QIcon("../Image/1.jpg"))
    window.show()
    sys.exit(app.exec_())
Beispiel #54
0
 def icon(self):
     return QIcon()
Beispiel #55
0
 def set_icons(self):
     self.ui.action_new.setIcon(
         QIcon.fromTheme('document-new', QIcon(':/icons/document-new.svg')))
     self.ui.action_open.setIcon(
         QIcon.fromTheme('document-open',
                         QIcon(':/icons/document-open.svg')))
     self.ui.action_save.setIcon(
         QIcon.fromTheme('document-save',
                         QIcon(':/icons/document-save.svg')))
     self.ui.action_save_as.setIcon(
         QIcon.fromTheme('document-save-as',
                         QIcon(':/icons/document-save-as.svg')))
     self.ui.action_close.setIcon(
         QIcon.fromTheme('window-close', QIcon(':/icons/window-close.svg')))
     self.ui.action_quit.setIcon(
         QIcon.fromTheme('application-exit',
                         QIcon(':/icons/application-exit.svg')))
     self.ui.action_undo.setIcon(
         QIcon.fromTheme('edit-undo', QIcon(':/icons/edit-undo.svg')))
     self.ui.action_redo.setIcon(
         QIcon.fromTheme('edit-redo', QIcon(':/icons/edit-redo.svg')))
     self.ui.action_print.setIcon(
         QIcon.fromTheme('document-print',
                         QIcon(':/icons/document-print.svg')))
     self.ui.action_properties.setIcon(
         QIcon.fromTheme('document-properties',
                         QIcon(':/icons/document-properties.svg')))
Beispiel #56
0
 def create_toolbar(self):
     exitAct = QAction(QIcon.fromTheme('exit'), 'Exit', self)
     exitAct.setShortcut('Ctrl+Q')
     exitAct.triggered.connect(qApp.quit)
     self.toolbar = self.addToolBar('Exit')
     self.toolbar.addAction(exitAct)
Beispiel #57
0
    def __init__(self):
        # Inicialización de la ventana
        super().__init__()
        self.setWindowTitle("Gestión de libros")
        self.setWindowIcon(QIcon("static/icono_CEIC.png"))
        self.setStyleSheet('background-color: rgb(236, 240, 241)')

        # Base de datos
        self.db = QSqlDatabase.database('qt_sql_default_connection')
        self.db.setHostName("localhost")
        self.db.setDatabaseName("pruebaceic")
        self.db.setUserName("postgres")
        self.db.setPassword("postgres")
        self.db.open()

        # Creación de fonts para las letras
        self.titleFont = QFont("Serif", 20)
        self.titleFont.setBold(True)
        self.labelFont = QFont("Helvetica", 13)
        self.labelFont.setBold(True)
        self.buttonFont = QFont("Arial", 12)
        self.buttonFont.setBold(True)

        # Título
        self.title = QLabel(self)
        self.title.setText("Agregar Libro")
        self.title.setStyleSheet('color: rgb(30, 39, 46)')
        self.title.setFont(self.titleFont)
        self.title.setGeometry(10, 15, 570, 50)

        # Línea debajo del título
        self.line = QtWidgets.QFrame(self)
        self.line.setGeometry(QtCore.QRect(10, 55, 820, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")

        # Line edits
        self.IDInput = QLineEdit(self)
        self.titleBookInput = QLineEdit(self)
        self.authorsLabel = QLabel(self)
        self.authorsLabel.setText("  Autor")
        self.authorsInput = QComboBox(self)
        self.ISBNInput = QLineEdit(self)
        self.quantityInput = QLineEdit(self)

        # CSS, PlaceholderText y posicionamiento de los line edits
        self.IDInput.setStyleSheet('background-color: white; border-radius: 20px; border: 1px solid rgb(210, 218, 226); font: 16px;')
        self.IDInput.setPlaceholderText(" Ingrese el código de identificación del libro")
        self.IDInput.setGeometry(130, 150, 600, 50)

        self.titleBookInput.setStyleSheet('background-color: white; border-radius: 20px; border: 1px solid rgb(210, 218, 226); font: 16px;')
        self.titleBookInput.setPlaceholderText(" Ingrese el título del libro")
        self.titleBookInput.setGeometry(130, 220, 600, 50)  

        self.authorsLabel.setGeometry(130, 290, 200, 50)
        self.authorsLabel.setStyleSheet('color: rgb(79, 90, 94)')
        self.authorsLabel.setFont(self.labelFont)
        self.authorsInput.setGeometry(200, 290, 530, 50)
        self.authorsInput.setStyleSheet('background-color: white; border: 1px solid rgb(210, 218, 226); border-radius: 20px;')

        self.ISBNInput.setStyleSheet('background-color: white; border-radius: 20px; border: 1px solid rgb(210, 218, 226); font: 16px;')
        self.ISBNInput.setPlaceholderText(" Ingrese el ISBN del libro")
        self.ISBNInput.setGeometry(130, 360, 600, 50)

        self.quantityInput.setStyleSheet('background-color: white; border-radius: 20px; border: 1px solid rgb(210, 218, 226); font: 16px;')
        self.quantityInput.setPlaceholderText(" Ingrese el número de ejemplares que tiene el libro")
        self.quantityInput.setGeometry(130, 430, 600, 50)

        # Botones
        self.agregarAutor = QPushButton(self)
        self.agregarAutor.setText("Agregar autor")
        self.agregarAutor.setFont(self.buttonFont)
        self.agregarAutor.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.agregarAutor.setGeometry(130, 520, 300, 35)

        self.agregarLibro = QPushButton(self)
        self.agregarLibro.setText("Agregar libro")
        self.agregarLibro.setFont(self.buttonFont)
        self.agregarLibro.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.agregarLibro.setGeometry(432, 520, 300, 35)

        self.cancelar = QPushButton(self)
        self.cancelar.setText("Cancelar")
        self.cancelar.setFont(self.buttonFont)
        self.cancelar.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.cancelar.setGeometry(130, 565, 600, 35)

        # CSS Botones
        self.agregarLibro.setStyleSheet("QPushButton:hover\n"
                                  "{\n"
                                  "    background-color: rgb(55, 162, 228);\n"
                                  "}\n"
                                  "\n"
                                  "QPushButton:pressed\n"
                                  "{\n"
                                  "    background-color: rgb(35, 142, 208);\n"
                                  "}\n"
                                  "QPushButton\n"
                                  "{\n"
                                  "    border-radius: 15px;\n"
                                  "    background-color: rgb(45, 152, 218);\n"
                                  "    color: white;\n"
                                  "}")

        self.agregarAutor.setStyleSheet("QPushButton:hover\n"
                                  "{\n"
                                  "    background-color: rgb(22, 46, 107);\n"
                                  "}\n"
                                  "\n"
                                  "QPushButton:pressed\n"
                                  "{\n"
                                  "    background-color: rgb(2, 26, 87);\n"
                                  "}\n"
                                  "QPushButton\n"
                                  "{\n"
                                  "    border-radius: 15px;\n"
                                  "    background-color: rgb(12, 36, 97);\n"
                                  "    color: white;\n"
                                  "}")

        self.cancelar.setStyleSheet("QPushButton:hover\n"
                                  "{\n"
                                  "    background-color: #C20000;\n"
                                  "}\n"
                                  "\n"
                                  "QPushButton:pressed\n"
                                  "{\n"
                                  "    background-color: #CC0000;\n"
                                  "}\n"
                                  "QPushButton\n"
                                  "{\n"
                                  "    border-radius: 15px;\n"
                                  "    background-color: #F10000;\n"
                                  "    color: white;\n"
                                  "}")

        self.mostrarAutores()

        # Conexiones de botones
        self.cancelar.clicked.connect(self.clean)
        self.agregarLibro.clicked.connect(self.AgregarLibro)
        self.authorsInput.activated[str].connect(self.seleccion)

        # Raise
        self.title.raise_()
        self.line.raise_()
    def __init__(self, parent: DetectVideoApp = None):
        super().__init__()
        self.parent = parent
        self.args = argparse.Namespace()
        self.args.is_classifier = False
        self.classifier_cfg = None
        self.classifier_weights = None
        self.setWindowIcon(QIcon('../images/Logo.png'))
        layout = QVBoxLayout()

        self.startDir = os.getcwd()
        # Create video selector
        self.useWebCam = QCheckBox("Use web cam")
        self.useWebCam.setChecked(False)
        self.useWebCamLabel = QLabel("Use web cam")
        self.useWebCam.stateChanged.connect(self.use_webcam_clicked)
        horizontal_layout = QHBoxLayout()
        horizontal_layout.addWidget(self.useWebCamLabel)
        horizontal_layout.addWidget(self.useWebCam, alignment=Qt.AlignLeft)
        horizontal_layout.addStretch(1)
        self.btnIm = QPushButton("Select video to detect")
        self.btnIm.clicked.connect(self.get_video)
        self.textIm = QTextEdit()
        layout.addLayout(horizontal_layout, 1)
        layout.addStretch(1)
        layout.addLayout(SelectQPushButton(self.btnIm), 1)
        layout.addLayout(SelectQText(self.textIm), 2)
        layout.addStretch(1)
        self.textIm.setReadOnly(True)

        # Select data set
        self.select_ds_label = QLabel("Select dataset")
        self.select_ds = DataSetsManager.get_data_set_combo()
        self.select_ds.setObjectName("SelectCombo")
        self.select_ds.currentTextChanged.connect(self.on_data_set_changed)
        layout.addLayout(SelectQCombo(self.select_ds_label, self.select_ds), 2)
        layout.addStretch(1)
        # Select weights file
        self.btnW = QPushButton("Select weights file")
        self.btnW.clicked.connect(self.get_weights)
        self.textW = QLineEdit()
        self.textW.setReadOnly(True)
        layout.addLayout(SelectQPushButton(self.btnW), 1)
        layout.addLayout(SelectQPushButton(self.textW), 1)
        layout.addStretch(1)
        # Select Config file
        self.btnConf = QPushButton("Select Config file")
        self.btnConf.clicked.connect(self.get_config)
        self.textConf = QLineEdit()
        self.textConf.setReadOnly(True)
        layout.addLayout(SelectQPushButton(self.btnConf), 1)
        layout.addLayout(SelectQText(self.textConf), 1)
        layout.addStretch(1)
        # Select Names file
        self.btnNames = QPushButton("Select Names file")
        self.btnNames.clicked.connect(self.get_names)
        self.textNames = QLineEdit()
        self.textNames.setReadOnly(True)
        layout.addLayout(SelectQPushButton(self.btnNames), 1)
        layout.addLayout(SelectQText(self.textNames), 1)
        layout.addStretch(1)
        bs_label = QLabel('Batch size')
        conf_label = QLabel('Confidence')
        nms_label = QLabel('Nms threshold')
        res_label = QLabel('Resolution')

        self.bsEdit = QLineEdit()
        self.confEdit = QLineEdit()
        self.nmsEdit = QLineEdit()
        self.resEdit = QLineEdit()

        self.bsEdit.setText("1")
        self.confEdit.setText("0.5")
        self.nmsEdit.setText("0.4")
        self.resEdit.setText("416")

        self.textIm.setText("../vid1_Driving_in_Gothenburg_Sweden.mp4")
        self.args.video = "../vid1_Driving_in_Gothenburg_Sweden.mp4"
        self.on_data_set_changed('Swedish')
        self.select_ds.setCurrentText('Swedish')

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(bs_label, 1, 0)
        grid.addWidget(conf_label, 2, 0)
        grid.addWidget(nms_label, 3, 0)
        grid.addWidget(res_label, 4, 0)

        grid.addWidget(self.bsEdit, 1, 1)
        grid.addWidget(self.confEdit, 2, 1)
        grid.addWidget(self.nmsEdit, 3, 1)
        grid.addWidget(self.resEdit, 4, 1)

        grid.setColumnStretch(0, 1)
        grid.setColumnStretch(1, 1)
        grid.setColumnStretch(2, 2)

        layout.addLayout(grid, 5)

        tracking_layout = QHBoxLayout()
        self.use_tracking = QCheckBox("Use tracking")
        self.use_tracking.setChecked(True)
        self.use_tracking_label = QLabel("Use tracking: ")
        self.use_tracking.stateChanged.connect(self.use_tracking_clicked)
        tracking_layout.addWidget(self.use_tracking_label)
        tracking_layout.addWidget(self.use_tracking)
        tracking_layout.addStretch(1)
        layout.addLayout(tracking_layout, 1)

        self.tracking = None
        self.select_tracking_label = QLabel("Select tracking")
        self.select_tracking = QComboBox()
        self.select_tracking.setItemDelegate(QStyledItemDelegate())
        self.select_tracking.setObjectName("SelectCombo")
        self.select_tracking.addItems(["Sort", "Deep Sort"])
        self.select_tracking.currentIndexChanged.connect(self.selection_tracking_change)
        self.select_tracking.setCurrentIndex(1)
        layout.addLayout(SelectQCombo(self.select_tracking_label, self.select_tracking), 2)

        count_layout = QHBoxLayout()
        self.count_enabled = False
        self.use_count = QCheckBox("Count performance")
        self.use_count.setChecked(False)
        self.use_count_label = QLabel("Count statistics: ")
        count_layout.addWidget(self.use_count_label)
        count_layout.addWidget(self.use_count)
        count_layout.addStretch(1)
        layout.addLayout(count_layout, 1)

        layout.addStretch(1)

        back_button = QPushButton("Back")
        ok_button = QPushButton("OK")
        cancel_button = QPushButton("Cancel")
        hor_box = QHBoxLayout()
        hor_box.addWidget(back_button, alignment=Qt.AlignLeft)
        hor_box.addStretch(2)
        hor_box.addWidget(ok_button)
        hor_box.addWidget(cancel_button)
        back_button.clicked.connect(self.back_detection)
        ok_button.clicked.connect(self.start_detection)
        cancel_button.clicked.connect(cancel_detection)
        layout.addLayout(hor_box, 2)

        self.setLayout(layout)
    def initUI(self):

        #menu statusbar
        self.statusBar().showMessage('Ready')
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('File')
        editMenu = menubar.addMenu('Edit')

        impMenu = QMenu('Import', self)
        impAct = QAction('Import mail', self)
        impMenu.addAction(impAct)

        newAct = QAction('New', self)

        fileMenu.addAction(newAct)
        fileMenu.addMenu(impMenu)

        #toolbar
        exitAct = QAction(QIcon('exit.png'), 'Exit', self)
        exitAct.setShortcut('Ctrl+Q')
        exitAct.triggered.connect(qApp.quit)

        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exitAct)

        self.setMinimumSize(QSize(180, 180))
        self.setWindowTitle("PyQt")
        self.setWindowIcon(QIcon('exit.png'))

        # Create Main Widget
        mainwidget = QWidget()
        self.setCentralWidget(mainwidget)

        grid = QGridLayout()
        mainwidget.setLayout(grid)
        # Buttons
        b1 = QPushButton('QUIT', self)
        b2 = QPushButton('button with long text', self)
        grid.addWidget(b1, 1, 1)
        grid.addWidget(b2, 2, 1)
        # Enter fields
        t1 = QLabel('text input')
        t2 = QLabel('multiline input')
        t1f = QLineEdit()
        t2f = QTextEdit()
        t2f.resize(50, 250)

        grid.addWidget(t1, 3, 0)
        grid.addWidget(t1f, 3, 1)
        grid.addWidget(t2, 4, 0)
        grid.addWidget(t2f, 4, 1)
        #Listbox
        l1t = QLabel('list')
        l1 = QListWidget(self)
        l1.resize(50, 50)
        for i in range(6):
            l1.addItem('alt%s' % (i + 1))
        grid.addWidget(l1t, 5, 0)
        grid.addWidget(l1, 5, 1)
        #Combo
        c1t = QLabel('combo')
        c1 = QComboBox(self)
        for i in range(6):
            c1.addItem('alt%s' % (i + 1))
        grid.addWidget(c1t, 6, 0)
        grid.addWidget(c1, 6, 1)
        #Radio
        groupBox = QGroupBox('Radio')
        layout = QHBoxLayout()
        self.b1 = QRadioButton("One")
        self.b1.setChecked(True)
        self.b1.toggled.connect(lambda: self.btnstate(self.b1))
        layout.addWidget(self.b1)

        self.b2 = QRadioButton("Two")
        self.b2.toggled.connect(lambda: self.btnstate(self.b2))
        layout.addWidget(self.b2)
        groupBox.setLayout(layout)
        grid.addWidget(groupBox, 7, 1)
        #Checkbox
        cb = QCheckBox('toggle', self)
        grid.addWidget(cb, 8, 0)
        #Slider
        s1t = QLabel('slider')
        s1 = QSlider(Qt.Horizontal)
        grid.addWidget(s1t, 9, 0)
        grid.addWidget(s1, 9, 1)
        #progress
        p1t = QLabel('progress')
        p1 = QProgressBar(self)
        p1.setValue(40)
        grid.addWidget(p1t, 10, 0)
        grid.addWidget(p1, 10, 1)
Beispiel #60
0
    def __init__(self, mode):
        super(MainWindow, self).__init__()
        # Running mode of this gui. Options:
        #  - server-gui: Normal mode, starts bluesky server together with gui
        #  - client: starts only gui in client mode, can connect to existing
        #    server.
        self.mode = mode

        self.radarwidget = RadarWidget()
        self.nd = ND(shareWidget=self.radarwidget)
        self.infowin = InfoWindow()

        try:
            self.docwin = DocWindow(self)
        except Exception as e:
            print('Couldnt make docwindow:', e)
        # self.aman = AMANDisplay()
        gltimer = QTimer(self)
        gltimer.timeout.connect(self.radarwidget.updateGL)
        gltimer.timeout.connect(self.nd.updateGL)
        gltimer.start(50)

        if is_osx:
            app.instance().setWindowIcon(
                QIcon(os.path.join(bs.settings.gfx_path, 'bluesky.icns')))
        else:
            app.instance().setWindowIcon(
                QIcon(os.path.join(bs.settings.gfx_path, 'icon.gif')))

        uic.loadUi(os.path.join(bs.settings.gfx_path, 'mainwindow.ui'), self)

        # list of buttons to connect to, give icons, and tooltips
        #           the button         the icon      the tooltip    the callback
        buttons = {
            self.zoomin: ['zoomin.svg', 'Zoom in', self.buttonClicked],
            self.zoomout: ['zoomout.svg', 'Zoom out', self.buttonClicked],
            self.panleft: ['panleft.svg', 'Pan left', self.buttonClicked],
            self.panright: ['panright.svg', 'Pan right', self.buttonClicked],
            self.panup: ['panup.svg', 'Pan up', self.buttonClicked],
            self.pandown: ['pandown.svg', 'Pan down', self.buttonClicked],
            self.ic: ['stop.svg', 'Initial condition', self.buttonClicked],
            self.op: ['play.svg', 'Operate', self.buttonClicked],
            self.hold: ['pause.svg', 'Hold', self.buttonClicked],
            self.fast: ['fwd.svg', 'Enable fast-time', self.buttonClicked],
            self.fast10:
            ['ffwd.svg', 'Fast-forward 10 seconds', self.buttonClicked],
            self.sameic: ['frwd.svg', 'Restart same IC', self.buttonClicked],
            self.showac: ['AC.svg', 'Show/hide aircraft', self.buttonClicked],
            self.showpz: ['PZ.svg', 'Show/hide PZ', self.buttonClicked],
            self.showapt:
            ['apt.svg', 'Show/hide airports', self.buttonClicked],
            self.showwpt:
            ['wpt.svg', 'Show/hide waypoints', self.buttonClicked],
            self.showlabels:
            ['lbl.svg', 'Show/hide text labels', self.buttonClicked],
            self.showmap:
            ['geo.svg', 'Show/hide satellite image', self.buttonClicked],
            self.shownodes:
            ['nodes.svg', 'Show/hide node list', self.buttonClicked]
        }

        for b in buttons.items():
            # Set icon
            if not b[1][0] is None:
                icon = QIcon(
                    os.path.join(bs.settings.gfx_path, 'icons/' + b[1][0]))
                b[0].setIcon(icon)
            # Set tooltip
            if not b[1][1] is None:
                b[0].setToolTip(b[1][1])
            # Connect clicked signal
            b[0].clicked.connect(b[1][2])

        # Link menubar buttons
        self.action_Open.triggered.connect(self.show_file_dialog)
        self.action_Save.triggered.connect(self.buttonClicked)
        self.actionBlueSky_help.triggered.connect(self.show_doc_window)

        self.radarwidget.setParent(self.centralwidget)
        self.verticalLayout.insertWidget(0, self.radarwidget, 1)
        # Connect to io client's nodelist changed signal
        bs.net.nodes_changed.connect(self.nodesChanged)
        bs.net.actnodedata_changed.connect(self.actnodedataChanged)
        bs.net.event_received.connect(self.on_simevent_received)
        bs.net.stream_received.connect(self.on_simstream_received)
        bs.net.signal_quit.connect(self.closeEvent)

        self.nodetree.setVisible(False)
        self.nodetree.setIndentation(0)
        self.nodetree.setColumnCount(2)
        self.nodetree.setStyleSheet('padding:0px')
        self.nodetree.setAttribute(Qt.WA_MacShowFocusRect, False)
        self.nodetree.header().resizeSection(0, 130)
        self.nodetree.itemClicked.connect(self.nodetreeClicked)
        self.maxhostnum = 0
        self.hosts = dict()
        self.nodes = dict()

        fgcolor = '#%02x%02x%02x' % fg
        bgcolor = '#%02x%02x%02x' % bg

        self.stackText.setStyleSheet('color:' + fgcolor +
                                     '; background-color:' + bgcolor)
        self.lineEdit.setStyleSheet('color:' + fgcolor +
                                    '; background-color:' + bgcolor)

        self.nconf_cur = self.nconf_tot = self.nlos_cur = self.nlos_tot = 0

        app.instance().installEventFilter(self)