Example #1
0
    def cal1(self):
        self.num7 = QPushButton("7", self)
        self.num7.setGeometry(250, 250, 100, 50)
        self.num8 = QPushButton("8", self)
        self.num8.setGeometry(350, 250, 100, 50)
        self.num9 = QPushButton("9", self)
        self.num9.setGeometry(450, 250, 100, 50)
        self.num4 = QPushButton("4", self)
        self.num4.setGeometry(250, 300, 100, 50)
        self.num5 = QPushButton("5", self)
        self.num5.setGeometry(350, 300, 100, 50)
        self.num6 = QPushButton("6", self)
        self.num6.setGeometry(450, 300, 100, 50)
        self.num1 = QPushButton("1", self)
        self.num1.setGeometry(250, 350, 100, 50)
        self.num2 = QPushButton("2", self)
        self.num2.setGeometry(350, 350, 100, 50)
        self.num3 = QPushButton("3", self)
        self.num3.setGeometry(450, 350, 100, 50)
        self.num0 = QPushButton("0", self)
        self.num0.setGeometry(250, 400, 100, 50)
        self.numm1 = QPushButton("Pow", self)
        self.numm1.setGeometry(350, 400, 100, 50)
        self.numm2 = QPushButton(".", self)
        self.numm2.setGeometry(450, 400, 100, 50)
        self.numm3 = QPushButton("/", self)
        self.numm3.setGeometry(550, 250, 100, 50)
        self.numm4 = QPushButton("x", self)
        self.numm4.setGeometry(550, 300, 100, 50)
        self.numm5 = QPushButton("-", self)
        self.numm5.setGeometry(550, 350, 100, 50)
        self.numm6 = QPushButton("+", self)
        self.numm6.setGeometry(550, 400, 100, 50)

        self.numm7 = QPushButton("Clear", self)
        self.numm7.setGeometry(250, 450, 200, 50)
        self.line = QLineEdit(self)
        self.line.setGeometry(250, 190, 100, 35)
        self.line1 = QLineEdit(self)
        self.line1.setGeometry(360, 190, 100, 35)
        self.line2 = QLineEdit(self)
        self.line2.setGeometry(500, 190, 150, 35)
        self.label = QLabel("=", self)
        self.label.move(480, 190)
        self.numm8 = QPushButton("Mod", self)
        self.numm8.setGeometry(450, 450, 200, 50)

        self.setWindowTitle(self.tit)
        self.setGeometry(self.top, self.bot, self.wid, self.hei)
        if self.numm6.isEnabled():
            self.numm6.clicked.connect(self.addition)
        if self.numm5.isEnabled():
            self.numm5.clicked.connect(self.sub)
        if self.numm4.isEnabled():
            self.numm4.clicked.connect(self.mul)
        if self.numm3.isEnabled():
            self.numm3.clicked.connect(self.div)
        if self.numm1.isEnabled():
            self.numm1.clicked.connect(self.pow)
        if self.numm8.isEnabled():
            self.numm8.clicked.connect(self.mod)
        # if self.line.isEnabled():
        #     if self.num0.isEnabled():
        #         self.line.text()==0
        self.brow = QWebEngineView()

        noni = QToolBar("navigation")
        noni.setIconSize(QSize(20, 20))
        self.addToolBar(noni)
        back = QAction(QIcon(os.path.join('back.png')), "back", self)
        back.setStatusTip("back to Previous Page")
        back.triggered.connect(self.bac1)
        noni.addAction(back)
        forward = QAction(QIcon(os.path.join('forward.png')), "Forward", self)
        forward.setStatusTip("back to Previous Page")
        forward.triggered.connect(self.brow.forward)
        noni.addAction(forward)
Example #2
0
    def __init__(self, parent=None, loglevel=logging.INFO):
        """**Constructor**"""
        super().__init__(loglevel=loglevel)
        QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        CmdBase.mode = CmdMode.GUI  #set GUI mode
        self.setupUi(self)

        if CmdBase.calcmode == CalcMode.singlethread:
            self.setWindowTitle('RepTate ' + self.version + ' ' + self.date +
                                ' - SINGLE THREAD!!')
        else:
            self.setWindowTitle('RepTate ' + self.version + ' ' + self.date)

        # Add Apps
        self.toolBarApps.addAction(self.actionMWD)
        tbut = QToolButton()
        tbut.setPopupMode(QToolButton.MenuButtonPopup)
        tbut.setDefaultAction(self.actionTTS)
        menu = QMenu()
        menu.addAction(self.actionTTSFactors)
        tbut.setMenu(menu)
        self.toolBarApps.addWidget(tbut)
        self.toolBarApps.addAction(self.actionLVE)
        self.toolBarApps.addAction(self.actionNLVE)
        self.toolBarApps.addAction(self.actionCrystal)
        self.toolBarApps.addAction(self.actionGt)
        self.toolBarApps.addAction(self.actionCreep)
        self.toolBarApps.addAction(self.actionSANS)
        self.toolBarApps.addAction(self.actionReact)
        self.toolBarApps.addAction(self.actionDielectric)
        # self.toolBarApps.addAction(self.actionDynamicStructureFactor)
        self.toolBarApps.addAction(self.actionLAOS)

        #help button
        icon = QIcon(':/Icon8/Images/new_icons/icons8-user-manual.png')
        #self.show_reptate_help = QAction(icon, 'RepTate Manual', self)
        #self.show_app_help = QAction(icon, 'Application Manual', self)
        #self.show_th_help = QAction(icon, 'Theory Manual', self)
        tbut = QToolButton()
        tbut.setPopupMode(QToolButton.MenuButtonPopup)
        tbut.setDefaultAction(self.actionShow_reptate_help)
        menu = QMenu()
        menu.addAction(self.actionShow_app_help)
        menu.addAction(self.actionShow_th_help)
        menu.addAction(self.actionShow_offline_help)
        tbut.setMenu(menu)
        #self.toolBarHelpAbout.insertWidget(self.actionAbout_Qt, tbut)
        self.toolBarHelpAbout.addWidget(tbut)
        self.toolBarHelpAbout.addSeparator()

        self.toolBarHelpAbout.addAction(self.actionShow_Logger)

        tbut = QToolButton()
        tbut.setPopupMode(QToolButton.MenuButtonPopup)
        tbut.setDefaultAction(self.actionAbout)
        menu = QMenu()
        menu.addAction(self.actionAbout_Qt)
        menu.addAction(self.actionAboutMatplotlib)
        menu.addAction(self.actionAboutNumpy)
        menu.addAction(self.actionAboutScipy)
        menu.addSeparator()
        menu.addAction(self.actionCite_RepTate)
        menu.addAction(self.actionCheckRepTateVersion)
        tbut.setMenu(menu)
        self.toolBarHelpAbout.addWidget(tbut)

        self.toolBarHelpAbout.insertSeparator(self.actionAbout_Qt)
        #self.toolBar.insertSeparator(self.actionQuit)
        self.toolBarProject.setContextMenuPolicy(Qt.PreventContextMenu)
        self.toolBarApps.setContextMenuPolicy(Qt.PreventContextMenu)
        self.toolBarHelpAbout.setContextMenuPolicy(Qt.PreventContextMenu)

        # # ApplicationXY button
        # #choose the button icon
        # icon = QIcon(':/Icon8/Images/new_icons/XY.png')
        # tool_tip = 'XY'  # text that appear on hover
        # self.actionXY = QAction(icon, tool_tip, self)
        # #insert the new button before the "MWD" button
        # self.toolBarApps.insertAction(self.actionMWD, self.actionXY)
        # #connect button
        # self.actionXY.triggered.connect(lambda: self.handle_new_app('XY'))

        # App tabs behaviour
        self.ApplicationtabWidget.setMovable(True)
        self.ApplicationtabWidget.setTabsClosable(True)
        self.ApplicationtabWidget.setUsesScrollButtons(True)

        # Connect actions
        self.actionOpenProject.triggered.connect(self.launch_open_dialog)
        self.actionSaveProject.triggered.connect(self.launch_save_dialog)

        # Generate action buttons from dict of available applications
        self.actionMWD.triggered.connect(lambda: self.handle_new_app('MWD'))
        self.actionTTS.triggered.connect(lambda: self.handle_new_app('TTS'))
        self.actionTTSFactors.triggered.connect(
            lambda: self.handle_new_app('TTSF'))
        self.actionLVE.triggered.connect(lambda: self.handle_new_app('LVE'))
        self.actionNLVE.triggered.connect(lambda: self.handle_new_app('NLVE'))
        self.actionCrystal.triggered.connect(
            lambda: self.handle_new_app('Crystal'))
        self.actionGt.triggered.connect(lambda: self.handle_new_app('Gt'))
        self.actionCreep.triggered.connect(
            lambda: self.handle_new_app('Creep'))
        self.actionSANS.triggered.connect(lambda: self.handle_new_app('SANS'))
        self.actionReact.triggered.connect(
            lambda: self.handle_new_app('React'))
        self.actionDielectric.triggered.connect(
            lambda: self.handle_new_app('Dielectric'))
        self.actionLAOS.triggered.connect(lambda: self.handle_new_app('LAOS'))
        # self.actionLAOS.triggered.connect(lambda: self.handle_app_coming_soon('LAOS'))
        # self.actionDynamicStructureFactor.triggered.connect(lambda: self.handle_app_coming_soon('DynamicStructureFactor'))

        self.ApplicationtabWidget.tabCloseRequested.connect(self.close_app_tab)
        self.ApplicationtabWidget.currentChanged.connect(self.tab_changed)

        self.actionAbout_Qt.triggered.connect(QApplication.aboutQt)
        self.actionAbout.triggered.connect(self.show_about)

        connection_id = self.ApplicationtabWidget.tabBarDoubleClicked.connect(
            self.handle_doubleClickTab)
        # help buttons
        self.actionShow_reptate_help.triggered.connect(
            self.handle_show_reptate_help)
        self.actionShow_app_help.triggered.connect(self.handle_show_app_help)
        self.actionShow_th_help.triggered.connect(self.handle_show_th_help)
        self.actionShow_offline_help.triggered.connect(
            self.handle_actionShow_offline_help)

        # additional about buttons
        self.actionAboutMatplotlib.triggered.connect(
            self.handle_about_matplotlib)
        self.actionAboutNumpy.triggered.connect(self.handle_about_numpy)
        self.actionAboutScipy.triggered.connect(self.handle_about_scipy)
        self.actionCite_RepTate.triggered.connect(self.handle_cite_RepTate)
        self.actionCheckRepTateVersion.triggered.connect(
            self.handle_check_RepTate_version)

        connection_id = self.LoggerdockWidget.visibilityChanged.connect(
            self.handle_loggerVisibilityChanged)
        connection_id = self.actionShow_Logger.triggered.connect(
            self.showLogger)

        tb = QToolBar()
        tb.setIconSize(QSize(24, 24))
        tb.setOrientation(Qt.Vertical)

        self.tbutlog = QToolButton()
        self.tbutlog.setPopupMode(QToolButton.MenuButtonPopup)
        menu = QMenu()
        menu.addAction(self.actionLogNotSet)
        menu.addAction(self.actionLogDebug)
        menu.addAction(self.actionLogInfo)
        menu.addAction(self.actionLogWarning)
        menu.addAction(self.actionLogError)
        menu.addAction(self.actionLogCritical)
        if loglevel == logging.NOTSET:
            self.tbutlog.setDefaultAction(self.actionLogNotSet)
        elif loglevel == logging.DEBUG:
            self.tbutlog.setDefaultAction(self.actionLogDebug)
        elif loglevel == logging.INFO:
            self.tbutlog.setDefaultAction(self.actionLogInfo)
        elif loglevel == logging.WARNING:
            self.tbutlog.setDefaultAction(self.actionLogWarning)
        elif loglevel == logging.ERROR:
            self.tbutlog.setDefaultAction(self.actionLogError)
        elif loglevel == logging.CRITICAL:
            self.tbutlog.setDefaultAction(self.actionLogCritical)
        self.tbutlog.setMenu(menu)
        tb.addWidget(self.tbutlog)

        tb.addAction(self.actionCopyLogText)
        self.LoggerdochorizontalLayout.addWidget(tb)

        self.logTextBox = QTextEditLogger(self)
        formatter = logging.Formatter(
            '<font color=blue>%(asctime)s</font> <b>%(name)s <font color=red>%(levelname)s</font></b>: %(message)s',
            "%Y%m%d %H%M%S")
        self.logTextBox.setFormatter(formatter)
        logging.getLogger('RepTate').addHandler(self.logTextBox)
        logging.getLogger('RepTate').setLevel(loglevel)
        import matplotlib
        matplotlib._log.addHandler(self.logTextBox)
        self.logTextBox.setLevel(loglevel)
        self.LoggerdochorizontalLayout.addWidget(self.logTextBox.widget)

        connection_id = self.actionLogNotSet.triggered.connect(self.logNotSet)
        connection_id = self.actionLogDebug.triggered.connect(self.logDebug)
        connection_id = self.actionLogInfo.triggered.connect(self.logInfo)
        connection_id = self.actionLogWarning.triggered.connect(
            self.logWarning)
        connection_id = self.actionLogError.triggered.connect(self.logError)
        connection_id = self.actionLogCritical.triggered.connect(
            self.logCritical)
        connection_id = self.actionCopyLogText.triggered.connect(
            self.copyLogText)

        #self.add_save_load_buttons()
        self.REPTATE_PROJ_JSON = 'reptate_project.json'  # json filename inside zip
        self.load_path = None

        # CONSOLE WINDOW (need to integrate it with cmd commands)
        #self.text_edit = Console(self)
        #this is how you pass in locals to the interpreter
        #self.text_edit.initInterpreter(locals())
        #self.verticalLayout.addWidget(self.text_edit)

        # Hide Logger Window
        self.LoggerdockWidget.hide()
Example #3
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle('Contact Book')
        self.display = QDesktopWidget().screenGeometry(-1)
        self.screenWidth = self.display.width()
        self.screenHeight = self.display.height()

        self.setGeometry(200, 100, self.screenWidth - 400,
                         self.screenHeight - 250)
        self.appIcon = 'res/icons8-contact-details-30.png'
        self.setWindowIcon(QIcon(self.appIcon))

        #store row id which user wants to edit
        self.selectedRecored = 0

        #store all row id which user wants to remove
        self.removArr = []

        srch_box = QFrame()
        srch_box_ly = QHBoxLayout()
        srch_box.setLayout(srch_box_ly)

        srchInputFont = QFont()
        srchInputFont.setPixelSize(12)

        self.srchInput = QLineEdit(srch_box)
        self.srchInput.setPlaceholderText(
            'Search cotact by Name OR Contact no')
        self.srchInput.setFont(srchInputFont)
        self.srchInput.setStyleSheet("height:26px;width:300px;font-size:18;")

        self.srchBtn = QPushButton(QIcon("res/icons8-search-30.png"),
                                   'Search Contact', srch_box)
        self.srchBtn.clicked.connect(self.searchInContact)
        self.srchBtn.setStyleSheet("height:26px;padding:1px 5px")

        srch_box_ly.addWidget(self.srchInput)
        srch_box_ly.addWidget(self.srchBtn)

        toolbar = QToolBar('kkkk', self)
        self.addToolBar(toolbar)

        addNewAction = QAction(
            QIcon('res/icons8-add-user-group-man-man-40.png'), 'Add New', self)
        addNewAction.triggered.connect(self.addNewActionPerform)

        editAction = QAction(QIcon('res/icons8-registration-40.png'),
                             'Edit Contact', self)
        editAction.triggered.connect(self.editActionPerform)

        removeAction = QAction(QIcon('res/icons8-denied-40.png'),
                               'Remove Contact', self)
        removeAction.triggered.connect(self.removeActionPerform)

        aboutME = QAction(QIcon('res/high_priority-48.png'), 'About Phonebook',
                          self)
        aboutME.triggered.connect(self.aboutActionPerform)

        toolbar.addAction(addNewAction)
        toolbar.addAction(editAction)
        toolbar.addAction(removeAction)
        toolbar.addAction(aboutME)
        toolbar.addWidget(srch_box)
        toolbar.setIconSize(QSize(30, 30))

        #----------------------------------------------------------------
        #self.setUpGui()
        self.createTbl()
        #----------------------------------------------------------------

        #self.setCentralWidget(self.mainFrame)
        self.show()
Example #4
0
    def initUI(self):
        self.setGeometry(300, 300, 700, 500)
        self.setWindowTitle('Paint')
        self.setWindowIcon(QIcon('data/icon.png'))
        self.setStyleSheet("background-color: #c8d9cb;")
        self.can_resize = False
        self.can_save = False
        self.printt = False

        self.background = Qt.white

        self.image = QImage(self.size(), QImage.Format_RGB32)
        self.image.fill(self.background)

        self.drawing = False
        self.brushSize = 2
        self.brushColor = Qt.black
        self.LastPoint = QPoint()
        self.act = 1

        self.mewo = QLabel(self)
        self.mewo.resize(700, 70)
        self.mewo.move(0, 0)
        self.mewo.setStyleSheet("background-color: white;")

        self.menubar = QMenuBar(self)
        self.menu_file = self.menubar.addMenu('Файл')
        self.menu_file.addAction('Открыть').triggered.connect(self.open_file)
        self.menu_file.addAction('Создать новый').triggered.connect(
            self.create_new)
        self.menu_file.addAction('Сохранить').triggered.connect(self.save)
        self.menu_view = self.menubar.addAction('Тема')
        self.menu_view.triggered.connect(self.view_f)
        self.menubar.setStyleSheet("background-color: white;")

        self.toolbar = QToolBar(self)
        self.toolbar.move(0, 20)

        self.lb1 = QLabel(self)
        self.lb1.resize(40, 440)
        self.lb1.move(0, 70)
        self.lb1.setStyleSheet("background-color: #c8d9cb;")

        self.lb2 = QLabel(self)
        self.lb2.resize(700, 20)
        self.lb2.move(0, 70)
        self.lb2.setStyleSheet("background-color: #c8d9cb;")

        self.lb3 = QLabel(self)
        self.lb3.resize(40, 440)
        self.lb3.move(660, 70)
        self.lb3.setStyleSheet("background-color: #c8d9cb;")

        self.lb4 = QLabel(self)
        self.lb4.resize(700, 20)
        self.lb4.move(0, 480)
        self.lb4.setStyleSheet("background-color: #c8d9cb;")

        paste = self.toolbar.addAction(QIcon('data/paste.ico'), 'Paste')
        paste.triggered.connect(self.paste)
        rot1 = self.toolbar.addAction(QIcon('data/rotate_right.ico'), 'Rotate')
        rot1.triggered.connect(self.rotate1)
        rot2 = self.toolbar.addAction(QIcon('data/rotate_left.ico'), 'Rotate')
        rot2.triggered.connect(self.rotate2)
        self.toolbar.addSeparator()
        pen = self.toolbar.addAction(QIcon('data/pen.ico'), 'Pen')
        pen.triggered.connect(self.click_act1)
        eraser = self.toolbar.addAction(QIcon('data/eraser.ico'), 'Eraser')
        eraser.triggered.connect(self.click_act2)
        fill = self.toolbar.addAction(QIcon('data/fill.ico'), 'Fill')
        fill.triggered.connect(self.click_act4)
        text = self.toolbar.addAction(QIcon('data/text.ico'), 'Text')
        text.triggered.connect(self.click_act3)
        #self.toolbar.addSeparator()

        self.lbl = QLabel()
        self.lbl.setFixedSize(30, 30)
        self.lbl.setStyleSheet(
            "background-color: black; border-style: solid; border-width: 2px; border-color: black;"
        )
        self.toolbar.addWidget(self.lbl)

        a = self.toolbar.addAction(QIcon('data/color.ico'), 'Select color')
        a.triggered.connect(self.click1)

        self.toolbar.setStyleSheet("background-color: white;")
    def accept(self) -> None:
        try:
            isOne = int(self.btnGroupOne.checkedButton().objectName())
            typeText = f'{self.sys.currentText()} համակարգ'
            typeText += f'\n{self.btnGroupOne.checkedButton().text()}'
            if isOne == 1:
                row = int(self.row.text())
                isTwo = self.btnGroupTwo.checkedButton().objectName()
                isThree = self.btnGroupThree.checkedButton().objectName()
                typeText += f'/{row}' \
                            f'\n{self.btnGroupThree.checkedButton().text()}'

                if isThree == '1':
                    col = int(self.col.text())
                    typeText += f'/{col}'

                typeText += f'\n{self.btnGroupTwo.checkedButton().text()}'
                if self.isSame.isChecked():
                    typeText += f'\n{self.isSame.text()}'
        except:
            self.error.setText(TEXT.LB_ERR_WRONG_DATA)
            self.error.show()
            return

        self.error.hide()

        self.System = QWidget()
        self.parent().Systems.layout().addWidget(self.System)
        self.parent().SystemList.append(self.System)

        form = QtWidgets.QFormLayout()
        self.System.setLayout(form)

        toolBar = QToolBar(self.System)
        remove = QAction(TEXT.BTN_DELETE, self.System)
        remove.triggered.connect(self.parent().RemoveCtrl)
        toolBar.addAction(remove)
        # edit = QAction('Խմբագրել', self.System)
        # toolBar.addAction(edit)
        form.addWidget(toolBar)

        self.System.SysConfig = {
            'system': self.sys.currentIndex(),
            'row': row if isOne == 1 else 0,
            'col': col if isOne == 1 and isThree == "1" else 1,
            'typeOne': isOne,
            'typeTwoAndThree': isTwo + isThree if isOne == 1 else None,
            # 'typeThree': isThree if isOne else None,
            'isSame': self.isSame.isChecked() if isOne == 1 else None,
        }

        # form.addWidget(QLabel(f'{self.System.SysConfig["system"][1]} համակարգ'))
        # typeText = f'{self.System.SysConfig["typeOne"][1]}/{self.System.SysConfig["row"]}'
        # if self.System.SysConfig["typeOne"][0]:
        #     typeText += f'\n{self.System.SysConfig["typeThree"][1]}/{self.System.SysConfig["col"]}' \
        #                 f'\n{self.System.SysConfig["typeTwo"][1]}'
        #     if self.System.SysConfig["isSame"][0]:
        #         typeText += f'\n{self.System.SysConfig["isSame"][1]}'
        form.addWidget(QLabel(typeText))

        self.CreateSystem()

        self.parent().calc.setEnabled(True)
        self.close()
Example #6
0
 def _createToolBar(self):
    tools = QToolBar()
    self.addToolBar(tools)
    tools.addAction('Exit', self.close)
Example #7
0
    def MAIN_VIEW(self, profile):
        self.comp = COMPONENTS()

        _id = int(profile["id"])

        r = requests.get(url=f"{self.comp.APP_URL}/users/students/{_id}")

        self.profile = r.json()

        self.main_menu = self.menuBar()
        self.toolbar = QToolBar()

        self.file_menu = self.main_menu.addMenu("File")
        self.edit_menu = self.main_menu.addMenu("Edit")

        self.export = QAction(QIcon("./assets/icons/export_pdf.png"),
                              "Export PDF", self)
        self.export.setShortcut("Ctrl+S")

        self.edit_action = QAction(QIcon("./assets/icons/edit_profile.png"),
                                   "Edit Student Details", self)

        self.exit_action = QAction(QIcon("./assets/icons/exit.png"), "Exit",
                                   self)
        self.exit_action.setShortcut("Ctrl+Q")

        self.file_menu.addAction(self.export)
        self.file_menu.addAction(self.exit_action)

        self.edit_menu.addAction(self.edit_action)

        self.export.triggered.connect(self._save_file)
        self.edit_action.triggered.connect(self._edit_screen)
        self.exit_action.triggered.connect(self.previous)

        self.toolbar = self.addToolBar("Toolbar")
        self.toolbar.addAction(self.exit_action)
        self.toolbar.addAction(self.edit_action)
        self.toolbar.addAction(self.export)

        main_widget = QWidget()
        self.vbox = QVBoxLayout()

        self.personal_details()

        self.contact_details()

        self.parent_detail()

        self.other_detail()

        main_widget.setLayout(self.vbox)

        scroll = QScrollArea()
        scroll.setWidget(main_widget)
        scroll.setWidgetResizable(True)

        self.setCentralWidget(scroll)

        self.super_layout.addWidget(self)
        self.super_layout.setCurrentWidget(self)
Example #8
0
	def __init__(self, parent=None):
		QMainWindow.__init__(self, parent)
		self.resize(950, 700)
		screenRect = QDesktopWidget().screenGeometry()
		if globalSettings.windowGeometry:
			self.restoreGeometry(globalSettings.windowGeometry)
		else:
			self.move((screenRect.width()-self.width())/2, (screenRect.height()-self.height())/2)
			if not screenRect.contains(self.geometry()):
				self.showMaximized()
		if sys.platform.startswith('darwin'):
			# https://github.com/retext-project/retext/issues/198
			searchPaths = QIcon.themeSearchPaths()
			searchPaths.append('/opt/local/share/icons')
			searchPaths.append('/usr/local/share/icons')
			QIcon.setThemeSearchPaths(searchPaths)
		if globalSettings.iconTheme:
			QIcon.setThemeName(globalSettings.iconTheme)
		if QIcon.themeName() in ('hicolor', ''):
			if not QFile.exists(getBundledIcon('document-new')):
				QIcon.setThemeName(get_icon_theme())
		if QFile.exists(getBundledIcon('retext')):
			self.setWindowIcon(QIcon(getBundledIcon('retext')))
		elif QFile.exists('/usr/share/pixmaps/retext.png'):
			self.setWindowIcon(QIcon('/usr/share/pixmaps/retext.png'))
		else:
			self.setWindowIcon(QIcon.fromTheme('retext',
				QIcon.fromTheme('accessories-text-editor')))
		self.tabWidget = QTabWidget(self)
		self.initTabWidget()
		self.setCentralWidget(self.tabWidget)
		self.tabWidget.currentChanged.connect(self.changeIndex)
		self.tabWidget.tabCloseRequested.connect(self.closeTab)
		toolBar = QToolBar(self.tr('File toolbar'), self)
		self.addToolBar(Qt.TopToolBarArea, toolBar)
		self.editBar = QToolBar(self.tr('Edit toolbar'), self)
		self.addToolBar(Qt.TopToolBarArea, self.editBar)
		self.searchBar = QToolBar(self.tr('Search toolbar'), self)
		self.addToolBar(Qt.BottomToolBarArea, self.searchBar)
		toolBar.setVisible(not globalSettings.hideToolBar)
		self.editBar.setVisible(not globalSettings.hideToolBar)
		self.actionNew = self.act(self.tr('New'), 'document-new',
			self.createNew, shct=QKeySequence.New)
		self.actionNew.setPriority(QAction.LowPriority)
		self.actionOpen = self.act(self.tr('Open'), 'document-open',
			self.openFile, shct=QKeySequence.Open)
		self.actionOpen.setPriority(QAction.LowPriority)
		self.actionSetEncoding = self.act(self.tr('Set encoding'),
			trig=self.showEncodingDialog)
		self.actionSetEncoding.setEnabled(False)
		self.actionReload = self.act(self.tr('Reload'), 'view-refresh',
			lambda: self.currentTab.readTextFromFile())
		self.actionReload.setEnabled(False)
		self.actionSave = self.act(self.tr('Save'), 'document-save',
			self.saveFile, shct=QKeySequence.Save)
		self.actionSave.setEnabled(False)
		self.actionSave.setPriority(QAction.LowPriority)
		self.actionSaveAs = self.act(self.tr('Save as'), 'document-save-as',
			self.saveFileAs, shct=QKeySequence.SaveAs)
		self.actionNextTab = self.act(self.tr('Next tab'), 'go-next',
			lambda: self.switchTab(1), shct=Qt.CTRL+Qt.Key_PageDown)
		self.actionPrevTab = self.act(self.tr('Previous tab'), 'go-previous',
			lambda: self.switchTab(-1), shct=Qt.CTRL+Qt.Key_PageUp)
		self.actionPrint = self.act(self.tr('Print'), 'document-print',
			self.printFile, shct=QKeySequence.Print)
		self.actionPrint.setPriority(QAction.LowPriority)
		self.actionPrintPreview = self.act(self.tr('Print preview'), 'document-print-preview',
			self.printPreview)
		self.actionViewHtml = self.act(self.tr('View HTML code'), 'text-html', self.viewHtml)
		self.actionChangeEditorFont = self.act(self.tr('Change editor font'),
			trig=self.changeEditorFont)
		self.actionChangePreviewFont = self.act(self.tr('Change preview font'),
			trig=self.changePreviewFont)
		self.actionSearch = self.act(self.tr('Find text'), 'edit-find', shct=QKeySequence.Find)
		self.actionSearch.setCheckable(True)
		self.actionSearch.triggered[bool].connect(self.searchBar.setVisible)
		self.searchBar.visibilityChanged.connect(self.searchBarVisibilityChanged)
		self.actionPreview = self.act(self.tr('Preview'), shct=Qt.CTRL+Qt.Key_E,
			trigbool=self.preview)
		if QIcon.hasThemeIcon('document-preview'):
			self.actionPreview.setIcon(QIcon.fromTheme('document-preview'))
		elif QIcon.hasThemeIcon('preview-file'):
			self.actionPreview.setIcon(QIcon.fromTheme('preview-file'))
		elif QIcon.hasThemeIcon('x-office-document'):
			self.actionPreview.setIcon(QIcon.fromTheme('x-office-document'))
		else:
			self.actionPreview.setIcon(QIcon(getBundledIcon('document-preview')))
		self.actionLivePreview = self.act(self.tr('Live preview'), shct=Qt.CTRL+Qt.Key_L,
		trigbool=self.enableLivePreview)
		menuPreview = QMenu()
		menuPreview.addAction(self.actionLivePreview)
		self.actionPreview.setMenu(menuPreview)
		self.actionTableMode = self.act(self.tr('Table editing mode'),
			shct=Qt.CTRL+Qt.Key_T,
			trigbool=lambda x: self.currentTab.editBox.enableTableMode(x))
		if ReTextFakeVimHandler:
			self.actionFakeVimMode = self.act(self.tr('FakeVim mode'),
				shct=Qt.CTRL+Qt.ALT+Qt.Key_V, trigbool=self.enableFakeVimMode)
			if globalSettings.useFakeVim:
				self.actionFakeVimMode.setChecked(True)
				self.enableFakeVimMode(True)
		self.actionFullScreen = self.act(self.tr('Fullscreen mode'), 'view-fullscreen',
			shct=Qt.Key_F11, trigbool=self.enableFullScreen)
		self.actionFullScreen.setPriority(QAction.LowPriority)
		self.actionConfig = self.act(self.tr('Preferences'), icon='preferences-system',
			trig=self.openConfigDialog)
		self.actionConfig.setMenuRole(QAction.PreferencesRole)
		self.actionSaveHtml = self.act('HTML', 'text-html', self.saveFileHtml)
		self.actionPdf = self.act('PDF', 'application-pdf', self.savePdf)
		self.actionOdf = self.act('ODT', 'x-office-document', self.saveOdf)
		self.getExportExtensionsList()
		self.actionQuit = self.act(self.tr('Quit'), 'application-exit', shct=QKeySequence.Quit)
		self.actionQuit.setMenuRole(QAction.QuitRole)
		self.actionQuit.triggered.connect(self.close)
		self.actionUndo = self.act(self.tr('Undo'), 'edit-undo',
			lambda: self.currentTab.editBox.undo(), shct=QKeySequence.Undo)
		self.actionRedo = self.act(self.tr('Redo'), 'edit-redo',
			lambda: self.currentTab.editBox.redo(), shct=QKeySequence.Redo)
		self.actionCopy = self.act(self.tr('Copy'), 'edit-copy',
			lambda: self.currentTab.editBox.copy(), shct=QKeySequence.Copy)
		self.actionCut = self.act(self.tr('Cut'), 'edit-cut',
			lambda: self.currentTab.editBox.cut(), shct=QKeySequence.Cut)
		self.actionPaste = self.act(self.tr('Paste'), 'edit-paste',
			lambda: self.currentTab.editBox.paste(), shct=QKeySequence.Paste)
		self.actionUndo.setEnabled(False)
		self.actionRedo.setEnabled(False)
		self.actionCopy.setEnabled(False)
		self.actionCut.setEnabled(False)
		qApp = QApplication.instance()
		qApp.clipboard().dataChanged.connect(self.clipboardDataChanged)
		self.clipboardDataChanged()
		if enchant is not None:
			self.actionEnableSC = self.act(self.tr('Enable'), trigbool=self.enableSpellCheck)
			self.actionSetLocale = self.act(self.tr('Set locale'), trig=self.changeLocale)
		self.actionWebKit = self.act(self.tr('Use WebKit renderer'), trigbool=self.enableWebKit)
		if ReTextWebKitPreview is None:
			globalSettings.useWebKit = False
			self.actionWebKit.setEnabled(False)
		self.actionWebKit.setChecked(globalSettings.useWebKit)
		self.actionWebEngine = self.act(self.tr('Use WebEngine (Chromium) renderer'),
			trigbool=self.enableWebEngine)
		if ReTextWebEnginePreview is None:
			globalSettings.useWebEngine = False
		self.actionWebEngine.setChecked(globalSettings.useWebEngine)
		self.actionShow = self.act(self.tr('Show directory'), 'system-file-manager', self.showInDir)
		self.actionFind = self.act(self.tr('Next'), 'go-next', self.find,
			shct=QKeySequence.FindNext)
		self.actionFindPrev = self.act(self.tr('Previous'), 'go-previous',
			lambda: self.find(back=True), shct=QKeySequence.FindPrevious)
		self.actionReplace = self.act(self.tr('Replace'), 'edit-find-replace',
			lambda: self.find(replace=True))
		self.actionReplaceAll = self.act(self.tr('Replace all'), trig=self.replaceAll)
		menuReplace = QMenu()
		menuReplace.addAction(self.actionReplaceAll)
		self.actionReplace.setMenu(menuReplace)
		self.actionCloseSearch = self.act(self.tr('Close'), 'window-close',
			lambda: self.searchBar.setVisible(False))
		self.actionCloseSearch.setPriority(QAction.LowPriority)
		self.actionHelp = self.act(self.tr('Get help online'), 'help-contents', self.openHelp)
		self.aboutWindowTitle = self.tr('About ReText')
		self.actionAbout = self.act(self.aboutWindowTitle, 'help-about', self.aboutDialog)
		self.actionAbout.setMenuRole(QAction.AboutRole)
		self.actionAboutQt = self.act(self.tr('About Qt'))
		self.actionAboutQt.setMenuRole(QAction.AboutQtRole)
		self.actionAboutQt.triggered.connect(qApp.aboutQt)
		availableMarkups = markups.get_available_markups()
		if not availableMarkups:
			print('Warning: no markups are available!')
		if len(availableMarkups) > 1:
			self.chooseGroup = QActionGroup(self)
			markupActions = []
			for markup in availableMarkups:
				markupAction = self.act(markup.name, trigbool=self.markupFunction(markup))
				if markup.name == globalSettings.defaultMarkup:
					markupAction.setChecked(True)
				self.chooseGroup.addAction(markupAction)
				markupActions.append(markupAction)
		self.actionBold = self.act(self.tr('Bold'), shct=QKeySequence.Bold,
			trig=lambda: self.insertFormatting('bold'))
		self.actionItalic = self.act(self.tr('Italic'), shct=QKeySequence.Italic,
			trig=lambda: self.insertFormatting('italic'))
		self.actionUnderline = self.act(self.tr('Underline'), shct=QKeySequence.Underline,
			trig=lambda: self.insertFormatting('underline'))
		self.usefulTags = ('header', 'italic', 'bold', 'underline', 'numbering',
			'bullets', 'image', 'link', 'inline code', 'code block', 'blockquote')
		self.usefulChars = ('deg', 'divide', 'dollar', 'hellip', 'laquo', 'larr',
			'lsquo', 'mdash', 'middot', 'minus', 'nbsp', 'ndash', 'raquo',
			'rarr', 'rsquo', 'times')
		self.formattingBox = QComboBox(self.editBar)
		self.formattingBox.addItem(self.tr('Formatting'))
		self.formattingBox.addItems(self.usefulTags)
		self.formattingBox.activated[str].connect(self.insertFormatting)
		self.symbolBox = QComboBox(self.editBar)
		self.symbolBox.addItem(self.tr('Symbols'))
		self.symbolBox.addItems(self.usefulChars)
		self.symbolBox.activated.connect(self.insertSymbol)
		self.updateStyleSheet()
		menubar = self.menuBar()
		menuFile = menubar.addMenu(self.tr('File'))
		menuEdit = menubar.addMenu(self.tr('Edit'))
		menuHelp = menubar.addMenu(self.tr('Help'))
		menuFile.addAction(self.actionNew)
		menuFile.addAction(self.actionOpen)
		self.menuRecentFiles = menuFile.addMenu(self.tr('Open recent'))
		self.menuRecentFiles.aboutToShow.connect(self.updateRecentFiles)
		menuFile.addAction(self.actionShow)
		menuFile.addAction(self.actionSetEncoding)
		menuFile.addAction(self.actionReload)
		menuFile.addSeparator()
		menuFile.addAction(self.actionSave)
		menuFile.addAction(self.actionSaveAs)
		menuFile.addSeparator()
		menuFile.addAction(self.actionNextTab)
		menuFile.addAction(self.actionPrevTab)
		menuFile.addSeparator()
		menuExport = menuFile.addMenu(self.tr('Export'))
		menuExport.addAction(self.actionSaveHtml)
		menuExport.addAction(self.actionOdf)
		menuExport.addAction(self.actionPdf)
		if self.extensionActions:
			menuExport.addSeparator()
			for action, mimetype in self.extensionActions:
				menuExport.addAction(action)
			menuExport.aboutToShow.connect(self.updateExtensionsVisibility)
		menuFile.addAction(self.actionPrint)
		menuFile.addAction(self.actionPrintPreview)
		menuFile.addSeparator()
		menuFile.addAction(self.actionQuit)
		menuEdit.addAction(self.actionUndo)
		menuEdit.addAction(self.actionRedo)
		menuEdit.addSeparator()
		menuEdit.addAction(self.actionCut)
		menuEdit.addAction(self.actionCopy)
		menuEdit.addAction(self.actionPaste)
		menuEdit.addSeparator()
		if enchant is not None:
			menuSC = menuEdit.addMenu(self.tr('Spell check'))
			menuSC.addAction(self.actionEnableSC)
			menuSC.addAction(self.actionSetLocale)
		menuEdit.addAction(self.actionSearch)
		menuEdit.addAction(self.actionChangeEditorFont)
		menuEdit.addAction(self.actionChangePreviewFont)
		menuEdit.addSeparator()
		if len(availableMarkups) > 1:
			self.menuMode = menuEdit.addMenu(self.tr('Default markup'))
			for markupAction in markupActions:
				self.menuMode.addAction(markupAction)
		menuFormat = menuEdit.addMenu(self.tr('Formatting'))
		menuFormat.addAction(self.actionBold)
		menuFormat.addAction(self.actionItalic)
		menuFormat.addAction(self.actionUnderline)
		if ReTextWebKitPreview is not None or ReTextWebEnginePreview is None:
			menuEdit.addAction(self.actionWebKit)
		else:
			menuEdit.addAction(self.actionWebEngine)
		menuEdit.addSeparator()
		menuEdit.addAction(self.actionViewHtml)
		menuEdit.addAction(self.actionPreview)
		menuEdit.addAction(self.actionTableMode)
		if ReTextFakeVimHandler:
			menuEdit.addAction(self.actionFakeVimMode)
		menuEdit.addSeparator()
		menuEdit.addAction(self.actionFullScreen)
		menuEdit.addAction(self.actionConfig)
		menuHelp.addAction(self.actionHelp)
		menuHelp.addSeparator()
		menuHelp.addAction(self.actionAbout)
		menuHelp.addAction(self.actionAboutQt)
		toolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
		toolBar.addAction(self.actionNew)
		toolBar.addSeparator()
		toolBar.addAction(self.actionOpen)
		toolBar.addAction(self.actionSave)
		toolBar.addAction(self.actionPrint)
		toolBar.addSeparator()
		toolBar.addAction(self.actionPreview)
		toolBar.addAction(self.actionFullScreen)
		self.editBar.addAction(self.actionUndo)
		self.editBar.addAction(self.actionRedo)
		self.editBar.addSeparator()
		self.editBar.addAction(self.actionCut)
		self.editBar.addAction(self.actionCopy)
		self.editBar.addAction(self.actionPaste)
		self.editBar.addSeparator()
		self.editBar.addWidget(self.formattingBox)
		self.editBar.addWidget(self.symbolBox)
		self.searchEdit = QLineEdit(self.searchBar)
		self.searchEdit.setPlaceholderText(self.tr('Search'))
		self.searchEdit.returnPressed.connect(self.find)
		self.replaceEdit = QLineEdit(self.searchBar)
		self.replaceEdit.setPlaceholderText(self.tr('Replace with'))
		self.replaceEdit.returnPressed.connect(self.find)
		self.csBox = QCheckBox(self.tr('Case sensitively'), self.searchBar)
		self.searchBar.addWidget(self.searchEdit)
		self.searchBar.addWidget(self.replaceEdit)
		self.searchBar.addSeparator()
		self.searchBar.addWidget(self.csBox)
		self.searchBar.addAction(self.actionFindPrev)
		self.searchBar.addAction(self.actionFind)
		self.searchBar.addAction(self.actionReplace)
		self.searchBar.addAction(self.actionCloseSearch)
		self.searchBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
		self.searchBar.setVisible(False)
		self.autoSaveEnabled = globalSettings.autoSave
		if self.autoSaveEnabled:
			timer = QTimer(self)
			timer.start(60000)
			timer.timeout.connect(self.saveAll)
		self.ind = None
		if enchant is not None:
			self.sl = globalSettings.spellCheckLocale
			try:
				enchant.Dict(self.sl or None)
			except enchant.errors.Error as e:
				warnings.warn(str(e), RuntimeWarning)
				globalSettings.spellCheck = False
			if globalSettings.spellCheck:
				self.actionEnableSC.setChecked(True)
		self.fileSystemWatcher = QFileSystemWatcher()
		self.fileSystemWatcher.fileChanged.connect(self.fileChanged)
Example #9
0
    def initUI(self):
        # 控制区
        controller_layout = QGridLayout()

        # 选择源 下载范围
        selector = QComboBox()
        selector.addItems(list(self.SITES.keys()))
        selector.activated.connect(self._selector)
        select_range = QSpinBox()
        select_range.setRange(1, 20)
        select_range.setToolTip("从当前页面开始往后下载多少话")
        self.selector = selector
        self.selectedRange = select_range
        value = self.selector.currentText()
        if value in self.SITES:
            self.site = self.SITES[value]

        controller_layout.addWidget(selector, 0, 0)
        controller_layout.addWidget(select_range, 1, 0)

        # 选择下载保存的位置
        choose_file_btn = QPushButton("保存到...")
        choose_file_btn.setToolTip("选择下载保存位置")
        choose_file_btn.clicked.connect(self._chooseFile)
        controller_layout.addWidget(choose_file_btn, 0, 1)

        save_path = QLineEdit()
        save_path.setText(os.path.abspath(os.curdir))
        controller_layout.addWidget(save_path, 0, 2)
        self.savePath = save_path

        # 控制下载开始/暂停
        download_panel = QHBoxLayout()
        download_ctr = QToolBar('Download')
        download_ctr.setIconSize(QSize(16, 16))
        self.download_ctr_icon = {
            'download': QIcon('assets/download.png'),
            'pause': QIcon("assets/pause.png"),
            'stop': QIcon('assets/stop.png'),
        }
        start_btn = QAction(self.download_ctr_icon['download'],
                            'start/pause download', self)
        start_btn.triggered.connect(self._startDownload)
        stop_btn = QAction(self.download_ctr_icon['stop'], 'stop download',
                           self)
        stop_btn.setVisible(False)
        stop_btn.triggered.connect(self._stopDownload)
        download_ctr.addAction(start_btn)
        download_ctr.addAction(stop_btn)
        download_panel.addWidget(download_ctr)
        controller_layout.addItem(download_panel, 0, 6, 0, 8)
        self.startBtn = start_btn
        self.stopBtn = stop_btn

        # 下载进度
        download_status = QVBoxLayout()
        download_progress_text = QLabel("当前没有下载")
        download_progress_text.setToolTip("当前下载")
        download_progress = QProgressBar()
        download_status.addWidget(download_progress_text)
        download_status.addWidget(download_progress)
        controller_layout.addItem(download_status, 2, 0, 2, 9)
        self.downloadProgress = download_progress
        self.downloadProgressText = download_progress_text

        window_layout = QVBoxLayout()
        window_layout.addLayout(controller_layout)
        window_layout.addStretch(1)

        # 内置网页浏览器
        webview = HJBrowser()
        window_layout.addWidget(webview)
        self.webview = webview
        if selector.currentText() in self.SITES:
            url = self.SITES[selector.currentText()]
            self.webview.load(QUrl(url))

        self.setLayout(window_layout)
Example #10
0
    def __init__(self, app: dict, icon_cache: MemoryCache, i18n: I18n,
                 screen_size: QSize()):
        super(InfoDialog, self).__init__()
        self.setWindowTitle(str(app['__app__']))
        self.screen_size = screen_size
        self.i18n = i18n
        layout = QVBoxLayout()
        self.setLayout(layout)

        self.toolbar_field = QToolBar()
        self.bt_back = QPushButton(i18n['back'].capitalize())
        self.bt_back.clicked.connect(self.back_to_info)
        self.toolbar_field.addWidget(self.bt_back)
        self.layout().addWidget(self.toolbar_field)
        self.toolbar_field.hide()

        # shows complete field string
        self.text_field = QPlainTextEdit()
        self.text_field.setReadOnly(True)
        self.layout().addWidget(self.text_field)
        self.text_field.hide()

        self.gbox_info = QGroupBox()
        self.gbox_info.setMaximumHeight(self.screen_size.height() -
                                        self.screen_size.height() * 0.1)
        self.gbox_info_layout = QGridLayout()
        self.gbox_info.setLayout(self.gbox_info_layout)

        layout.addWidget(self.gbox_info)

        # THERE ARE CRASHES WITH SOME RARE ICONS ( like insomnia ). IT CAN BE A QT BUG. IN THE MEANTIME, ONLY THE TYPE ICON WILL BE RENDERED
        #
        # icon_data = icon_cache.get(app['__app__'].model.icon_url)
        #
        # if icon_data and icon_data.get('icon'):
        #     self.setWindowIcon(icon_data.get('icon'))
        self.setWindowIcon(QIcon(app['__app__'].model.get_type_icon_path()))

        for idx, attr in enumerate(sorted(app.keys())):
            if attr not in IGNORED_ATTRS and app[attr]:
                i18n_key = app[
                    '__app__'].model.gem_name + '.info.' + attr.lower()

                if isinstance(app[attr], list):
                    val = ' '.join([str(e).strip() for e in app[attr] if e])
                    show_val = '\n'.join(
                        ['* ' + str(e).strip() for e in app[attr] if e])
                else:
                    val = str(app[attr]).strip()
                    show_val = val

                i18n_val = i18n.get('{}.{}'.format(i18n_key, val.lower()))

                if i18n_val:
                    val = i18n_val
                    show_val = val

                text = QLineEdit()
                text.setToolTip(show_val)
                text.setText(val)
                text.setCursorPosition(0)
                text.setStyleSheet("width: 400px")
                text.setReadOnly(True)

                label = QLabel(
                    i18n.get(i18n_key, i18n.get(attr.lower(),
                                                attr)).capitalize())
                label.setStyleSheet("font-weight: bold")

                self.gbox_info_layout.addWidget(label, idx, 0)
                self.gbox_info_layout.addWidget(text, idx, 1)
                self._gen_show_button(idx, show_val)

        self.adjustSize()
Example #11
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.menu_bar = QMenuBar()

        self.file_menu = QMenu("文件(&F)", self.menu_bar)
        self.open_action = QAction("打开(O)", self.file_menu)
        self.open_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O))
        self.search_action = QAction("搜索(F)", self.file_menu)
        self.search_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_F))
        self.search_action.triggered.connect(self.show_search_widget)
        self.close_action = QAction("关闭(C)", self.file_menu)
        self.close_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_C))
        self.close_action.triggered.connect(self.answer_close_action_triggered)
        self.quit_action = QAction("退出(Q)", self.file_menu)
        self.quit_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
        self.quit_action.triggered.connect(lambda: sys.exit())

        self.play_menu = QMenu("播放(&L)", self.menu_bar)
        self.play_action = QAction("播放(P)", self.play_menu)
        self.stop_action = QAction("停止(S)", self.play_menu)
        self.pause_action = QAction("暂停(P)", self.play_menu)
        self.resume_action = QAction("恢复(R)", self.play_menu)
        self.rate_action = QAction("倍速(R)", self.play_menu)
        self.jump_action = QAction("跳转(J)", self.play_menu)
        self.mute_action = QAction("静音(M)", self.play_menu)
        self.volume_up_action = QAction("增大音量(U)", self.play_menu)
        self.volume_down_action = QAction("减小音量(D)", self.play_menu)

        self.enhance_menu = QMenu("增强(&E)", self.menu_bar)
        self.skin_menu = QMenu("换肤", self.enhance_menu)
        self.dark_skin_action = QAction("暗黑模式", self.skin_menu)
        self.dark_skin_action.setCheckable(True)
        self.dark_skin_action.triggered.connect(
            self.answer_dark_skin_action_triggered)
        self.white_skin_action = QAction("纯白模式", self.skin_menu)
        self.white_skin_action.setCheckable(True)
        self.white_skin_action.triggered.connect(
            self.answer_white_skin_action_triggered)
        self.blue_skin_action = QAction("浅蓝模式", self.skin_menu)
        self.blue_skin_action.setCheckable(True)
        self.blue_skin_action.triggered.connect(
            self.answer_blue_skin_action_triggered)
        self.skin_action_group = QActionGroup(self)
        self.skin_action_group.addAction(self.dark_skin_action)
        self.skin_action_group.addAction(self.white_skin_action)
        self.skin_action_group.addAction(self.blue_skin_action)

        self.language_menu = QMenu("语言", self.enhance_menu)
        self.zh_CN_action = QAction("简体中文", self.language_menu)
        self.zh_CN_action.setCheckable(True)
        self.zh_CN_action.triggered.connect(self.answer_zh_CN_action_triggered)
        self.en_action = QAction("English", self.language_menu)
        self.en_action.setCheckable(True)
        self.en_action.triggered.connect(self.answer_en_action_triggered)
        self.language_action_group = QActionGroup(self)
        self.language_action_group.addAction(self.zh_CN_action)
        self.language_action_group.addAction(self.en_action)

        self.font_action = QAction("字体(F)", self.enhance_menu)
        self.font_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S))
        self.font_action.triggered.connect(self.answer_font_action_triggered)
        self.hide_action = QAction("隐藏(V)", self.enhance_menu)
        self.hide_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_V))
        self.hide_action.setCheckable(True)
        self.hide_action.triggered.connect(self.answer_hide_action_triggered)

        self.tool_menu = QMenu("工具(&T)", self.menu_bar)
        self.screenshot_action = QAction("截图(J)", self.tool_menu)
        self.screenshot_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_J))
        self.screenshot_action.triggered.connect(
            self.answer_screenshot_action_triggered)
        self.gif_action = QAction("动图(G)", self.tool_menu)
        self.gif_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_G))
        self.gif_action.triggered.connect(self.answer_gif_action_triggered)
        self.screen_record_action = QAction("录屏(L)", self.tool_menu)
        self.screen_record_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_L))
        self.screen_record_action.triggered.connect(
            self.answer_screen_record_action_triggered)

        self.help_menu = QMenu("帮助(&H)", self.menu_bar)
        self.help_action = QAction("帮助文档(H)", self.help_menu)
        self.help_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_H))
        self.help_action.triggered.connect(self.answer_help_action_triggered)
        self.change_log_action = QAction("更新日志(U)", self.help_menu)
        self.change_log_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_U))
        self.change_log_action.triggered.connect(
            self.answer_change_log_action_triggered)
        self.check_version_action = QAction("检查版本(C)", self.help_menu)
        self.check_version_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_C))
        self.check_version_action.triggered.connect(
            self.answer_check_version_action_triggered)
        self.about_action = QAction("关于软件(A)", self.help_menu)
        self.about_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_A))
        self.about_action.triggered.connect(self.answer_about_action_triggered)

        self.tool_bar = QToolBar()
        self.tool_bar.setFloatable(False)
        self.tool_bar.setMovable(True)
        self.tool_bar.setIconSize(QSize(32, 32))
        # self.tool_bar.setStyleSheet("QToolBar{border: 1px solid #313335; spacing:5px; }")
        self.addToolBar(Qt.TopToolBarArea, self.tool_bar)
        self.search_tool_action = QAction("", self.tool_bar)
        self.search_tool_action.setToolTip("信息搜索")
        self.search_tool_action.setIcon(
            QIcon("./resources/img/[email protected]"))
        self.search_widget = SearchWidget()
        self.search_tool_action.triggered.connect(self.show_search_widget)
        self.search_widget.watch_live_signal.connect(
            self.answer_watch_live_signal)

        self.attention_tool_action = QAction("", self.tool_bar)
        self.attention_tool_action.setToolTip("历史关注")
        self.attention_tool_action.setIcon(
            QIcon("./resources/img/[email protected]"))
        # self.attention_tool_action.triggered.connect(self.show_search_widget)

        self.pure_tool_action = QAction("", self.tool_bar)
        self.pure_tool_action.setToolTip("纯净模式")
        self.pure_tool_action.setIcon(
            QIcon("./resources/img/[email protected]"))
        # self.pure_tool_action.triggered.connect(self.show_search_widget)

        self.nlp_tool_action = QAction("", self.tool_bar)
        self.nlp_tool_action.setToolTip("智能字幕")
        self.nlp_tool_action.setIcon(QIcon("./resources/img/[email protected]"))
        # self.nlp_tool_action.triggered.connect(self.show_search_widget)

        self.note_tool_action = QAction("", self.tool_bar)
        self.note_tool_action.setToolTip("边看边记")
        self.note_tool_action.setIcon(
            QIcon("./resources/img/[email protected]"))
        # self.note_tool_action.triggered.connect(self.show_search_widget)

        self.live_widget = LiveWidget()

        self.init_ui()
        self._init_cfg()
Example #12
0
    def __init__(self, experiment_root):
        super(BasicTrainingResultsWindow, self).__init__()

        self.experiment_root = experiment_root
        if self.experiment_root[-1] != "/":
            self.experiment_root = self.experiment_root + "/"

        self.chart = Figure()
        self.axes = self.chart.add_subplot(111)
        self.graphWidget = FigureCanvas(self.chart)
        self.setCentralWidget(self.graphWidget)

        self.logYAxisCheckbox = QCheckBox("Log Scale (Y Axis)")
        self.logYAxisCheckbox.stateChanged.connect(self.onChangeScale)

        self.displayAsDistributionCheckbox = QCheckBox("Aggregate Results (Mean/Std)")
        self.displayAsDistributionCheckbox.setChecked(True)

        self.saveFigureButton = QPushButton("&Save Figure")
        self.saveFigureButton.clicked.connect(self.onSaveFigure)

        self.optionsToolBar = QToolBar(self)
        self.optionsToolBar.addWidget(self.saveFigureButton)
        self.optionsToolBar.addWidget(self.logYAxisCheckbox)
        self.optionsToolBar.addWidget(self.displayAsDistributionCheckbox)
        self.addToolBar(self.optionsToolBar)

        self.load_experiments()

        self.resultsWidget = QDockWidget("Experiments", self)
        self.experimentTable = ExperimentsModel(
            self.experiment_results, self.displayAsDistributionCheckbox, self
        )
        self.tableView = QTableView()
        self.tableView.setModel(self.experimentTable)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableView.selectionModel().selectionChanged.connect(
            self.onExperimentsSelectionChanged
        )
        for i in range(self.tableView.horizontalHeader().count()):
            self.tableView.horizontalHeader().setSectionResizeMode(
                i, QHeaderView.Stretch
            )
        self.resultsWidget.setWidget(self.tableView)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.resultsWidget)

        self.graphLabelsWidget = QDockWidget("Graph Labels", self)
        self.labelTable = GraphLabels(self.experiment_names, self)
        self.labelView = QTableView()
        self.labelView.setModel(self.labelTable)
        for i in range(self.labelView.horizontalHeader().count()):
            self.labelView.horizontalHeader().setSectionResizeMode(
                i, QHeaderView.Stretch
            )
        self.graphLabelsWidget.setWidget(self.labelView)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.graphLabelsWidget)

        self.labelTable.dataChanged.connect(self.onLabelChanged)
        self.displayAsDistributionCheckbox.stateChanged.connect(
            self.onChangeDisplayAsDistribution
        )
Example #13
0
    def initUI(self):

        # Create the menubar and statusbar of the window
        menubar = self.menuBar()

        statusbar = self.statusBar()
        statusbar.showMessage('Ready')

        # Create the 'New Settings' Action
        newSettingsAct = QAction(QIcon('icons/newSettings.png'),
                                 '&New Settings', self)
        newSettingsAct.setShortcut('Ctrl+N')
        newSettingsAct.setStatusTip('Create New Settings')

        # Create the 'Import Settings' Action
        importSettingsAct = QAction(QIcon('icons/importSettings.png'),
                                    '&Import Settings', self)
        importSettingsAct.setShortcut('Ctrl+O')
        importSettingsAct.setStatusTip('Import Existing Settings')

        # Create the settings menu and add associated actions
        settingsMenu = menubar.addMenu('&Settings')
        settingsMenu.addAction(newSettingsAct)
        settingsMenu.addAction(importSettingsAct)

        # Create the settings toolbar and associated actions
        settingsToolbar = QToolBar(self)
        self.addToolBar(Qt.LeftToolBarArea, settingsToolbar)

        settingsToolbar.addAction(newSettingsAct)
        settingsToolbar.addAction(importSettingsAct)

        # Handle triggered 'NewSettings' and  'importSettings' actions
        newSettingsAct.triggered.connect(self.newSettingsTriggered)
        importSettingsAct.triggered.connect(self.importSettingsTriggered)

        # Set the attributes of the main window and display
        self.setGeometry(QDesktopWidget().availableGeometry())
        self.setWindowTitle('GARUDA - Sharp | Swift | Strong')
        # self.show()

        # Create and display contents of the main window
        main_widget = QWidget()
        self.setCentralWidget(main_widget)

        # create and display the 'GARUDA' logo
        garuda_footer_box = QHBoxLayout()

        garuda_logo_label = QLabel()
        garuda_logo_label.setPixmap(QPixmap('icons/garuda_small.png'))

        garuda_footer_box.addStretch()
        garuda_footer_box.addWidget(garuda_logo_label)

        # create and display widgets to read camera url
        self.camera_url_box = QHBoxLayout()

        camera_url_label = QLabel('Live Camera URL : ')
        self.camera_url_edit = QLineEdit()
        self.camera_capture_btn = QPushButton('Capture')

        self.camera_url_box.addWidget(camera_url_label)
        self.camera_url_box.addWidget(self.camera_url_edit)
        self.camera_url_box.addWidget(self.camera_capture_btn)

        # create and display widgets to display last seen component info
        last_comp_info_pane = QGroupBox('Last Component')

        last_comp_info_box = QVBoxLayout()

        self.last_comp_name_label = QLabel(
            'Component Name  :  {}'.format(None))
        self.last_comp_name_label.setStyleSheet('font-size: 12pt')
        self.last_comp_time_label = QLabel(
            'Timestamp             :  {}'.format(None))
        self.last_comp_time_label.setStyleSheet('font-size: 12pt')
        self.last_comp_match_label = QLabel(
            'Match Percent        :  {}'.format(None))
        self.last_comp_match_label.setStyleSheet('font-size: 12pt')

        last_comp_info_box.addWidget(self.last_comp_name_label)
        last_comp_info_box.addWidget(self.last_comp_time_label)
        last_comp_info_box.addWidget(self.last_comp_match_label)

        last_comp_info_pane.setLayout(last_comp_info_box)

        # Create and display widgets to display live camera feed and last comp info
        self.camera_comp_info_box = QHBoxLayout()

        self.camera_feed_viewer = cameraFeedWidget()
        self.camera_comp_info_box.addStretch(1)
        self.camera_comp_info_box.addWidget(self.camera_feed_viewer)
        self.camera_comp_info_box.addStretch(3)
        self.camera_comp_info_box.addWidget(last_comp_info_pane)
        self.camera_comp_info_box.addStretch(1)

        # create and display main window layout
        self.main_box = QVBoxLayout()

        self.main_box.addLayout(garuda_footer_box)
        self.main_box.addStretch(1)

        main_widget.setLayout(self.main_box)

        # Handle 'capture' button pressed event
        self.camera_capture_btn.pressed.connect(self.startCapture)
    def initUI(self,vector):               
        #this is where the toolbar elements are set up

        self.toolbar = self.addToolBar('UI')   #to-do lock toolbar
        
        fileAct = QAction(QIcon('bin/assets/file.png'), 'file', self)
        fileAct.setShortcut('Ctrl+X')
        fileAct.triggered.connect(OpenMenuPopup) 
        #use following code for actions 
        #fileAct.triggered.connect(filepopup()**note function call may not be correct**) 
        #self.toolbar.addAction(fileAct)

        saveAct = QAction(QIcon('bin/assets/save.png'), 'save', self)
        saveAct.setShortcut('Ctrl+S')
        #saveAct.triggered.connect(saveaction())
        #self.toolbar.addAction(saveAct)
        
        vcAct = QAction(QIcon('bin/assets/VC.jpg'), 'version control', self)
        vcAct.setShortcut('Ctrl+N')
        #vcAct.triggered.connect(versionpopup())
        #self.toolbar.addAction(vcAct)

        settingsAct = QAction(QIcon('bin/assets/settings.png'), 'settings', self)
        settingsAct.setShortcut('Ctrl+I')
        #settingsAct.triggered.connect(settingspopup())
        #self.toolbar.addAction(settingsAct)
        global logviewAct
        logviewAct = QAction(QIcon('bin/assets/logview.png'), 'log view', self)
        logviewAct.setShortcut('Ctrl+T')
        #logviewAct.triggered.connect(logview())
        #self.toolbar.addAction(logviewAct)

        historyAct = QAction(QIcon('bin/assets/history.png'), 'history', self)
        historyAct.setShortcut('Ctrl+H')
        #historyAct.triggered.connect(history popup())
        #self.toolbar.addAction(historyAct)

        redoAct = QAction(QIcon('bin/assets/redo.png'), 'redo change', self)
        redoAct.setShortcut('Ctrl+Y')
        #redoAct.triggered.connect(redo())
        #self.toolbar.addAction(redoAct)

        undoAct = QAction(QIcon('bin/assets/undo.png'), 'undo change', self)
        undoAct.setShortcut('Ctrl+Z')
        #undoAct.triggered.connect(undo())
        #self.toolbar.addAction(undoAct)

        

        #the following code adds the items to the toolbar
        self.toolbar.addAction(fileAct)
        #self.toolbar.addAction(saveAct)
        self.toolbar.addAction(vcAct)
        #self.toolbar.addAction(settingsAct)
        self.toolbar.addAction(logviewAct)
        self.toolbar.addAction(historyAct)
        self.toolbar.addAction(redoAct)
        self.toolbar.addAction(undoAct)

        self.toolbarlower = QToolBar()   #to-do lock toolbarlower
        
        filterAct = QAction(QIcon('bin/assets/filter.png'), 'file', self)
        filterAct.setShortcut('Ctrl+F')
        #use following code for actions 
        #fileAct.triggered.connect(filepopup()**note function call may not be correct**) 
        #self.toolbarlower.addAction(fileAct)

        saveAct = QAction(QIcon('bin/assets/save.png'), 'save', self)
        saveAct.setShortcut('Ctrl+S')
        #saveAct.triggered.connect(saveaction())
        #self.toolbarlower.addAction(saveAct)
        
        vcAct = QAction(QIcon('bin/assets/VC.jpg'), 'version control', self)
        vcAct.setShortcut('Ctrl+N')
        #vcAct.triggered.connect(versionpopup())
        #self.toolbarlower.addAction(vcAct)

        settingsAct = QAction(QIcon('bin/assets/settings.png'), 'settings', self)
        settingsAct.setShortcut('Ctrl+I')
        #settingsAct.triggered.connect(settingspopup())
        #self.toolbarlower.addAction(settingsAct)

        logviewAct = QAction(QIcon('bin/assets/logview.png'), 'log view', self)
        logviewAct.setShortcut('Ctrl+T')
        #logviewAct.triggered.connect(logview())
        #self.toolbarlower.addAction(logviewAct)

        historyAct = QAction(QIcon('bin/assets/history.png'), 'history', self)
        historyAct.setShortcut('Ctrl+H')
        #historyAct.triggered.connect(history popup())
        #self.toolbarlower.addAction(historyAct)

        redoAct = QAction(QIcon('bin/assets/redo.png'), 'redo change', self)
        redoAct.setShortcut('Ctrl+Y')
        #redoAct.triggered.connect(redo())
        #self.toolbarlower.addAction(redoAct)

        undoAct = QAction(QIcon('bin/assets/undo.png'), 'undo change', self)
        undoAct.setShortcut('Ctrl+Z')
        #undoAct.triggered.connect(undo())
        #self.toolbarlower.addAction(undoAct)

        

        #the following code adds the items to the toolbarlower
        self.toolbarlower.addAction(fileAct)

        self.lineEntry = QLineEdit(self)
        self.lineEntry.setMaximumWidth(200)
        self.toolbarlower.addWidget(self.lineEntry)
        
        self.searchbutton = QPushButton("Search")
        self.searchbutton.setMaximumWidth(150)
        self.toolbarlower.addWidget(self.searchbutton)

        self.changevectorbutton = QPushButton("Change Vector")
        self.changevectorbutton.setMaximumWidth(150)
        self.toolbarlower.addWidget(self.changevectorbutton)

        self.editvectorbutton = QPushButton("Edit Vector")
        self.editvectorbutton.setMaximumWidth(150)
        self.editvectorbutton.clicked.connect(lambda: OpenVectorConfigPopup())
        self.toolbarlower.addWidget(self.editvectorbutton)

        self.addvectorbutton = QPushButton("Add Vector")
        self.addvectorbutton.setMaximumWidth(150)
        self.addvectorbutton.clicked.connect(lambda: OpenVectorConfigPopup())
        self.toolbarlower.addWidget(self.addvectorbutton)

        self.removevectorbutton = QPushButton("Remove Vector")
        self.removevectorbutton.setMaximumWidth(150)
        self.removevectorbutton.clicked.connect(lambda: OpenVectorConfigPopup())
        self.toolbarlower.addWidget(self.removevectorbutton)

        #TODO go to graph
        self.editvectorbutton1 = QPushButton("Go To Graph")
        self.editvectorbutton1.setMaximumWidth(150)
        self.editvectorbutton1.clicked.connect(lambda: self.closeMyApp_OpenNewApp() )
        self.toolbarlower.addWidget(self.editvectorbutton1)

        self.addToolBarBreak()
        self.addToolBar(self.toolbarlower)
Example #15
0
    def __init__(self, index):
        QWidget.__init__(self)

        self.index = index
        self.ax1 = None
        self.show_key = True
        self.edit_list = []
        self.line_number = []
        self.list = []

        self.fig = Figure(figsize=(5, 4), dpi=100)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.figure.patch.set_facecolor('white')

        gui_pos = 0

        print("index=", index)

        self.main_vbox = QVBoxLayout()

        self.main_vbox.addWidget(self.canvas)

        #toolbar 2

        toolbar2 = QToolBar()
        toolbar2.setIconSize(QSize(32, 32))

        self.tb_add = QAction(icon_get("list-add"), _("Add section"), self)
        self.tb_add.triggered.connect(self.callback_add_section)
        toolbar2.addAction(self.tb_add)

        self.tb_remove = QAction(icon_get("list-remove"), _("Delete section"),
                                 self)
        self.tb_remove.triggered.connect(self.callback_remove_item)
        toolbar2.addAction(self.tb_remove)

        self.tb_move = QAction(icon_get("go-down"), _("Move down"), self)
        self.tb_move.triggered.connect(self.callback_move_down)
        toolbar2.addAction(self.tb_move)

        self.tb_move_up = QAction(icon_get("go-up"), _("Move up"), self)
        self.tb_move_up.triggered.connect(self.callback_move_up)
        toolbar2.addAction(self.tb_move_up)

        self.main_vbox.addWidget(toolbar2)

        self.tab = QTableWidget()
        self.tab.resizeColumnsToContents()

        self.tab.verticalHeader().setVisible(False)

        self.load_data()
        self.build_mesh()
        self.draw_graph()

        self.update_scan_tokens()

        self.tab.cellChanged.connect(self.on_cell_edited)

        self.main_vbox.addWidget(self.tab)

        self.setLayout(self.main_vbox)

        return
Example #16
0
    def add_tool_bar(self):
        """ADD TOOLBAR AND TOOLBAR ICONS HANDLER"""
        toolBar = QToolBar()
        toolBar.setMovable(False)
        toolBar.setToolButtonStyle(Qt.ToolButtonIconOnly)

        self.addToolBar(Qt.LeftToolBarArea, toolBar)

        refresh_t = QAction(QIcon(_refresh), "REFRESH", self, shortcut="F5")
        compileAll = QAction(QIcon(_run),
                             "COMPILE",
                             self,
                             shortcut="F9",
                             triggered=self.execute_all_query)
        import_t = QAction(QIcon(_import),
                           "IMPORT",
                           self,
                           shortcut="Ctrl+O",
                           triggered=self.load_query_from_file)
        export_t = QAction(QIcon(_export),
                           "EXPORT",
                           self,
                           shortcut="Ctrl+S",
                           triggered=self.save_query_to_file)
        compileSelected = QAction(QIcon(_runSelected),
                                  "RUN SL",
                                  self,
                                  shortcut="Shift+Ctrl+F9",
                                  triggered=self.execute_selected_query)
        newDatabase = QAction(QIcon(_newDatabase),
                              "NEW DB",
                              self,
                              triggered=self.create_database)
        newTable = QAction(QIcon(_newTable),
                           "NEW TB",
                           self,
                           triggered=self.create_table)
        exportData = QAction(
            QIcon(_exportData),
            "EXPORT",
            self,
            triggered=lambda: self.export_table(self.result_out))

        settings = QAction(QIcon(_settings),
                           "SETTINGS",
                           self,
                           triggered=lambda: print("WORKS"))

        refresh_t.setToolTip("Refresh all server databases and table (F5)")
        import_t.setToolTip("Load SQL (Ctrl+O)")
        export_t.setToolTip("Save SQL (Ctrl+S)")
        compileAll.setToolTip("Run all query (F9)")
        compileSelected.setToolTip("Run selected query (Shift+Ctrl+F9)")
        newDatabase.setToolTip("Open database creator")
        newTable.setToolTip("Open table creator")
        exportData.setToolTip("Export all data from result table")
        settings.setToolTip("View settings")

        # toolBar.addSeparator()
        toolBar.addAction(refresh_t)
        toolBar.addAction(import_t), toolBar.addAction(export_t)
        toolBar.addSeparator()
        toolBar.addAction(compileAll), toolBar.addAction(compileSelected)
        toolBar.addSeparator()
        toolBar.addAction(newDatabase), toolBar.addAction(newTable)
        toolBar.addSeparator()
        toolBar.addAction(exportData)

        _sp = QWidget()
        _sp.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        toolBar.addWidget(_sp)
        toolBar.addAction(settings)

        self.processEvents()
Example #17
0
    def setupUi(self, MainWindow):

        menubar = MainWindow.menuBar()

        self.menu_file = menubar.addMenu("File")
        self.menu_edit = menubar.addMenu("Edit")
        self.menu_format = menubar.addMenu("Format")
        self.menu_help = menubar.addMenu("Help")
        #self.menu_view = menubar.addMenu("Export")

        # menubar file menu

        self.menu_file_action = QAction("New File", MainWindow)
        self.menu_file.addAction(self.menu_file_action)

        self.new_notebook_action = QAction("New Notebook", MainWindow)
        self.menu_file.addAction(self.new_notebook_action)

        self.open_file_action = QAction("Open an existing file", MainWindow)
        self.menu_file.addAction(self.open_file_action)

        self.save_file_action = QAction("Save File", MainWindow)
        self.menu_file.addAction(self.save_file_action)

        # menubar edit menu

        self.undo_edit_action = QAction("Undo", MainWindow)
        self.menu_edit.addAction(self.undo_edit_action)

        self.redo_edit_action = QAction("Redo", MainWindow)
        self.menu_edit.addAction(self.redo_edit_action)

        self.copy_edit_action = QAction("Copy", MainWindow)
        self.menu_edit.addAction(self.copy_edit_action)

        self.cut_edit_action = QAction("Cut", MainWindow)
        self.menu_edit.addAction(self.cut_edit_action)

        self.paste_edit_action = QAction("Paste", MainWindow)
        self.menu_edit.addAction(self.paste_edit_action)

        self.image_edit_action = QAction("Insert an Image", MainWindow)
        self.menu_edit.addAction(self.image_edit_action)

        self.table_edit_action = QAction("Insert a Table", MainWindow)
        self.menu_edit.addAction(self.table_edit_action)

        self.time_edit_action = QAction("Insert the current Time", MainWindow)
        self.menu_edit.addAction(self.time_edit_action)

        self.date_edit_action = QAction("Insert the current Date", MainWindow)
        self.menu_edit.addAction(self.date_edit_action)

        # menubar format menu

        self.fontcolor_format_action = QAction("Choose font color", MainWindow)
        self.menu_format.addAction(self.fontcolor_format_action)

        self.fontbgcolor_format_action = QAction(
            "Choose font Background Color", MainWindow)
        self.menu_format.addAction(self.fontbgcolor_format_action)

        self.font_format_action = QAction("Choose font", MainWindow)
        self.menu_format.addAction(self.font_format_action)

        self.leftalign_format_action = QAction("Align Text Left", MainWindow)
        self.menu_format.addAction(self.leftalign_format_action)

        self.centeralign_format_action = QAction("Align Text Center",
                                                 MainWindow)
        self.menu_format.addAction(self.centeralign_format_action)

        self.rightalign_format_action = QAction("Align Text Right", MainWindow)
        self.menu_format.addAction(self.rightalign_format_action)

        self.alignjustify_format_action = QAction("Align Text Justify",
                                                  MainWindow)
        self.menu_format.addAction(self.alignjustify_format_action)

        # menubar export menu

        self.toolbar = QToolBar(MainWindow)
        MainWindow.addToolBar(self.toolbar)

        self.addnew = QAction(QIcon("icons/notebookgrey.png"),
                              "Add New Nobebook", MainWindow)

        self.addnew.setShortcut('Ctrl+N')

        self.toolbar.addAction(self.addnew)

        self.addtab = QAction(QIcon("icons/tabtest"), "Add New Tab",
                              MainWindow)

        self.addtab.setShortcut('Ctrl+T')

        self.toolbar.addAction(self.addtab)

        self.toolbar.addSeparator()

        self.saveAction = QAction(QIcon("icons/save.png"),
                                  "Save Current Note File", MainWindow)

        self.saveAction.setShortcut('Ctrl+S')

        self.toolbar.addAction(self.saveAction)

        self.newFile = QAction(QIcon("icons/new.png"), "Create New Note File",
                               MainWindow)

        self.newFile.setShortcut('Ctrl+Shift+N')

        self.toolbar.addAction(self.newFile)

        self.openAction = QAction(QIcon("icons/open.png"), "open notes file",
                                  MainWindow)

        self.openAction.setShortcut('Ctrl+O')

        self.toolbar.addAction(self.openAction)

        self.toolbar.addSeparator()

        self.undoAction = QAction(QIcon("icons/undo.png"), "undo", MainWindow)

        self.undoAction.setShortcut('Ctrl+Z')

        self.toolbar.addAction(self.undoAction)

        self.redoAction = QAction(QIcon("icons/redo.png"), "redo", MainWindow)

        self.redoAction.setShortcut('Ctrl+Alt+Z')

        self.toolbar.addAction(self.redoAction)

        self.printcfg = QAction(QIcon("icons/pdf.png"), "print", MainWindow)

        self.toolbar.addAction(self.printcfg)

        self.toolbar.addSeparator()

        self.copyAction = QAction(QIcon("icons/copy.png"), "copy text",
                                  MainWindow)

        self.copyAction.setShortcut('Ctrl+C')

        self.toolbar.addAction(self.copyAction)

        self.pasteAction = QAction(QIcon("icons/paste.png"), "paste text",
                                   MainWindow)

        self.pasteAction.setShortcut('Ctrl+V')

        self.toolbar.addAction(self.pasteAction)

        self.cutAction = QAction(QIcon("icons/cut.png"), "cut text",
                                 MainWindow)

        self.cutAction.setShortcut('Ctrl+X')

        self.toolbar.addAction(self.cutAction)

        self.toolbar.addSeparator()

        self.leftAlign = QAction(QIcon("icons/alignleft.png"), "align left",
                                 MainWindow)

        self.toolbar.addAction(self.leftAlign)

        self.rightAlign = QAction(QIcon("icons/alignright.png"), "align right",
                                  MainWindow)

        self.toolbar.addAction(self.rightAlign)

        self.centerAlign = QAction(QIcon("icons/center.png"), "align center",
                                   MainWindow)

        self.toolbar.addAction(self.centerAlign)

        self.justifyAlign = QAction(QIcon("icons/justify.png"),
                                    "align justify", MainWindow)

        self.toolbar.addAction(self.justifyAlign)

        self.toolbar.addSeparator()

        self.dateAction = QAction(QIcon("icons/calendar.png"), "insert date",
                                  MainWindow)

        self.dateAction.setShortcut('Ctrl+Alt+D')

        self.toolbar.addAction(self.dateAction)

        self.timeAction = QAction(QIcon("icons/clock.png"), "insert time",
                                  MainWindow)

        self.timeAction.setShortcut('Ctrl+Alt+T')

        self.toolbar.addAction(self.timeAction)

        self.toolbar.addSeparator()

        self.bulletAction = QAction(QIcon("icons/bullets.png"),
                                    "insert bulleted list", MainWindow)

        self.bulletAction.setShortcut('Ctrl+B')

        self.toolbar.addAction(self.bulletAction)

        self.numberAction = QAction(QIcon("icons/numbers.png"),
                                    "insert numbered list", MainWindow)

        self.numberAction.setShortcut('Alt+N')

        self.toolbar.addAction(self.numberAction)

        self.toolbar.addSeparator()

        self.tableAction = QAction(QIcon("icons/table.png"), "insert table",
                                   MainWindow)

        self.tableAction.setShortcut('Ctrl+Shift+T')

        self.toolbar.addAction(self.tableAction)

        self.imageAction = QAction(QIcon("icons/image.png"), "insert image",
                                   MainWindow)

        self.imageAction.setShortcut('Ctrl+Alt+I')

        self.toolbar.addAction(self.imageAction)

        self.toolbar.addSeparator()

        self.fontcolorAction = QAction(QIcon("icons/fontcolor.png"),
                                       "Select font color", MainWindow)

        self.fontcolorAction.setShortcut('Ctrl+Shift+C')

        self.toolbar.addAction(self.fontcolorAction)

        self.fontBackgroundAction = QAction(QIcon("icons/highlight.png"),
                                            "Select font background color",
                                            MainWindow)

        self.fontBackgroundAction.setShortcut('Ctrl+Alt+C')

        self.toolbar.addAction(self.fontBackgroundAction)

        self.fontAction = QAction(QIcon("icons/text.png"), "Choose Font",
                                  MainWindow)

        self.fontAction.setShortcut('Ctrl+F')

        self.toolbar.addAction(self.fontAction)

        self.HRAction = QAction(QIcon("icons/hr.png"),
                                "Insert Horizontal Rule", MainWindow)

        self.HRAction.setShortcut('Ctrl+L')

        self.toolbar.addAction(self.HRAction)

        self.central_widget = QWidget(MainWindow)
        self.central_widget.setObjectName('central')

        self.splitter = QSplitter(self.central_widget)
        self.splitter.setOrientation(Qt.Horizontal)
        self.splitter.setStretchFactor(0, 25)
        self.splitter.setStretchFactor(1, 75)

        self.list = QListWidget(self.splitter)
        self.list.setObjectName("List")
        self.list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        #self.list.setAlternatingRowColors(True)

        self.list.setAcceptDrops(True)
        self.list.setDragDropMode(QAbstractItemView.InternalMove)
        self.list.setDragEnabled(True)

        self.stack = QStackedWidget(self.splitter)
        self.stack.setObjectName("Stack")
        self.stack.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)

        self.listFrame = QFrame()
        self.stackFrame = QFrame()  #maybe delete this

        self.splitter.addWidget(self.list)
        self.splitter.addWidget(self.stack)

        self.splitter.setSizes([50, 650])

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

        self.boxlayout = QHBoxLayout()
        self.central_widget.setLayout(self.boxlayout)
        MainWindow.setCentralWidget(self.central_widget)

        self.boxlayout.addWidget(self.splitter)
        MainWindow.show()
Example #18
0
    def __init__(self):
        QWidget.__init__(self)
        self.complex_display = False

        self.hbox = QVBoxLayout()
        self.gl_cmp = gl_cmp(os.path.join(get_sim_path(), "snapshots"))

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(42, 42))

        #self.tb_layer_editor = QAction(QIcon_load("layers"), _("Layer\neditor"), self)
        #self.tb_layer_editor.triggered.connect(self.callback_layer_editor)
        #toolbar.addAction(self.tb_layer_editor)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        self.xy = QAction(QIcon_load("xy"), _("xy"), self)
        self.xy.triggered.connect(self.callback_xy)
        toolbar.addAction(self.xy)

        self.yz = QAction(QIcon_load("yz"), _("yz"), self)
        self.yz.triggered.connect(self.callback_yz)
        toolbar.addAction(self.yz)

        self.xz = QAction(QIcon_load("xz"), _("xz"), self)
        self.xz.triggered.connect(self.callback_xz)
        toolbar.addAction(self.xz)

        self.tb_rotate = QAction(QIcon_load("rotate.png"), _("Rotate"), self)
        self.tb_rotate.triggered.connect(self.tb_rotate_click)
        toolbar.addAction(self.tb_rotate)
        self.tb_rotate.setEnabled(True)

        self.tb_config = QAction(QIcon_load("preferences-system"),
                                 _("Configuration"), self)
        self.tb_config.triggered.connect(self.callback_configure)
        toolbar.addAction(self.tb_config)

        self.fx_box = fx_selector()
        self.fx_box.file_name_set_start("light_ray_")
        self.fx_box.file_name_set_end(".dat")
        self.fx_box.update()

        self.fx_box.cb.currentIndexChanged.connect(self.fx_box_changed)
        toolbar.addWidget(self.fx_box)

        self.hbox.addWidget(toolbar)

        enable_3d = inp_get_token_value(
            os.path.join(get_sim_path(), "config.inp"),
            "#gui_config_3d_enabled")
        if enable_3d == None:
            enable_3d = "True"
        enable_3d = str2bool(enable_3d)

        if enable_3d == True:
            self.display = glWidget(self)
            self.update_ray_file()

            self.hbox.addWidget(self.display)
            #self.display.setMinimumSize(800, 600)

            self.timer = QTimer()
            self.timer.setSingleShot(True)
            self.timer.timeout.connect(self.timer_update)
            self.timer.start(5000)
        else:
            self.add_fallback()

        self.setLayout(self.hbox)
        global_object_register("display_recalculate", self.recalculate)
        global_object_register("display_set_selected_layer",
                               self.set_selected_layer)
Example #19
0
 def addToolBar(self, toolBar: QToolBar):
     if isinstance(toolBar, QToolBar):
         return toolBar
     elif isinstance(toolBar, str):
         toolBar = QToolBar(toolBar)
         return toolBar
Example #20
0
    def __init__(self, parent=None):
        super(myEditor, self).__init__(parent)
        self.MaxRecentFiles = 5
        self.windowList = []
        self.recentFileActs = []
        self.setAttribute(Qt.WA_DeleteOnClose)
        # Editor Widget ...
        QIcon.setThemeName('Faenza-Dark')
        self.editor = QPlainTextEdit()
        self.editor.setStyleSheet(stylesheet2(self))
        self.editor.setFrameStyle(QFrame.NoFrame)
        self.editor.setTabStopWidth(14)
        self.extra_selections = []
        self.fname = ""
        self.filename = ""
        # Line Numbers ...
        self.numbers = NumberBar(self.editor)

        self.createActions()
        # Laying out...
        layoutH = QHBoxLayout()
        layoutH.setSpacing(1.5)
        layoutH.addWidget(self.numbers)
        layoutH.addWidget(self.editor)

        ### begin toolbar
        tb = QToolBar(self)
        tb.setWindowTitle("File Toolbar")

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

        self.openAct = QAction("&Open",
                               self,
                               shortcut=QKeySequence.Open,
                               statusTip="open file",
                               triggered=self.openFile)
        self.openAct.setIcon(QIcon.fromTheme("document-open"))

        self.saveAct = QAction("&Save",
                               self,
                               shortcut=QKeySequence.Save,
                               statusTip="save file",
                               triggered=self.fileSave)
        self.saveAct.setIcon(QIcon.fromTheme("document-save"))

        self.saveAsAct = QAction("&Save as ...",
                                 self,
                                 shortcut=QKeySequence.SaveAs,
                                 statusTip="save file as ...",
                                 triggered=self.fileSaveAs)
        self.saveAsAct.setIcon(QIcon.fromTheme("document-save-as"))

        self.exitAct = QAction("Exit",
                               self,
                               shortcut=QKeySequence.Quit,
                               toolTip="Exit",
                               triggered=self.handleQuit)
        self.exitAct.setIcon(QIcon.fromTheme("application-exit"))

        ### find / replace toolbar
        self.tbf = QToolBar(self)
        self.tbf.setWindowTitle("Find Toolbar")
        self.findfield = QLineEdit()
        self.findfield.addAction(QIcon.fromTheme("edit-find"),
                                 QLineEdit.LeadingPosition)
        self.findfield.setClearButtonEnabled(True)
        self.findfield.setFixedWidth(150)
        self.findfield.setPlaceholderText("find")
        self.findfield.setToolTip("press RETURN to find")
        self.findfield.setText("")
        ft = self.findfield.text()
        self.findfield.returnPressed.connect(self.findText)
        self.tbf.addWidget(self.findfield)
        self.replacefield = QLineEdit()
        self.replacefield.addAction(QIcon.fromTheme("edit-find-and-replace"),
                                    QLineEdit.LeadingPosition)
        self.replacefield.setClearButtonEnabled(True)
        self.replacefield.setFixedWidth(150)
        self.replacefield.setPlaceholderText("replace with")
        self.replacefield.setToolTip("press RETURN to replace the first")
        self.replacefield.returnPressed.connect(self.replaceOne)
        self.tbf.addSeparator()
        self.tbf.addWidget(self.replacefield)
        self.tbf.addSeparator()

        self.tbf.addAction("replace all", self.replaceAll)
        self.tbf.addSeparator()

        layoutV = QVBoxLayout()

        bar = self.menuBar()

        self.filemenu = bar.addMenu("File")
        self.separatorAct = self.filemenu.addSeparator()
        self.filemenu.addAction(self.newAct)
        self.filemenu.addAction(self.openAct)
        self.filemenu.addAction(self.saveAct)
        self.filemenu.addAction(self.saveAsAct)
        self.filemenu.addSeparator()
        for i in range(self.MaxRecentFiles):
            self.filemenu.addAction(self.recentFileActs[i])
        self.updateRecentFileActions()
        self.filemenu.addSeparator()
        self.filemenu.addAction(self.exitAct)
        bar.setStyleSheet(stylesheet2(self))
        editmenu = bar.addMenu("Edit")
        editmenu.addAction(
            QAction(QIcon.fromTheme('edit-copy'),
                    "Copy",
                    self,
                    triggered=self.editor.copy,
                    shortcut=QKeySequence.Copy))
        editmenu.addAction(
            QAction(QIcon.fromTheme('edit-cut'),
                    "Cut",
                    self,
                    triggered=self.editor.cut,
                    shortcut=QKeySequence.Cut))
        editmenu.addAction(
            QAction(QIcon.fromTheme('edit-paste'),
                    "Paste",
                    self,
                    triggered=self.editor.paste,
                    shortcut=QKeySequence.Paste))
        editmenu.addAction(
            QAction(QIcon.fromTheme('edit-delete'),
                    "Delete",
                    self,
                    triggered=self.editor.cut,
                    shortcut=QKeySequence.Delete))
        editmenu.addSeparator()
        editmenu.addAction(
            QAction(QIcon.fromTheme('edit-select-all'),
                    "Select All",
                    self,
                    triggered=self.editor.selectAll,
                    shortcut=QKeySequence.SelectAll))

        layoutV.addWidget(bar)
        layoutV.addWidget(self.tbf)
        layoutV.addLayout(layoutH)

        ### main window
        mq = QWidget(self)
        mq.setLayout(layoutV)
        self.setCentralWidget(mq)

        # Event Filter ...
        self.installEventFilter(self)
        self.editor.setFocus()
        self.cursor = QTextCursor()
        self.editor.setPlainText("hello")
        self.editor.moveCursor(self.cursor.End)
        self.editor.document().modificationChanged.connect(
            self.setWindowModified)

        # Brackets ExtraSelection ...
        self.left_selected_bracket = QTextEdit.ExtraSelection()
        self.right_selected_bracket = QTextEdit.ExtraSelection()
Example #21
0
    def __init__(self,
                 path,
                 show_inp_files=True,
                 act_as_browser=True,
                 big_toolbar=False,
                 title=_("Open file")):
        QWidget.__init__(self)
        self.act_as_browser = act_as_browser
        self.menu_new_material_enabled = False
        self.menu_new_spectra_enabled = False
        self.show_inp_files = show_inp_files
        self.show_directories = True
        self.file_path = ""
        self.vbox = QVBoxLayout()
        self.setLayout(self.vbox)

        self.toolbar = QToolBar()
        if big_toolbar == True:
            self.toolbar.setIconSize(QSize(42, 42))
            self.toolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        #self.toolbar.setMaximumHeight(50)

        self.up = QAction(icon_get("go-up"), wrap_text(_("Back"), 8), self)
        self.up.triggered.connect(self.on_up_clicked)
        self.toolbar.addAction(self.up)

        self.home = QAction(icon_get("user-home"), wrap_text(_("Home"), 8),
                            self)
        self.home.triggered.connect(self.on_home_clicked)
        self.toolbar.addAction(self.home)

        self.resize(800, 500)
        self.path_widget = QLineEdit()
        #		self.path_widget.setMinimumHeight(30)
        #		self.path_widget.setStyleSheet("padding: 0; ")
        self.toolbar.addWidget(self.path_widget)

        self.setWindowTitle(title + " https://www.gpvdm.com")
        self.setWindowIcon(icon_get("folder"))
        #		self.listwidget=QListWidget()
        #		self.listwidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        #		self.listwidget.setStyleSheet("margin: 0; padding: 0; ")
        self.vbox.addWidget(self.toolbar)

        if self.act_as_browser == False:
            self.viewer = gpvdm_viewer(path, open_own_files=False)
        else:
            self.viewer = gpvdm_viewer(path)

        self.viewer.set_directory_view(True)
        self.vbox.addWidget(self.viewer)

        self.root_dir = path

        self.path_widget.setText(path)

        self.viewer.path_changed.connect(self.change_path)

        if self.act_as_browser == False:
            self.viewer.accept.connect(self.callback_accept)

        self.change_path()
        self.show()
Example #22
0
    def __init__(self, name="", parent_dataset=None, ax=None):
        """
        **Constructor**
        
        Keyword Arguments:
            - name {[type]} -- [description] (default: {""})
            - parent_dataset {[type]} -- [description] (default: {None})
            - ax {[type]} -- [description] (default: {None})
        """
        super().__init__(name, parent_dataset, ax)

        # add widgets specific to the theory
        tb = QToolBar()
        tb.setIconSize(QSize(24, 24))

        self.tbutflow = QToolButton()
        self.tbutflow.setPopupMode(QToolButton.MenuButtonPopup)
        menu = QMenu()
        self.shear_flow_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icon-shear.png'), "Shear Flow")
        self.extensional_flow_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icon-uext.png'),
            "Extensional Flow")
        if self.flow_mode == FlowMode.shear:
            self.tbutflow.setDefaultAction(self.shear_flow_action)
        else:
            self.tbutflow.setDefaultAction(self.extensional_flow_action)
        self.tbutflow.setMenu(menu)
        tb.addWidget(self.tbutflow)

        self.tbutmodes = QToolButton()
        self.tbutmodes.setPopupMode(QToolButton.MenuButtonPopup)
        menu = QMenu()
        self.get_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-broadcasting.png'),
            "Get Modes")
        self.edit_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-edit-file.png'),
            "Edit Modes")
        self.plot_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-scatter-plot.png'),
            "Plot Modes")
        self.save_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-save-Maxwell.png'),
            "Save Modes")
        self.tbutmodes.setDefaultAction(self.get_modes_action)
        self.tbutmodes.setMenu(menu)
        tb.addWidget(self.tbutmodes)

        self.thToolsLayout.insertWidget(0, tb)

        connection_id = self.shear_flow_action.triggered.connect(
            self.select_shear_flow)
        connection_id = self.extensional_flow_action.triggered.connect(
            self.select_extensional_flow)
        connection_id = self.get_modes_action.triggered.connect(
            self.get_modes_reptate)
        connection_id = self.edit_modes_action.triggered.connect(
            self.edit_modes_window)
        connection_id = self.plot_modes_action.triggered.connect(
            self.plot_modes_graph)
        connection_id = self.save_modes_action.triggered.connect(
            self.save_modes)
Example #23
0
    def __setupUi(self):
        """Set up the UI.
        """
        if self.__macUnified:
            self.tab = QToolBar()

            self.addToolBar(Qt.TopToolBarArea, self.tab)
            self.setUnifiedTitleAndToolBarOnMac(True)

            # This does not seem to work
            self.setWindowFlags(self.windowFlags() & \
                                ~Qt.MacWindowToolBarButtonHint)

            self.tab.actionTriggered[QAction].connect(
                self.__macOnToolBarAction)

            central = QStackedWidget()

            central.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        else:
            self.tab = central = QTabWidget(self)

        # Add a close button to the bottom of the dialog
        # (to satisfy GNOME 3 which shows the dialog  without a title bar).
        container = container_widget_helper()
        container.layout().addWidget(central)
        buttonbox = QDialogButtonBox(QDialogButtonBox.Close)
        buttonbox.rejected.connect(self.close)
        container.layout().addWidget(buttonbox)

        self.setCentralWidget(container)

        self.stack = central

        # General Tab
        tab = QWidget()
        self.addTab(tab,
                    self.tr("General"),
                    toolTip=self.tr("General Options"))

        form = QFormLayout()
        tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        nodes = QWidget(self, objectName="nodes")
        nodes.setLayout(QVBoxLayout())
        nodes.layout().setContentsMargins(0, 0, 0, 0)

        cb_anim = QCheckBox(self.tr("Enable node animations"),
                            objectName="enable-node-animations",
                            toolTip=self.tr(
                                "Enable shadow and ping animations for nodes "
                                "in the workflow."))
        self.bind(cb_anim, "checked", "schemeedit/enable-node-animations")
        nodes.layout().addWidget(cb_anim)

        form.addRow(self.tr("Nodes"), nodes)

        links = QWidget(self, objectName="links")
        links.setLayout(QVBoxLayout())
        links.layout().setContentsMargins(0, 0, 0, 0)

        cb_show = QCheckBox(self.tr("Show channel names between widgets"),
                            objectName="show-channel-names",
                            toolTip=self.tr(
                                "Show source and sink channel names "
                                "over the links."))

        self.bind(cb_show, "checked", "schemeedit/show-channel-names")

        links.layout().addWidget(cb_show)

        form.addRow(self.tr("Links"), links)

        quickmenu = QWidget(self, objectName="quickmenu-options")
        quickmenu.setLayout(QVBoxLayout())
        quickmenu.layout().setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("On double click"),
                        toolTip=self.tr("Open quick menu on a double click "
                                        "on an empty spot in the canvas"))

        cb2 = QCheckBox(self.tr("On right click"),
                        toolTip=self.tr("Open quick menu on a right click "
                                        "on an empty spot in the canvas"))

        cb3 = QCheckBox(self.tr("On space key press"),
                        toolTip=self.tr("On Space key press while the mouse"
                                        "is hovering over the canvas."))

        cb4 = QCheckBox(self.tr("On any key press"),
                        toolTip=self.tr("On any key press while the mouse"
                                        "is hovering over the canvas."))

        self.bind(cb1, "checked", "quickmenu/trigger-on-double-click")
        self.bind(cb2, "checked", "quickmenu/trigger-on-right-click")
        self.bind(cb3, "checked", "quickmenu/trigger-on-space-key")
        self.bind(cb4, "checked", "quickmenu/trigger-on-any-key")

        quickmenu.layout().addWidget(cb1)
        quickmenu.layout().addWidget(cb2)
        quickmenu.layout().addWidget(cb3)
        quickmenu.layout().addWidget(cb4)

        form.addRow(self.tr("Open quick menu on"), quickmenu)

        startup = QWidget(self, objectName="startup-group")
        startup.setLayout(QVBoxLayout())
        startup.layout().setContentsMargins(0, 0, 0, 0)

        cb_splash = QCheckBox(self.tr("Show splash screen"),
                              self,
                              objectName="show-splash-screen")

        cb_welcome = QCheckBox(self.tr("Show welcome screen"),
                               self,
                               objectName="show-welcome-screen")

        self.bind(cb_splash, "checked", "startup/show-splash-screen")
        self.bind(cb_welcome, "checked", "startup/show-welcome-screen")

        startup.layout().addWidget(cb_splash)
        startup.layout().addWidget(cb_welcome)

        form.addRow(self.tr("On startup"), startup)

        toolbox = QWidget(self, objectName="toolbox-group")
        toolbox.setLayout(QVBoxLayout())
        toolbox.layout().setContentsMargins(0, 0, 0, 0)

        exclusive = QCheckBox(self.tr("Only one tab can be open at a time"))

        self.bind(exclusive, "checked", "mainwindow/toolbox-dock-exclusive")

        toolbox.layout().addWidget(exclusive)

        form.addRow(self.tr("Tool box"), toolbox)
        tab.setLayout(form)

        # Output Tab
        tab = QWidget()
        self.addTab(tab, self.tr("Output"), toolTip="Output Redirection")

        form = QFormLayout()
        box = QWidget(self, objectName="streams")
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Standard output"))
        cb2 = QCheckBox(self.tr("Standard error"))

        self.bind(cb1, "checked", "output/redirect-stdout")
        self.bind(cb2, "checked", "output/redirect-stderr")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        box.setLayout(layout)

        form.addRow(self.tr("Redirect output"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        combo = QComboBox()
        combo.addItems([
            self.tr("Critical"),
            self.tr("Error"),
            self.tr("Warn"),
            self.tr("Info"),
            self.tr("Debug")
        ])

        cb = QCheckBox(self.tr("Show output on 'Error'"),
                       objectName="focus-on-error")

        self.bind(combo, "currentIndex", "logging/level")
        self.bind(cb, "checked", "output/show-on-error")

        layout.addWidget(combo)
        layout.addWidget(cb)
        box.setLayout(layout)

        form.addRow(self.tr("Logging"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Stay on top"), objectName="stay-on-top")

        cb2 = QCheckBox(self.tr("Dockable"), objectName="output-dockable")

        self.bind(cb1, "checked", "output/stay-on-top")
        self.bind(cb2, "checked", "output/dockable")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        box.setLayout(layout)

        form.addRow(self.tr("Output window"), box)

        box = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        cb1 = QCheckBox(self.tr("Open in external browser"),
                        objectName="open-in-external-browser")

        cb2 = QCheckBox(self.tr("Stay on top"), objectName="help-stay-on-top")

        cb3 = QCheckBox(self.tr("Dockable"), objectName="help-dockable")

        self.bind(cb1, "checked", "help/open-in-external-browser")
        self.bind(cb2, "checked", "help/stay-on-top")
        self.bind(cb3, "checked", "help/dockable")

        layout.addWidget(cb1)
        layout.addWidget(cb2)
        layout.addWidget(cb3)
        box.setLayout(layout)

        form.addRow(self.tr("Help window"), box)

        tab.setLayout(form)

        # Categories Tab
        tab = QWidget()
        layout = QVBoxLayout()
        view = QListView()
        from .. import registry
        reg = registry.global_registry()
        model = QStandardItemModel()
        settings = QSettings()
        for cat in reg.categories():
            item = QStandardItem()
            item.setText(cat.name)
            item.setCheckable(True)
            visible, _ = category_state(cat, settings)
            item.setCheckState(Qt.Checked if visible else Qt.Unchecked)
            model.appendRow([item])

        view.setModel(model)
        layout.addWidget(view)
        tab.setLayout(layout)
        model.itemChanged.connect(lambda item: save_category_state(
            reg.category(str(item.text())),
            _State(item.checkState() == Qt.Checked, -1), settings))

        self.addTab(tab, "Categories")

        if self.__macUnified:
            # Need some sensible size otherwise mac unified toolbar 'takes'
            # the space that should be used for layout of the contents
            self.adjustSize()
    def __init__(self, name="", parent_dataset=None, ax=None):
        """**Constructor**"""
        super().__init__(name, parent_dataset, ax)

        # add widgets specific to the theory
        tb = QToolBar()
        tb.setIconSize(QSize(24, 24))

        if not isinstance(parent_dataset.parent_application,
                          GUIApplicationLAOS):
            self.tbutflow = QToolButton()
            self.tbutflow.setPopupMode(QToolButton.MenuButtonPopup)
            menu = QMenu()
            self.shear_flow_action = menu.addAction(
                QIcon(':/Icon8/Images/new_icons/icon-shear.png'), "Shear Flow")
            self.extensional_flow_action = menu.addAction(
                QIcon(':/Icon8/Images/new_icons/icon-uext.png'),
                "Extensional Flow")
            if self.flow_mode == FlowMode.shear:
                self.tbutflow.setDefaultAction(self.shear_flow_action)
            else:
                self.tbutflow.setDefaultAction(self.extensional_flow_action)
            self.tbutflow.setMenu(menu)
            tb.addWidget(self.tbutflow)
            connection_id = self.shear_flow_action.triggered.connect(
                self.select_shear_flow)
            connection_id = self.extensional_flow_action.triggered.connect(
                self.select_extensional_flow)
        else:
            self.function = self.calculate_giesekusLAOS

        self.tbutmodes = QToolButton()
        self.tbutmodes.setPopupMode(QToolButton.MenuButtonPopup)
        menu = QMenu()
        self.get_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-broadcasting.png'),
            "Get Modes")
        self.edit_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-edit-file.png'),
            "Edit Modes")
        self.plot_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-scatter-plot.png'),
            "Plot Modes")
        self.save_modes_action = menu.addAction(
            QIcon(':/Icon8/Images/new_icons/icons8-save-Maxwell.png'),
            "Save Modes")
        self.tbutmodes.setDefaultAction(self.get_modes_action)
        self.tbutmodes.setMenu(menu)
        tb.addWidget(self.tbutmodes)

        #SpinBox "n-stretch modes"
        self.spinbox = QSpinBox()
        self.spinbox.setRange(
            0, self.parameters["nmodes"].value)  # min and max number of modes
        self.spinbox.setSuffix(" stretch")
        self.spinbox.setToolTip("Number of stretching modes")
        self.spinbox.setValue(self.parameters["nmodes"].value)  #initial value
        tb.addWidget(self.spinbox)

        self.thToolsLayout.insertWidget(0, tb)

        connection_id = self.get_modes_action.triggered.connect(
            self.get_modes_reptate)
        connection_id = self.edit_modes_action.triggered.connect(
            self.edit_modes_window)
        connection_id = self.plot_modes_action.triggered.connect(
            self.plot_modes_graph)
        connection_id = self.save_modes_action.triggered.connect(
            self.save_modes)
        connection_id = self.spinbox.valueChanged.connect(
            self.handle_spinboxValueChanged)
Example #25
0
    def __init__(self, parent=None):
        """Initialize the QMainWindow widget.

        The window title, window icon, and window size are initialized here as well
        as the following widgets: QMediaPlayer, QMediaPlaylist, QMediaContent, QMenuBar,
        QToolBar, QLabel, QPixmap, QSlider, QDockWidget, QListWidget, QWidget, and
        QVBoxLayout. The connect signals for relavant widgets are also initialized.
        """
        super(MusicPlayer, self).__init__(parent)
        self.setWindowTitle('Mosaic')

        window_icon = utilities.resource_filename('mosaic.images', 'icon.png')
        self.setWindowIcon(QIcon(window_icon))
        self.resize(defaults.Settings().window_size,
                    defaults.Settings().window_size + 63)

        # Initiates Qt objects to be used by MusicPlayer
        self.player = QMediaPlayer()
        self.playlist = QMediaPlaylist()
        self.playlist_location = defaults.Settings().playlist_path
        self.content = QMediaContent()
        self.menu = self.menuBar()
        self.toolbar = QToolBar()
        self.art = QLabel()
        self.pixmap = QPixmap()
        self.slider = QSlider(Qt.Horizontal)
        self.duration_label = QLabel()
        self.playlist_dock = QDockWidget('Playlist', self)
        self.library_dock = QDockWidget('Media Library', self)
        self.playlist_view = QListWidget()
        self.library_view = library.MediaLibraryView()
        self.library_model = library.MediaLibraryModel()
        self.preferences = configuration.PreferencesDialog()
        self.widget = QWidget()
        self.layout = QVBoxLayout(self.widget)
        self.duration = 0
        self.playlist_dock_state = None
        self.library_dock_state = None

        # Sets QWidget() as the central widget of the main window
        self.setCentralWidget(self.widget)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.art.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)

        # Initiates the playlist dock widget and the library dock widget
        self.addDockWidget(defaults.Settings().dock_position,
                           self.playlist_dock)
        self.playlist_dock.setWidget(self.playlist_view)
        self.playlist_dock.setVisible(defaults.Settings().playlist_on_start)
        self.playlist_dock.setFeatures(QDockWidget.DockWidgetClosable)

        self.addDockWidget(defaults.Settings().dock_position,
                           self.library_dock)
        self.library_dock.setWidget(self.library_view)
        self.library_dock.setVisible(
            defaults.Settings().media_library_on_start)
        self.library_dock.setFeatures(QDockWidget.DockWidgetClosable)
        self.tabifyDockWidget(self.playlist_dock, self.library_dock)

        # Sets the range of the playback slider and sets the playback mode as looping
        self.slider.setRange(0, self.player.duration() / 1000)
        self.playlist.setPlaybackMode(QMediaPlaylist.Sequential)

        # OSX system menu bar causes conflicts with PyQt5 menu bar
        if sys.platform == 'darwin':
            self.menu.setNativeMenuBar(False)

        # Initiates Settings in the defaults module to give access to settings.toml
        defaults.Settings()

        # Signals that connect to other methods when they're called
        self.player.metaDataChanged.connect(self.display_meta_data)
        self.slider.sliderMoved.connect(self.seek)
        self.player.durationChanged.connect(self.song_duration)
        self.player.positionChanged.connect(self.song_position)
        self.player.stateChanged.connect(self.set_state)
        self.playlist_view.itemActivated.connect(self.activate_playlist_item)
        self.library_view.activated.connect(self.open_media_library)
        self.playlist.currentIndexChanged.connect(self.change_index)
        self.playlist.mediaInserted.connect(self.initialize_playlist)
        self.playlist_dock.visibilityChanged.connect(
            self.dock_visiblity_change)
        self.library_dock.visibilityChanged.connect(self.dock_visiblity_change)
        self.preferences.dialog_media_library.media_library_line.textChanged.connect(
            self.change_media_library_path)
        self.preferences.dialog_view_options.dropdown_box.currentIndexChanged.connect(
            self.change_window_size)
        self.art.mousePressEvent = self.press_playback

        # Creating the menu controls, media controls, and window size of the music player
        self.menu_controls()
        self.media_controls()
        self.load_saved_playlist()
Example #26
0
    def __init__(self, app, *__args):
        super().__init__(*__args)

        self.app = app
        self.emulator = self.app.dwarf.emulator
        self.until_address = 0

        self._uc_user_arch = None
        self._uc_user_mode = None
        self._cs_user_arch = None
        self._cs_user_mode = None

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        self._toolbar_container = QHBoxLayout()
        self._toolbar = QToolBar()
        self._toolbar.addAction('Start', self.handle_start)
        self._toolbar.addAction('Step', self.handle_step)
        self._toolbar.addAction('Step next call', self.handle_step_next_call)
        self._toolbar.addAction('Step next jump', self.handle_step_next_jump)
        self._toolbar.addAction('Stop', self.handle_stop)
        self._toolbar.addAction('Clear', self.handle_clear)
        self._toolbar.addAction('Options', self.handle_options)
        self._toolbar_container.addWidget(self._toolbar)

        selection_layout = QHBoxLayout()
        selection_layout.setAlignment(Qt.AlignRight)
        self.cpu_selection = QComboBox(self)
        for v in unicorn_const.__dict__:
            if 'UC_ARCH_' in v:
                self.cpu_selection.addItem('_'.join(v.split('_')[2:]).lower(), unicorn_const.__dict__[v])
        self.cpu_selection.activated[str].connect(self._on_cpu_selection)
        self.mode_selection = QComboBox(self)
        for v in unicorn_const.__dict__:
            if 'UC_MODE_' in v:
                self.mode_selection.addItem('_'.join(v.split('_')[2:]).lower(), unicorn_const.__dict__[v])
        self.mode_selection.activated[str].connect(self._on_mode_selection)
        selection_layout.addWidget(self.cpu_selection)
        selection_layout.addWidget(self.mode_selection)
        self._toolbar_container.addLayout(selection_layout)

        layout.addLayout(self._toolbar_container)

        self.tabs = QTabWidget()
        self.assembly = DisassemblyView(self.app)
        self.assembly.display_jumps = False
        self.assembly.follow_jumps = False
        self.memory_table = MemoryPanel(self.app)
        self.memory_table._read_only = True
        self.tabs.addTab(self.assembly, 'Code')
        self.tabs.addTab(self.memory_table, 'Memory')

        layout.addWidget(self.tabs)

        self.ranges_list = DwarfListView(self.app)
        self.ranges_list.doubleClicked.connect(self.ranges_item_double_clicked)
        self._ranges_model = QStandardItemModel(0, 2)
        self._ranges_model.setHeaderData(0, Qt.Horizontal, 'Memory')
        self._ranges_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole)
        self._ranges_model.setHeaderData(1, Qt.Horizontal, 'Size')
        self._access_model.setHeaderData(1, Qt.Horizontal, Qt.AlignLeft, Qt.TextAlignmentRole)
        self.ranges_list.setModel(self._ranges_model)
        self.tabs.addTab(self.ranges_list, 'Ranges')

        self._access_list = DwarfListView(self.app)
        self._access_list.doubleClicked.connect(self.access_item_double_clicked)
        self._access_model = QStandardItemModel(0, 3)
        self._access_model.setHeaderData(0, Qt.Horizontal, 'Address')
        self._access_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole)
        self._access_model.setHeaderData(1, Qt.Horizontal, 'Access')
        self._access_model.setHeaderData(1, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole)
        self._access_model.setHeaderData(2, Qt.Horizontal, 'Value')
        self._access_list.setModel(self._access_model)
        self.tabs.addTab(self._access_list, 'Access')

        layout.setSpacing(0)
        self.setLayout(layout)

        self.console = self.app.console.get_emu_console()

        self.emulator.onEmulatorSetup.connect(self.on_emulator_setup)
        self.emulator.onEmulatorStart.connect(self.on_emulator_start)
        self.emulator.onEmulatorStop.connect(self.on_emulator_stop)
        # self.emulator.onEmulatorStep.connect(self.on_emulator_step)
        self.emulator.onEmulatorHook.connect(self.on_emulator_hook)
        self.emulator.onEmulatorMemoryHook.connect(self.on_emulator_memory_hook)
        self.emulator.onEmulatorMemoryRangeMapped.connect(self.on_emulator_memory_range_mapped)
        self.emulator.onEmulatorLog.connect(self.on_emulator_log)

        self._require_register_result = None
        self._last_instruction_address = 0
Example #27
0
    def __init__(self):
        QWidget.__init__(self)
        self.complex_display = False

        self.hbox = QVBoxLayout()

        mesh = get_mesh()
        if mesh.y.circuit_model == True and mesh.x.tot_points == 1 and mesh.z.tot_points == 1:
            self.display = circuit_editor()

            epi = get_epi()
            pos = 3
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3, "bat")
            pos = pos + 1

            for l in epi.layers:
                f = inp()
                f.load(
                    os.path.join(get_sim_path(), l.shape_electrical + ".inp"))
                component = f.get_token("#electrical_component")
                if component == "resistance":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "resistor")
                if component == "diode":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "diode")

                pos = pos + 1
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3,
                                                     "ground")
            self.display.ersatzschaltbild.objects_push()

            if inp().isfile(os.path.join(get_sim_path(),
                                         "diagram.inp")) == True:
                self.display.ersatzschaltbild.load()
        else:
            toolbar = QToolBar()
            toolbar.setIconSize(QSize(42, 42))

            spacer = QWidget()
            spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            toolbar.addWidget(spacer)

            self.xy = QAction(icon_get("xy"), _("xy"), self)
            self.xy.triggered.connect(self.callback_xy)
            toolbar.addAction(self.xy)

            self.yz = QAction(icon_get("yz"), _("yz"), self)
            self.yz.triggered.connect(self.callback_yz)
            toolbar.addAction(self.yz)

            self.xz = QAction(icon_get("xz"), _("xz"), self)
            self.xz.triggered.connect(self.callback_xz)
            toolbar.addAction(self.xz)

            self.tb_rotate = QAction(icon_get("rotate.png"), _("Rotate"), self)
            self.tb_rotate.triggered.connect(self.tb_rotate_click)
            toolbar.addAction(self.tb_rotate)
            self.tb_rotate.setEnabled(True)

            self.hbox.addWidget(toolbar)

            self.display = glWidget(self)
            self.display.draw_electrical_mesh = True
            self.display.view.draw_device = False
            self.display.enable_cordinates = False
            self.display.view.render_photons = False
            #self.display.force_redraw()
            global_object_register("display_mesh_recalculate",
                                   self.recalculate)

        self.hbox.addWidget(self.display)

        self.setLayout(self.hbox)
Example #28
0
    def createBridgePanel(self):
        self.setWindowTitle(self.__windowTitile)
        self.setWindowIcon(self.iconStart)
        menubar = self.menuBar()
        self.statusBar()

        self.actionNewV2rayConfigFile = QAction(
            self.translate("bridgePanel", "Add V2Ray-core Config File"), self)
        self.actionNewV2rayConfigFile.setShortcut(QKeySequence.New)
        self.actionNewV2rayConfigFile.setStatusTip(
            self.translate("bridgePanel", "Add V2Ray-core Config File"))

        self.actionSaveV2rayshellConfigFile = QAction(
            self.translate("bridgePanel", "Save V2Ray-shell Config File"),
            self)
        self.actionSaveV2rayshellConfigFile.setShortcut(QKeySequence.Save)
        self.actionSaveV2rayshellConfigFile.setStatusTip(
            self.translate("bridgePanel", "Save V2Ray-shell Config File"))

        self.actionReloadV2rayshellConfigFile = QAction(
            self.translate("bridgePanel", "Open V2Ray-shell Config File"),
            self)
        self.actionReloadV2rayshellConfigFile.setShortcut(QKeySequence.Open)
        self.actionReloadV2rayshellConfigFile.setStatusTip(
            self.translate("bridgePanel", "Open V2Ray-shell Config File"))

        self.actionQuitV2rayshellPanel = QAction(
            self.translate("bridgePanel", "Quit"), self)
        if sys.platform.startswith('win'):
            self.actionQuitV2rayshellPanel.setShortcut("Ctrl+Q")
        else:
            self.actionQuitV2rayshellPanel.setShortcut(QKeySequence.Quit)
        self.actionQuitV2rayshellPanel.setStatusTip(
            self.translate("bridgePanel", "Quit V2Ray-shell"))

        fileMenu = menubar.addMenu(self.translate("bridgePanel", "&File"))
        fileMenu.addAction(self.actionNewV2rayConfigFile)
        fileMenu.addSeparator()
        fileMenu.addAction(self.actionReloadV2rayshellConfigFile)
        fileMenu.addAction(self.actionSaveV2rayshellConfigFile)
        fileMenu.addSeparator()
        fileMenu.addAction(self.actionQuitV2rayshellPanel)

        self.texteditBridge = QTextEdit(self)
        self.texteditBridge.setReadOnly(True)

        self.tableWidgetBridge = QTableWidget()
        self.tableWidgetBridge.setRowCount(0)
        self.tableWidgetBridge.setColumnCount(5)
        self.tableWidgetBridge.setHorizontalHeaderLabels(self.labelBridge)
        self.tableWidgetBridge.setSelectionMode(
            QAbstractItemView.SingleSelection)
        self.tableWidgetBridge.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.tableWidgetBridge.setEditTriggers(
            QAbstractItemView.NoEditTriggers)
        #self.tableWidgetBridge.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.tableWidgetBridge.setContextMenuPolicy(Qt.CustomContextMenu)

        self.popMenu = popMenu = QMenu(self.tableWidgetBridge)
        self.actionpopMenuAddV2rayConfigFile = QAction(
            self.translate("bridgePanel", "Add V2Ray Config File"), self)
        self.actionpopMenuAddV2rayConfigFile.setShortcut("Ctrl+n")
        self.actionpopMenuEditV2rayConfigFile = QAction(
            self.translate("bridgePanel", "Edit V2Ray Config File"), self)
        self.actionpopMenuProxyCheckTimeLag = QAction(
            self.translate("bridgePanel", "Proxy Time Lag Check..."), self)
        self.actionpopMenuDeleteRow = QAction(
            self.translate("bridgePanel", "Delete"), self)

        popMenu.addAction(self.actionpopMenuAddV2rayConfigFile)
        popMenu.addAction(self.actionpopMenuEditV2rayConfigFile)
        popMenu.addAction(self.actionpopMenuProxyCheckTimeLag)
        popMenu.addAction(self.actionpopMenuDeleteRow)

        self.actionopenV2rayshellPreferencesPanel = QAction(
            self.translate("bridgePanel", "preferences"), self)
        self.actionopenV2rayshellPreferencesPanel.setStatusTip(
            self.translate("bridgePanel", "Setting V2Ray-shell"))

        optionMenu = menubar.addMenu(self.translate("bridgePanel", "&options"))
        optionMenu.addAction(self.actionpopMenuProxyCheckTimeLag)
        optionMenu.addAction(self.actionopenV2rayshellPreferencesPanel)

        helpMenu = menubar.addMenu(self.translate("bridgePanel", "&help"))
        self.actioncheckv2raycoreupdate = QAction(
            self.translate("bridgePanel", "check V2Ray-core update"), self)
        self.actionv2rayshellBugreport = QAction(
            self.translate("bridgePanel", "Bug Report"), self)
        self.actionaboutv2rayshell = QAction(
            self.translate("bridgePanel", "About"), self)

        helpMenu.addAction(self.actioncheckv2raycoreupdate)
        helpMenu.addAction(self.actionv2rayshellBugreport)
        helpMenu.addAction(self.actionaboutv2rayshell)

        toolBar = QToolBar()
        self.actionV2rayStart = QAction(self.translate("bridgePanel", "Start"))
        self.actionV2rayStart.setIcon(self.style().standardIcon(
            getattr(QStyle, "SP_MediaPlay")))
        self.actionV2rayStop = QAction(self.translate("bridgePanel", "Stop"))
        self.actionV2rayStop.setIcon(self.style().standardIcon(
            getattr(QStyle, "SP_MediaStop")))
        toolBar.addAction(self.actionV2rayStart)
        toolBar.addAction(self.actionV2rayStop)
        self.addToolBar(toolBar)

        self.trayIconMenu = QMenu()
        self.v2rayshellTrayIcon.setContextMenu(self.trayIconMenu)

        self.trayIconMenushowhidePanel = QAction(
            self.translate("bridgePanel", "Show/Hide"))
        self.trayIconMenuclosePanel = QAction(
            self.translate("bridgePanel", "Quit"))

        self.trayIconMenu.addAction(self.trayIconMenushowhidePanel)
        self.trayIconMenu.addSeparator()
        self.trayIconMenu.addAction(self.trayIconMenuclosePanel)

        self.splitterBridge = QSplitter(Qt.Vertical)
        self.splitterBridge.addWidget(self.tableWidgetBridge)
        self.splitterBridge.addWidget(self.texteditBridge)

        self.setCentralWidget(self.splitterBridge)

        self.createBridgePanelSignals()

        self.onloadV2rayshellConfigFile(init=True)

        self.onv2raycoreStart()

        self.autocheckv2raycoreUpdate()
Example #29
0
    def initUI(self):
        self.statusBar()

        self.quality = 256
        self.duration = 0.2

        self.path_to_add = '/home'
        self.path_to_save = '/home'

        tlb = QToolBar('ToolBar')
        tlb.setIconSize(QSize(48, 48))

        saveAct = QAction(QIcon('icons/save.png'), 'Save', self)
        saveAct.triggered.connect(self.save)
        tlb.addAction(saveAct)

        cleanAct = QAction(QIcon('icons/clean.png'), 'Clean', self)
        cleanAct.triggered.connect(self.clean)
        tlb.addAction(cleanAct)

        playAct = QAction(QIcon('icons/play.png'), 'Play', self)
        playAct.triggered.connect(self.play)
        tlb.addAction(playAct)

        addAct = QAction(QIcon('icons/add.png'), 'Add', self)
        addAct.triggered.connect(self.add)
        tlb.addAction(addAct)

        delAct = QAction(QIcon('icons/delete.png'), 'Delete', self)
        delAct.setShortcut('Backspace')
        delAct.triggered.connect(self.delete)
        tlb.addAction(delAct)

        remAct = QAction(QIcon('icons/remove.png'), 'Remove', self)
        remAct.setShortcut('Ctrl+X')
        remAct.triggered.connect(self.remove)
        tlb.addAction(remAct)

        copyAct = QAction(QIcon('icons/copy.png'), 'Copy', self)
        copyAct.setShortcut('Ctrl+C')
        copyAct.triggered.connect(self.copy)
        tlb.addAction(copyAct)

        pasteAct = QAction(QIcon('icons/paste.png'), 'Paste', self)
        pasteAct.setShortcut('Ctrl+V')
        pasteAct.triggered.connect(self.paste)
        tlb.addAction(pasteAct)

        setAct = QAction(QIcon('icons/settings.png'), 'Settings', self)
        setAct.triggered.connect(self.settings)
        tlb.addAction(setAct)

        self.toolbar = self.addToolBar(Qt.LeftToolBarArea, tlb)

        addFile = QAction(QIcon('open.png'), 'Add', self)
        addFile.setStatusTip('Add frame')
        addFile.triggered.connect(self.add)

        saveFile = QAction(QIcon('save.png'), 'Save', self)
        saveFile.setStatusTip('Save GIF')
        saveFile.triggered.connect(self.save)

        sett = QAction(QIcon('settings.png'), 'Settings', self)
        sett.setStatusTip('Settings')
        sett.triggered.connect(self.settings)

        menubar = self.menuBar()
        self.setStyleSheet("""
                QMenuBar {
                    background-color: rgb(49,49,49);
                    color: rgb(255,255,255);
                    border: 1px solid #000;
                }

                QMenuBar::item {
                    background-color: rgb(49,49,49);
                    color: rgb(255,255,255);
                }

                QMenuBar::item::selected {
                    background-color: rgb(30,30,30);
                }

                QMenu {
                    background-color: rgb(49,49,49);
                    color: rgb(255,255,255);
                    border: 1px solid #000;           
                }

                QMenu::item::selected {
                    background-color: rgb(30,30,30);
                }
            """)

        fileMenu = menubar.addMenu('&Add')
        fileMenu.addAction(addFile)
        fileMenu = menubar.addMenu('&Save')
        fileMenu.addAction(saveFile)
        fileMenu = menubar.addMenu('&Settings')
        fileMenu.addAction(sett)

        self.setGeometry(300, 300, 790, 575)
        self.setWindowTitle('GIF-editor')
        self.setFixedSize(self.size())
        self.setWindowIcon(QtGui.QIcon('icon.png'))
        pal = self.palette()
        pal.setBrush(QtGui.QPalette.Normal, QtGui.QPalette.Background,
                     QtGui.QBrush(QtGui.QPixmap("bg.png")))
        pal.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Background,
                     QtGui.QBrush(QtGui.QPixmap("bg2.png")))
        self.setPalette(pal)
        # Ссылка на изображение: https://wallscloud.net/wallpaper/textures/Siniy-Fon/qLj7

        # работа со списком изображений
        self.lst = ListOfFrames(self)
        self.lst.move(150, 40)
        self.lst.resize(400, 450)
        self.lst.setIconSize(QSize(90, 90))

        pal = self.palette()

        self.buffer = []

        # Масштабирование
        self.slider = QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setValue(20)
        self.slider.move(650, 540)
        self.slider.valueChanged.connect(self.change_slider)

        # tabwidget
        _translate = QtCore.QCoreApplication.translate
        self.tabWidget = QTabWidget(self)
        self.tabWidget.setGeometry(QtCore.QRect(75, 25, 690, 510))
        self.tabWidget.setStyleSheet(" background-color: rgb(233, 233, 233) ")
        self.tabWidget.addTab(self.lst, "")

        self.res_display = GifPlayer('ex.gif')
        self.tabWidget.addTab(self.res_display, "")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.lst),
                                  _translate("Form", "Frames"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.res_display),
                                  _translate("Form", "Result"))

        self.show()
Example #30
0
    def hello(self):
        self.push1 = QPushButton("-> Download <-", self)
        self.push1.setGeometry(515, 300, 110, 30)
        self.push1.clicked.connect(self.down)
        self.push2 = QPushButton("-> MASK <-", self)
        self.push2.setGeometry(515, 350, 100, 30)
        # self.push2.clicked.connect(self.thug)
        self.push2.clicked.connect(self.filter)
        self.dod = Thuggmask(self)
        self.push3 = QPushButton("-> Chat Bot <-", self)
        self.push3.setGeometry(515, 400, 110, 30)
        self.push4 = QPushButton("-> Calculator <-", self)
        self.push4.setGeometry(515, 450, 110, 30)
        self.push4.clicked.connect(self.calc)
        self.dia2 = calcu(self)
        # self.push4.clicked.connect(self.but)

        self.push4 = QPushButton("-> SnapShot <-", self)
        self.push4.move(520, 500)
        self.push4.clicked.connect(self.capture)
        self.push5 = QPushButton("-> Camera <-", self)
        self.push5.move(520, 550)
        self.push5.clicked.connect(self.cam)

        self.push6 = QPushButton("-> Face and Eye detector <-", self)
        self.push6.setGeometry(470, 600, 200, 30)
        self.push6.clicked.connect(self.detect)
        self.push7 = QPushButton("Login", self)
        self.push7.move(900, 60)
        self.push7.clicked.connect(self.but)
        self.dialog = second(self)

        self.push8 = QPushButton("Sign Up", self)
        self.push8.move(800, 60)
        self.push8.clicked.connect(self.jojo)
        self.d1 = third(self)

        self.label4 = QLabel("ok", self)
        self.label4.setGeometry(10, 15, 100, 100)
        self.label4.linkActivated.connect(self.li)
        self.label4.setText('<a href="http://google.com/">Google</a>')

        self.label5 = QLabel("ok", self)
        self.label5.setGeometry(75, 15, 100, 100)
        self.label5.linkActivated.connect(self.li2)
        self.label5.setText('<a href="http://facebook.com/">Facebook</a>')

        self.label6 = QLabel("ok", self)
        self.label6.setGeometry(150, 15, 100, 100)
        self.label6.linkActivated.connect(self.li3)
        self.label6.setText('<a href="http://gmail.com/">Gmail</a>')

        self.label51 = QLabel("ok", self)
        self.label51.setGeometry(200, 15, 100, 100)
        self.label51.linkActivated.connect(self.li4)
        self.label51.setText('<a href="https://www.wikipedia.org/">Wiki</a>')

        self.labeel = QLabel("Contact Us : +91 8800338836", self)
        self.labeel.setGeometry(15, 620, 200, 20)

        self.label51 = QLabel("ok", self)
        self.label51.setGeometry(750, 580, 200, 100)
        self.label51.linkActivated.connect(self.li5)
        self.label51.setText(
            '<a href="https://www.gmail.com/">[email protected]</a>')
        self.la = QLabel("EMail-", self)
        self.la.move(693, 615)

        self.lk = QLabel(self)
        self.lk.setPixmap(QPixmap("vai.png"))
        self.lk.setGeometry(250, 50, 600, 200)

        self.lk1 = QLabel(self)
        self.lk1.setPixmap(QPixmap("robo.png"))
        self.lk1.setGeometry(50, 200, 250, 400)

        self.lk2 = QLabel(self)
        self.lk2.setPixmap(QPixmap("robo.png"))
        self.lk2.setGeometry(680, 200, 600, 400)

        # toolbar
        self.nav = QToolBar("Navigation")
        self.nav.setIconSize(QSize(50, 50))
        self.addToolBar(self.nav)
        self.url = QLineEdit(self)
        self.nav.addSeparator()
        self.nav.addWidget(self.url)

        label = QLabel("<h1>THE MASTER MIND</h1>", self)
        label.setGeometry(380, 180, 350, 150)
        self.setWindowIcon(QtGui.QIcon('save.png'))
        menu = self.menuBar()
        # self.lab=QLabel(self)
        # self.lab.setPixmap(QPixmap('images.jpeg'))
        # self.lab.setGeometry(300,80,600,100)
        file = menu.addMenu("File")
        # file1=file.addMenu("Open files")
        edit = menu.addMenu("Edit")
        View = menu.addMenu("View")
        nav = menu.addMenu("Navigate")
        tools = menu.addMenu("Tools")
        helpo = menu.addMenu("Help")
        add = QAction('Open Files', self)
        add.triggered.connect(self.oko)
        file.addAction(add)
        close = QAction("Close Window", self)
        close.triggered.connect(self.sure)
        file.addAction(close)

        self.setWindowTitle(self.tit)
        self.setGeometry(self.top, self.bot, self.wid, self.hei)
        self.show()