def _initUi(self):
        self.setWindowTitle('配置-股票历史日线数据源')

        # 控件
        label = QLabel('股票历史日线数据源')

        self._windCheckBox = QCheckBox('Wind')
        self._windCheckBox.clicked.connect(self._windCheckBoxClicked)

        self._tuShareCheckBox = QCheckBox('TuShare')
        self._tuShareCheckBox.clicked.connect(self._tuShareCheckBoxClicked)

        description = """默认使用Wind

只选Wind:更新交易日数据,股票代码表和股票历史日线数据到Wind对应的数据库

只选TuShare:更新交易日数据,股票代码表和股票历史日线数据到TuShare对应的数据库

选两个:更新交易日数据,股票代码表和股票历史日线数据到Wind对应的数据库,并同时做两个源的数据验证

交易日数据,股票代码表和股票历史日线数据的载入也是基于上面选择的数据库
        """
        textEdit = QTextEdit()
        textEdit.setPlainText(description)
        textEdit.setReadOnly(True)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._tradeDaysComboBox = QComboBox()
        descriptionTradeDays = "Wind有时交易日数据可能出错,所以选Wind时,总是跟TuShare做验证,由用户选择该如何做。"
        tradeDaysTextEdit = QTextEdit()
        tradeDaysTextEdit.setPlainText(descriptionTradeDays)
        tradeDaysTextEdit.setReadOnly(True)

        self._tuShareDaysIntervalLineEdit = QLineEdit(
        )  # TuShare日线数据每次下载间隔时间(秒)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(label, 0, 0)
        grid.addWidget(self._windCheckBox, 1, 0)
        grid.addWidget(self._tuShareCheckBox, 2, 0)
        grid.addWidget(textEdit, 3, 0)

        grid.addWidget(
            QLabel(
                "                                                                 "
            ), 4, 0)
        grid.addWidget(QLabel("交易日数据模式"), 5, 0)
        grid.addWidget(self._tradeDaysComboBox, 6, 0)
        grid.addWidget(tradeDaysTextEdit, 7, 0)

        grid.addWidget(
            QLabel(
                "                                                                 "
            ), 8, 0)
        grid.addWidget(QLabel("TuShare日线数据下载间隔时间(秒)"), 9, 0)
        grid.addWidget(self._tuShareDaysIntervalLineEdit, 10, 0)

        grid.addWidget(okPushButton, 0, 1)
        grid.addWidget(cancelPushButton, 1, 1)

        self.setLayout(grid)

        # set data source to UI
        if self._data.get('Wind'):
            self._windCheckBox.setChecked(True)

        if self._data.get('TuShare'):
            self._tuShareCheckBox.setChecked(True)

        # set according to days source checkbox
        self._tradeDaysComboBox.addItems(list(self.tradeDaysMode))
        self._enableTradeDaysComboBox()

        for k, v in self.tradeDaysMode.items():
            if v == self._tradeDaysModeData["tradeDaysMode"]:
                self._tradeDaysComboBox.setCurrentText(k)
                break

        # tushare days downloading interval
        self._tuShareDaysIntervalLineEdit.setText(
            str(self._tuShareDaysIntervalData['interval']))
Beispiel #2
0
    def request_safe_t_init_settings(self, wizard, method, device):
        vbox = QVBoxLayout()
        next_enabled = True
        label = QLabel(_("Enter a label to name your device:"))
        name = QLineEdit()
        hl = QHBoxLayout()
        hl.addWidget(label)
        hl.addWidget(name)
        hl.addStretch(1)
        vbox.addLayout(hl)

        def clean_text(widget):
            text = widget.toPlainText().strip()
            return ' '.join(text.split())

        if method in [TIM_NEW, TIM_RECOVER]:
            gb = QGroupBox()
            hbox1 = QHBoxLayout()
            gb.setLayout(hbox1)
            vbox.addWidget(gb)
            gb.setTitle(_("Select your seed length:"))
            bg = QButtonGroup()
            for i, count in enumerate([12, 18, 24]):
                rb = QRadioButton(gb)
                rb.setText(_("{:d} words").format(count))
                bg.addButton(rb)
                bg.setId(rb, i)
                hbox1.addWidget(rb)
                rb.setChecked(True)
            cb_pin = QCheckBox(_('Enable PIN protection'))
            cb_pin.setChecked(True)
        else:
            text = QTextEdit()
            text.setMaximumHeight(60)
            if method == TIM_MNEMONIC:
                msg = _("Enter your BIP39 mnemonic:")
            else:
                msg = _("Enter the master private key beginning with xprv:")

                def set_enabled():
                    from electrum_rutanio.bip32 import is_xprv
                    wizard.next_button.setEnabled(is_xprv(clean_text(text)))

                text.textChanged.connect(set_enabled)
                next_enabled = False

            vbox.addWidget(QLabel(msg))
            vbox.addWidget(text)
            pin = QLineEdit()
            pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,9}')))
            pin.setMaximumWidth(100)
            hbox_pin = QHBoxLayout()
            hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
            hbox_pin.addWidget(pin)
            hbox_pin.addStretch(1)

        if method in [TIM_NEW, TIM_RECOVER]:
            vbox.addWidget(WWLabel(RECOMMEND_PIN))
            vbox.addWidget(cb_pin)
        else:
            vbox.addLayout(hbox_pin)

        passphrase_msg = WWLabel(PASSPHRASE_HELP_SHORT)
        passphrase_warning = WWLabel(PASSPHRASE_NOT_PIN)
        passphrase_warning.setStyleSheet("color: red")
        cb_phrase = QCheckBox(_('Enable passphrases'))
        cb_phrase.setChecked(False)
        vbox.addWidget(passphrase_msg)
        vbox.addWidget(passphrase_warning)
        vbox.addWidget(cb_phrase)

        wizard.exec_layout(vbox, next_enabled=next_enabled)

        if method in [TIM_NEW, TIM_RECOVER]:
            item = bg.checkedId()
            pin = cb_pin.isChecked()
        else:
            item = ' '.join(str(clean_text(text)).split())
            pin = str(pin.text())

        return (item, name.text(), pin, cb_phrase.isChecked())
Beispiel #3
0
    def __init__(self, parent=None):
        super().__init__(parent)

        # Initialize word database
        self.word = Word('words2.txt')

        # Hangman display window
        self.hangmanWindow = QTextEdit()
        self.hangmanWindow.setReadOnly(True)
        self.hangmanWindow.setAlignment(Qt.AlignLeft)
        font = self.hangmanWindow.font()
        font.setFamily('Courier New')
        self.hangmanWindow.setFont(font)

        # Layout
        hangmanLayout = QGridLayout()
        hangmanLayout.addWidget(self.hangmanWindow, 0, 0)

        # Status Layout creation
        statusLayout = QGridLayout()

        # Display widget for current status
        self.currentWord = QLineEdit()
        self.currentWord.setReadOnly(True)
        self.currentWord.setAlignment(Qt.AlignCenter)
        font = self.currentWord.font()
        font.setPointSize(font.pointSize() + 8)
        self.currentWord.setFont(font)
        statusLayout.addWidget(self.currentWord, 0, 0, 1, 2)

        # Display widget for already used characters
        self.guessedChars = QLineEdit()
        self.guessedChars.setReadOnly(True)
        self.guessedChars.setAlignment(Qt.AlignLeft)
        self.guessedChars.setMaxLength(52)
        statusLayout.addWidget(self.guessedChars, 1, 0, 1, 2)

        # Display widget for message output
        self.message = QLineEdit()
        self.message.setReadOnly(True)
        self.message.setAlignment(Qt.AlignLeft)
        self.message.setMaxLength(52)
        statusLayout.addWidget(self.message, 2, 0, 1, 2)

        # Input widget for user selected characters
        self.charInput = QLineEdit()
        self.charInput.setMaxLength(1)
        statusLayout.addWidget(self.charInput, 3, 0)

        # Button for submitting a character
        self.guessButton = QToolButton()
        self.guessButton.setText('Guess!')
        self.guessButton.clicked.connect(self.guessClicked)
        statusLayout.addWidget(self.guessButton, 3, 1)

        # Button for a new game
        self.newGameButton = QToolButton()
        self.newGameButton.setText('New Game')
        self.newGameButton.clicked.connect(self.startGame)
        statusLayout.addWidget(self.newGameButton, 4, 0)

        # Layout placement
        mainLayout = QGridLayout()
        mainLayout.setSizeConstraint(QLayout.SetFixedSize)
        mainLayout.addLayout(hangmanLayout, 0, 0)
        mainLayout.addLayout(statusLayout, 0, 1)

        self.setLayout(mainLayout)

        self.setWindowTitle('Hangman Game')

        # Start a new game on application launch!
        self.startGame()
    def __buttons(self):
        """Establishment of the front-end and back-end buttons bar.

        Classically, the available buttons are:
                - Choose timestack file
                - Choose bathymetry file
                - Choose model file
                - Play/Pause
                - Exit

        """
        maxw = self.width() - self.__b_width + self.__b_shift  # Max width
        maxh = self.height() - self.__m_height - self.__b_height  # Max height
        right_b_width = self.__b_width - self.__b_shift  # Button width

        minw = int((self.width() - self.__b_width) / 3)
        height = self.height() - int(2 * self.height() / 3)
        width = int(2 * (self.width() - self.__b_width) / 3)

        # max height error
        self.text1 = QTextEdit(self)
        self.text1.setReadOnly(True)
        self.text1.textCursor().insertText('max height error : 0.00 m')
        self.text1.resize(right_b_width, self.__b_height)
        self.text1.move(
            minw + int(
                (width - 3 * self.__b_width) / 3) + int(self.__b_shift / 2),
            maxh - int((height - self.__b_height) / 2) + self.__m_height)

        # mean height error
        self.text2 = QTextEdit(self)
        self.text2.setReadOnly(True)
        self.text2.textCursor().insertText('mean height error : 0.00 m')
        self.text2.resize(right_b_width, self.__b_height)
        self.text2.move(
            minw + int((width - 3 * self.__b_width) * 2 / 3) + self.__b_width +
            int(self.__b_shift / 2), maxh - int(
                (height - self.__b_height) / 2) + self.__m_height)

        # correlation coefficient
        self.text3 = QTextEdit(self)
        self.text3.setReadOnly(True)
        self.text3.textCursor().insertText('correlation coef : 1.00000')
        self.text3.resize(right_b_width, self.__b_height)
        self.text3.move(
            minw + int((width - 3 * self.__b_width)) + 2 * self.__b_width +
            int(self.__b_shift / 2), maxh - int(
                (height - self.__b_height) / 2) + self.__m_height)

        # choose timestack file button
        self.choose_ts_btn = QPushButton('Choose timestack file', self)
        self.choose_ts_btn.setToolTip('Choose timestack file')
        self.choose_ts_btn.clicked.connect(self.browse_ts)
        self.choose_ts_btn.resize(right_b_width, self.__b_height)
        self.choose_ts_btn.move(maxw, self.menuBar().height())

        # choose expected bathymetry file button
        self.choose_b_btn = QPushButton('Choose expected bathymetry file',
                                        self)
        self.choose_b_btn.setToolTip('Choose expected bathymetry file')
        self.choose_b_btn.clicked.connect(self.browse_b)
        self.choose_b_btn.resize(right_b_width, self.__b_height)
        self.choose_b_btn.move(maxw, self.menuBar().height() + self.__b_height)

        # choose weight file button
        self.choose_m_btn = QPushButton('Choose model file', self)
        self.choose_m_btn.setToolTip('Choose model file')
        self.choose_m_btn.clicked.connect(self.browse_m)
        self.choose_m_btn.resize(right_b_width, self.__b_height)
        self.choose_m_btn.move(maxw,
                               self.menuBar().height() + 2 * self.__b_height)

        # play/pause wawe animation from the timestack
        self.pp_pbtn = QPushButton('Start/Stop', self)
        self.pp_pbtn.setToolTip('Start/Stop')
        self.pp_pbtn.setCheckable(True)
        self.pp_pbtn.toggle()
        self.pp_pbtn.clicked.connect(self.start_stop)
        self.pp_pbtn.resize(right_b_width, self.__b_height)
        self.pp_pbtn.move(maxw, self.menuBar().height() + 4 * self.__b_height)
        self.pp_pbtn.setShortcut('Space')

        # close button
        close_btn = QPushButton('Exit', self)
        close_btn.setToolTip('Exit Application')
        close_btn.clicked.connect(self.close)
        close_btn.resize(right_b_width, self.__b_height)
        close_btn.move(maxw, maxh)
Beispiel #5
0
    def createUI(self):
        """Function  which creates GUI"""

        self.MainVBox = QVBoxLayout()
        self.OptionsHBox = QHBoxLayout()
        self.DirHBox = QHBoxLayout()
        self.DataHBox = QHBoxLayout()
        self.MiscDataVBox = QVBoxLayout()
        self.TitleVBox = QVBoxLayout()
        self.FilesVBox = QVBoxLayout()
        self.ButtonsHBox = QHBoxLayout()

        self.DataHBox.addLayout(self.MiscDataVBox)
        self.DataHBox.addLayout(self.TitleVBox)
        self.DataHBox.addLayout(self.FilesVBox)

        self.MainVBox.addLayout(self.OptionsHBox)
        self.MainVBox.addLayout(self.DirHBox)
        self.MainVBox.addLayout(self.DataHBox)
        self.MainVBox.addLayout(self.ButtonsHBox)

        self.setLayout(self.MainVBox)

        self.Mp3ChoiceRdBtn = QRadioButton('Mp3')
        self.Mp3ChoiceRdBtn.setChecked(True)
        self.Mp3ChoiceRdBtn.clicked.connect(self.setMp3Format)
        self.Mp3ChoiceRdBtn.clicked.connect(self.readDir)
        self.FlacChoiceRdBtn = QRadioButton('Flac')
        self.FlacChoiceRdBtn.clicked.connect(self.setFlacFormat)
        self.FlacChoiceRdBtn.clicked.connect(self.readDir)
        self.ChangeFileNameChkBx = QCheckBox('Change filenames?')
        self.AddNumerationChkBx = QCheckBox('Add track numbers?')

        self.SelectDirBtn = QPushButton('Select Dir')
        self.SelectDirBtn.clicked.connect(self.selectDir)
        self.DirPathLnEd = QLineEdit()
        self.DirPathLnEd.setReadOnly(True)
        self.DirPathLnEd.textChanged.connect(self.readDir)

        self.OrigArtistChkBx = QCheckBox('Original artist')
        self.OrigArtistChkBx.clicked.connect(
            lambda: self.OrigArtistLnEd.setEnabled(self.OrigArtistChkBx.
                                                   isChecked()))
        self.OrigArtistLnEd = QLineEdit()
        self.OrigArtistLnEd.setEnabled(False)
        self.PerfArtistChkBx = QCheckBox('Performing artist')
        self.PerfArtistChkBx.clicked.connect(
            lambda: self.PerfArtistLnEd.setEnabled(self.PerfArtistChkBx.
                                                   isChecked()))
        self.PerfArtistLnEd = QLineEdit()
        self.PerfArtistLnEd.setEnabled(False)
        self.AlbumTitleChkBx = QCheckBox('Album title')
        self.AlbumTitleChkBx.clicked.connect(
            lambda: self.AlbumTitleLnEd.setEnabled(self.AlbumTitleChkBx.
                                                   isChecked()))
        self.AlbumTitleLnEd = QLineEdit()
        self.AlbumTitleLnEd.setEnabled(False)
        self.YearChkBx = QCheckBox('Year')
        self.YearChkBx.clicked.connect(
            lambda: self.YearLnEd.setEnabled(self.YearChkBx.isChecked()))
        self.YearLnEd = QLineEdit()
        self.YearLnEd.setEnabled(False)
        self.GenreChkBx = QCheckBox('Genre')
        self.GenreChkBx.clicked.connect(
            lambda: self.GenreLnEd.setEnabled(self.GenreChkBx.isChecked()))
        self.GenreLnEd = QLineEdit()
        self.GenreLnEd.setEnabled(False)

        self.TrackTitleChkBx = QCheckBox('Track titles')
        self.TrackTitleChkBx.clicked.connect(
            lambda: self.TrackTitleTxtEdt.setEnabled(self.TrackTitleChkBx.
                                                     isChecked()))
        self.TrackTitleTxtEdt = QTextEdit()
        self.TrackTitleTxtEdt.setEnabled(False)
        self.TrackTitleTxtEdt.setStyleSheet('font: 10.5pt;')
        self.TrackLstLbl = QLabel('Track list')
        self.TrackTitleLstBx = QListWidget()
        self.TrackTitleLstBx.setDragDropMode(QAbstractItemView.InternalMove)

        self.WorkBtn = QPushButton('Do your job')
        self.WorkBtn.clicked.connect(self.changeTags)
        self.ExitBtn = QPushButton('Exit')
        self.ExitBtn.clicked.connect(self.close)

        self.OptionsHBox.addWidget(self.Mp3ChoiceRdBtn)
        self.OptionsHBox.addWidget(self.FlacChoiceRdBtn)
        self.OptionsHBox.addWidget(self.ChangeFileNameChkBx)
        self.OptionsHBox.addWidget(self.AddNumerationChkBx)

        self.DirHBox.addWidget(self.SelectDirBtn)
        self.DirHBox.addWidget(self.DirPathLnEd)

        self.MiscDataVBox.addWidget(self.OrigArtistChkBx)
        self.MiscDataVBox.addWidget(self.OrigArtistLnEd)
        self.MiscDataVBox.addWidget(self.PerfArtistChkBx)
        self.MiscDataVBox.addWidget(self.PerfArtistLnEd)
        self.MiscDataVBox.addWidget(self.AlbumTitleChkBx)
        self.MiscDataVBox.addWidget(self.AlbumTitleLnEd)
        self.MiscDataVBox.addWidget(self.YearChkBx)
        self.MiscDataVBox.addWidget(self.YearLnEd)
        self.MiscDataVBox.addWidget(self.GenreChkBx)
        self.MiscDataVBox.addWidget(self.GenreLnEd)

        self.TitleVBox.addWidget(self.TrackTitleChkBx)
        self.TitleVBox.addWidget(self.TrackTitleTxtEdt)

        self.FilesVBox.addWidget(self.TrackLstLbl)
        self.FilesVBox.addWidget(self.TrackTitleLstBx)

        self.ButtonsHBox.addWidget(self.ExitBtn)
        self.ButtonsHBox.addWidget(self.WorkBtn)

        self.ErrorDialog = QMessageBox()
        self.ErrorDialog.setText('Number of titles must match number of files')

        self.setGeometry(300, 300, 800, 600)
        self.setWindowTitle('Tag renamer')

        self.show()
Beispiel #6
0
    def initUI(self):
        self.setWindowTitle(self.title)

        ### UI
        self.vbox = QVBoxLayout(self)

        ## Left screen
        self.hbox = QHBoxLayout()

        self.textBox = QTextEdit()

        self.hbox.addWidget(self.textBox)

        ## Right screen
        self.vbox2 = QVBoxLayout()

        fileHbox = QHBoxLayout()
        fpathLabel = QLabel()
        fpathLabel.setText("File:")
        self.filePath = QLineEdit("input.mp3", self)
        fileHbox.addWidget(fpathLabel)
        fileHbox.addWidget(self.filePath)

        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        artistHbox = QHBoxLayout()
        artistLabel = QLabel()
        artistLabel.setText("Artist:")
        self.artist = QLineEdit("", self)
        artistHbox.addWidget(artistLabel)
        artistHbox.addWidget(self.artist)

        albumHbox = QHBoxLayout()
        albumLabel = QLabel()
        albumLabel.setText("Album:")
        self.album = QLineEdit("", self)
        albumHbox.addWidget(albumLabel)
        albumHbox.addWidget(self.album)

        button = QPushButton('Start', self)
        button.clicked.connect(self.start)

        button2 = QPushButton('Rescan for mp3', self)
        button2.clicked.connect(self.scan_mp3)

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

        self.vbox2.addLayout(fileHbox)
        self.vbox2.addWidget(line)
        self.vbox2.addLayout(artistHbox)
        self.vbox2.addLayout(albumHbox)
        self.vbox2.addWidget(button)
        self.vbox2.addWidget(button2)
        self.vbox2.addWidget(self.logWindow)

        self.hbox.addLayout(self.vbox2)

        ## Bottom screen
        self.progress = QProgressBar()
        self.progress.setValue(0)

        self.vbox.addLayout(self.hbox)
        self.vbox.addWidget(self.progress)
        self.show()
Beispiel #7
0
    def InitUserInterface(self):
        self.color_red = QPalette()
        self.color_red.setColor(QPalette.WindowText, Qt.red)
        self.color_green = QPalette()
        self.color_green.setColor(QPalette.WindowText, QColor(0, 128, 0))
        self.color_black = QPalette()
        self.color_black.setColor(QPalette.WindowText, Qt.black)

        self.list_exchange = [
            define.DEF_EXCHANGE_STOCK_SH, define.DEF_EXCHANGE_STOCK_SZ
        ]
        self.list_entr_type = [
            define.DEF_PRICE_TYPE_STOCK_LIMIT,
            define.DEF_PRICE_TYPE_STOCK_MARKET
        ]

        self.setWindowTitle("手动交易-股票-APE %s" % self.version_info)
        self.resize(380, 300)
        self.setFont(QFont("SimSun", 9))

        self.label_exchange = QLabel("交易市场")
        self.label_exchange.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_symbol = QLabel("证券代码")
        self.label_symbol.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_name = QLabel("证券名称")
        self.label_name.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_entr_type = QLabel("委托方式")
        self.label_entr_type.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_can_use = QLabel("可用金额")
        self.label_can_use.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_can_sell = QLabel("可用数量")
        self.label_can_sell.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_price = QLabel("委托价格")
        self.label_price.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_volume = QLabel("委托数量")
        self.label_volume.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)

        self.label_can_use_unit = QLabel("元")
        self.label_can_use_unit.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_can_sell_unit = QLabel("股")
        self.label_can_sell_unit.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_price_unit = QLabel("元")
        self.label_price_unit.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.label_volume_unit = QLabel("股")
        self.label_volume_unit.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)

        self.combo_exchange = QComboBox()
        self.combo_exchange.addItems(self.list_exchange)
        self.line_edit_symbol = QLineEdit("")
        self.line_edit_symbol.setStyleSheet("color:red")  # 初始红色
        self.line_edit_symbol.setFont(QFont("SimSun", 9))
        self.line_edit_name = QLineEdit("")
        self.line_edit_name.setReadOnly(True)
        self.line_edit_name.setFont(QFont("SimSun", 9))
        self.line_edit_name.setStyleSheet(
            "background-color:rgb(240,240,240);color:red")  # 初始红色
        self.line_edit_name.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.combo_entr_type = QComboBox()
        self.combo_entr_type.addItems(self.list_entr_type)
        self.line_edit_can_use = QLineEdit("0.00")
        self.line_edit_can_use.setReadOnly(True)
        self.line_edit_can_use.setStyleSheet(
            "background-color:rgb(240,240,240)")
        self.line_edit_can_use.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.line_edit_can_sell = QLineEdit("0")
        self.line_edit_can_sell.setReadOnly(True)
        self.line_edit_can_sell.setStyleSheet(
            "background-color:rgb(240,240,240)")
        self.line_edit_can_sell.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.spin_price = QDoubleSpinBox()
        self.spin_price.setDecimals(4)
        self.spin_price.setMinimum(0)
        self.spin_price.setMaximum(100000)
        self.spin_price.setStyleSheet("color:red")  # 初始红色
        self.spin_price.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.spin_volume = QSpinBox()
        self.spin_volume.setMinimum(0)
        self.spin_volume.setMaximum(1000000)
        self.spin_volume.setSingleStep(100)
        self.spin_volume.setStyleSheet("color:red")  # 初始红色
        self.spin_volume.setAlignment(Qt.AlignRight | Qt.AlignVCenter)

        self.grid_layout_essential = QGridLayout()
        self.grid_layout_essential.setContentsMargins(-1, -1, -1, -1)
        self.grid_layout_essential.addWidget(self.label_exchange, 0, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_symbol, 1, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_name, 2, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_entr_type, 3, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_can_use, 4, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_can_sell, 5, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_price, 6, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.label_volume, 7, 0, 1, 1)
        self.grid_layout_essential.addWidget(self.combo_exchange, 0, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.line_edit_symbol, 1, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.line_edit_name, 2, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.combo_entr_type, 3, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.line_edit_can_use, 4, 1, 1,
                                             1)
        self.grid_layout_essential.addWidget(self.line_edit_can_sell, 5, 1, 1,
                                             1)
        self.grid_layout_essential.addWidget(self.spin_price, 6, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.spin_volume, 7, 1, 1, 1)
        self.grid_layout_essential.addWidget(self.label_can_use_unit, 4, 2, 1,
                                             1)
        self.grid_layout_essential.addWidget(self.label_can_sell_unit, 5, 2, 1,
                                             1)
        self.grid_layout_essential.addWidget(self.label_price_unit, 6, 2, 1, 1)
        self.grid_layout_essential.addWidget(self.label_volume_unit, 7, 2, 1,
                                             1)

        self.radio_button_buy = QRadioButton("买 入")
        self.radio_button_buy.setStyleSheet("color:red")
        self.radio_button_buy.setFont(QFont("SimSun", 9))
        self.radio_button_buy.setChecked(True)
        self.radio_button_buy.setFixedWidth(70)
        self.radio_button_sell = QRadioButton("卖 出")
        self.radio_button_sell.setStyleSheet("color:green")
        self.radio_button_sell.setFont(QFont("SimSun", 9))
        self.radio_button_sell.setFixedWidth(70)
        self.button_place_order = QPushButton("下 单")
        self.button_place_order.setFont(QFont("SimSun", 9))
        self.button_place_order.setStyleSheet("font:bold;color:red")  # 初始红色
        self.button_place_order.setFixedWidth(70)

        self.label_order_id = QLabel("撤单委托编号")
        self.label_order_id.setFixedWidth(70)
        self.label_order_id.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.line_edit_order_id = QLineEdit("")
        self.line_edit_order_id.setFixedWidth(70)
        self.line_edit_order_id.setStyleSheet("color:blue")
        self.line_edit_order_id.setFont(QFont("SimSun", 9))
        self.button_cancel_order = QPushButton("撤 单")
        self.button_cancel_order.setFont(QFont("SimSun", 9))
        self.button_cancel_order.setStyleSheet("font:bold;color:blue")
        self.button_cancel_order.setFixedWidth(70)

        self.h_box_layout_order_buttons = QHBoxLayout()
        self.h_box_layout_order_buttons.setContentsMargins(-1, -1, -1, -1)
        self.h_box_layout_order_buttons.addStretch(1)
        self.h_box_layout_order_buttons.addWidget(self.radio_button_buy)
        self.h_box_layout_order_buttons.addStretch(1)
        self.h_box_layout_order_buttons.addWidget(self.radio_button_sell)
        self.h_box_layout_order_buttons.addStretch(1)
        self.h_box_layout_order_buttons.addWidget(self.button_place_order)
        self.h_box_layout_order_buttons.addStretch(1)

        self.h_box_layout_cancel_order = QHBoxLayout()
        self.h_box_layout_cancel_order.setContentsMargins(-1, -1, -1, -1)  #
        self.h_box_layout_cancel_order.addStretch(1)
        self.h_box_layout_cancel_order.addWidget(self.label_order_id)
        self.h_box_layout_cancel_order.addStretch(1)
        self.h_box_layout_cancel_order.addWidget(self.line_edit_order_id)
        self.h_box_layout_cancel_order.addStretch(1)
        self.h_box_layout_cancel_order.addWidget(self.button_cancel_order)
        self.h_box_layout_cancel_order.addStretch(1)

        self.v_box_layout_order = QVBoxLayout()
        self.v_box_layout_order.setContentsMargins(-1, -1, -1, -1)
        self.v_box_layout_order.addLayout(self.grid_layout_essential)
        self.v_box_layout_order.addLayout(self.h_box_layout_order_buttons)
        self.v_box_layout_order.addLayout(self.h_box_layout_cancel_order)

        self.label_high_limit = QLabel("涨停")
        self.label_ask_5 = QLabel("卖五")
        self.label_ask_4 = QLabel("卖四")
        self.label_ask_3 = QLabel("卖三")
        self.label_ask_2 = QLabel("卖二")
        self.label_ask_1 = QLabel("卖一")
        self.label_last = QLabel("最新")
        self.label_last.setMinimumWidth(35)
        self.label_bid_1 = QLabel("买一")
        self.label_bid_2 = QLabel("买二")
        self.label_bid_3 = QLabel("买三")
        self.label_bid_4 = QLabel("买四")
        self.label_bid_5 = QLabel("买五")
        self.label_low_limit = QLabel("跌停")

        self.label_high_limit.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_last.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_low_limit.setAlignment(Qt.AlignRight | Qt.AlignVCenter)

        self.label_high_limit_price = QLabel("0.00")
        self.label_high_limit_price.setMinimumWidth(60)
        self.label_ask_price_5 = QLabel("0.00")
        self.label_ask_price_4 = QLabel("0.00")
        self.label_ask_price_3 = QLabel("0.00")
        self.label_ask_price_2 = QLabel("0.00")
        self.label_ask_price_1 = QLabel("0.00")
        self.label_ask_volume_5 = QLabel("0")
        self.label_ask_volume_4 = QLabel("0")
        self.label_ask_volume_3 = QLabel("0")
        self.label_ask_volume_2 = QLabel("0")
        self.label_ask_volume_1 = QLabel("0")
        self.label_last_price = QLabel("0.00")
        self.label_last_price.setMinimumWidth(60)
        self.label_last_up_down = QLabel("0.00%")
        self.label_last_up_down.setMinimumWidth(60)
        self.label_bid_price_1 = QLabel("0.00")
        self.label_bid_price_2 = QLabel("0.00")
        self.label_bid_price_3 = QLabel("0.00")
        self.label_bid_price_4 = QLabel("0.00")
        self.label_bid_price_5 = QLabel("0.00")
        self.label_bid_volume_1 = QLabel("0")
        self.label_bid_volume_2 = QLabel("0")
        self.label_bid_volume_3 = QLabel("0")
        self.label_bid_volume_4 = QLabel("0")
        self.label_bid_volume_5 = QLabel("0")
        self.label_low_limit_price = QLabel("0.00")
        self.label_low_limit_price.setMinimumWidth(60)

        self.label_high_limit_price.setPalette(self.color_red)
        self.label_ask_price_5.setPalette(self.color_green)
        self.label_ask_price_4.setPalette(self.color_green)
        self.label_ask_price_3.setPalette(self.color_green)
        self.label_ask_price_2.setPalette(self.color_green)
        self.label_ask_price_1.setPalette(self.color_green)
        self.label_ask_volume_5.setPalette(self.color_green)
        self.label_ask_volume_4.setPalette(self.color_green)
        self.label_ask_volume_3.setPalette(self.color_green)
        self.label_ask_volume_2.setPalette(self.color_green)
        self.label_ask_volume_1.setPalette(self.color_green)
        self.label_last_price.setPalette(self.color_black)
        self.label_last_up_down.setPalette(self.color_black)
        self.label_bid_price_1.setPalette(self.color_red)
        self.label_bid_price_2.setPalette(self.color_red)
        self.label_bid_price_3.setPalette(self.color_red)
        self.label_bid_price_4.setPalette(self.color_red)
        self.label_bid_price_5.setPalette(self.color_red)
        self.label_bid_volume_1.setPalette(self.color_red)
        self.label_bid_volume_2.setPalette(self.color_red)
        self.label_bid_volume_3.setPalette(self.color_red)
        self.label_bid_volume_4.setPalette(self.color_red)
        self.label_bid_volume_5.setPalette(self.color_red)
        self.label_low_limit_price.setPalette(self.color_green)

        self.label_high_limit_price.setAlignment(Qt.AlignRight
                                                 | Qt.AlignVCenter)
        self.label_ask_price_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_price_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_price_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_price_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_price_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_volume_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_volume_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_volume_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_volume_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_ask_volume_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_last_price.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_last_up_down.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_price_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_price_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_price_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_price_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_price_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_volume_1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_volume_2.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_volume_3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_volume_4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_bid_volume_5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label_low_limit_price.setAlignment(Qt.AlignRight
                                                | Qt.AlignVCenter)

        self.grid_layout_quote = QGridLayout()
        self.grid_layout_quote.addWidget(self.label_high_limit, 0, 0)  #
        self.grid_layout_quote.addWidget(self.label_ask_5, 1, 0)
        self.grid_layout_quote.addWidget(self.label_ask_4, 2, 0)
        self.grid_layout_quote.addWidget(self.label_ask_3, 3, 0)
        self.grid_layout_quote.addWidget(self.label_ask_2, 4, 0)
        self.grid_layout_quote.addWidget(self.label_ask_1, 5, 0)
        self.grid_layout_quote.addWidget(self.label_last, 6, 0)  #
        self.grid_layout_quote.addWidget(self.label_bid_1, 7, 0)
        self.grid_layout_quote.addWidget(self.label_bid_2, 8, 0)
        self.grid_layout_quote.addWidget(self.label_bid_3, 9, 0)
        self.grid_layout_quote.addWidget(self.label_bid_4, 10, 0)
        self.grid_layout_quote.addWidget(self.label_bid_5, 11, 0)
        self.grid_layout_quote.addWidget(self.label_low_limit, 12, 0)  #
        self.grid_layout_quote.addWidget(self.label_high_limit_price, 0, 1)  #
        self.grid_layout_quote.addWidget(self.label_ask_price_5, 1, 1)
        self.grid_layout_quote.addWidget(self.label_ask_price_4, 2, 1)
        self.grid_layout_quote.addWidget(self.label_ask_price_3, 3, 1)
        self.grid_layout_quote.addWidget(self.label_ask_price_2, 4, 1)
        self.grid_layout_quote.addWidget(self.label_ask_price_1, 5, 1)
        self.grid_layout_quote.addWidget(self.label_last_price, 6, 1)  #
        self.grid_layout_quote.addWidget(self.label_bid_price_1, 7, 1)
        self.grid_layout_quote.addWidget(self.label_bid_price_2, 8, 1)
        self.grid_layout_quote.addWidget(self.label_bid_price_3, 9, 1)
        self.grid_layout_quote.addWidget(self.label_bid_price_4, 10, 1)
        self.grid_layout_quote.addWidget(self.label_bid_price_5, 11, 1)
        self.grid_layout_quote.addWidget(self.label_low_limit_price, 12, 1)  #
        self.grid_layout_quote.addWidget(self.label_ask_volume_5, 1, 2)
        self.grid_layout_quote.addWidget(self.label_ask_volume_4, 2, 2)
        self.grid_layout_quote.addWidget(self.label_ask_volume_3, 3, 2)
        self.grid_layout_quote.addWidget(self.label_ask_volume_2, 4, 2)
        self.grid_layout_quote.addWidget(self.label_ask_volume_1, 5, 2)
        self.grid_layout_quote.addWidget(self.label_last_up_down, 6, 2)  #
        self.grid_layout_quote.addWidget(self.label_bid_volume_1, 7, 2)
        self.grid_layout_quote.addWidget(self.label_bid_volume_2, 8, 2)
        self.grid_layout_quote.addWidget(self.label_bid_volume_3, 9, 2)
        self.grid_layout_quote.addWidget(self.label_bid_volume_4, 10, 2)
        self.grid_layout_quote.addWidget(self.label_bid_volume_5, 11, 2)

        self.main_text_edit_bottom = QTextEdit(self)
        self.main_text_edit_bottom.setText("")
        self.main_text_edit_bottom.setFont(QFont("SimSun", 9))

        self.h_box_layout_1 = QHBoxLayout()
        self.h_box_layout_1.addLayout(self.v_box_layout_order)
        self.h_box_layout_1.addLayout(self.grid_layout_quote)

        self.h_box_layout_2 = QHBoxLayout()
        self.h_box_layout_2.setContentsMargins(-1, -1, -1, -1)
        self.h_box_layout_2.addWidget(self.main_text_edit_bottom)

        self.v_box_layout_mian = QVBoxLayout()
        self.v_box_layout_mian.setContentsMargins(-1, -1, -1, -1)
        self.v_box_layout_mian.addLayout(self.h_box_layout_1)
        self.v_box_layout_mian.addLayout(self.h_box_layout_2)

        self.setLayout(self.v_box_layout_mian)

        self.combo_exchange.activated[str].connect(self.OnChangeExchange)
        self.line_edit_symbol.editingFinished.connect(self.OnChangeSymbol)
        self.radio_button_buy.clicked.connect(self.OnChangeBuySell)
        self.radio_button_sell.clicked.connect(self.OnChangeBuySell)
        self.button_place_order.clicked.connect(self.OnButtonPlaceOrder)
        self.button_cancel_order.clicked.connect(self.OnButtonCancelOrder)
Beispiel #8
0
    def edit(self):

        logging.debug('edit() called ExecOp')
        mod_path = os.path.dirname(Pythonic.__file__)

        self.opEditLayout = QVBoxLayout()

        self.op_edit = ElementEditor(self)
        self.op_edit.setWindowTitle(QC.translate('', 'Edit Basic Operation'))

        self.head_info = QLabel()
        self.head_info.setText(
            QC.translate('', 'Enter your Python 3 code below:'))

        self.help_text = QLabel()
        self.help_text.setText(
            QC.translate('', 'Process your own Python 3 code.'))

        self.cmd_line_txt_1 = QLabel()
        self.cmd_line_txt_1.setText(QC.translate('', 'Use custom editor?'))
        self.cmd_line_txt_2 = QLabel()
        self.cmd_line_txt_2.setText(
            QC.translate('',
                         'Use keyword $FILENAME to specify the code file.'))
        self.cmd_line_txt_3 = QLabel()
        self.cmd_line_txt_3.setText(
            QC.translate('', 'Re-open to activate settings.'))

        self.custom_editor_checkbox = QCheckBox()
        self.custom_editor_cmd = QLineEdit()
        self.custom_editor_line = QWidget()
        self.custom_editor_line_layout = QHBoxLayout(self.custom_editor_line)
        self.custom_editor_line_layout.addWidget(self.cmd_line_txt_1)
        self.custom_editor_line_layout.addWidget(self.custom_editor_checkbox)

        self.op_image = QLabel()
        self.op_image.setPixmap(
            QPixmap(os.path.join(mod_path, self.pixmap_path)))

        self.code_input = QTextEdit()
        self.code_input.setMinimumHeight(250)

        # hier logging option einfügen
        self.log_line = QWidget()
        self.ask_for_logging = QLabel()
        self.ask_for_logging.setText(QC.translate('', 'Log output?'))
        self.log_checkbox = QCheckBox()
        self.log_line_layout = QHBoxLayout(self.log_line)
        self.log_line_layout.addWidget(self.ask_for_logging)
        self.log_line_layout.addWidget(self.log_checkbox)
        self.log_line_layout.addStretch(1)

        self.loadLastConfig()

        self.confirm_button = QPushButton(QC.translate('', 'Ok'))

        self.spacer = QSpacerItem(0, 30)
        self.picto_spacer = QSpacerItem(0, 40)

        self.picto_widget = QWidget()
        self.pictogram_layout = QGridLayout(self.picto_widget)
        self.pictogram_layout.addWidget(self.op_image, 0, 0)
        self.pictogram_layout.addItem(self.picto_spacer, 0, 1)
        self.pictogram_layout.addWidget(self.help_text, 0, 2)

        self.opEditLayout.addWidget(self.head_info)
        self.opEditLayout.addWidget(self.code_input)
        self.opEditLayout.addWidget(self.custom_editor_line)
        self.opEditLayout.addWidget(self.custom_editor_cmd)
        self.opEditLayout.addWidget(self.cmd_line_txt_2)
        self.opEditLayout.addWidget(self.cmd_line_txt_3)
        self.opEditLayout.addWidget(self.log_line)
        self.opEditLayout.addSpacerItem(self.spacer)
        self.opEditLayout.addWidget(self.picto_widget)
        self.opEditLayout.addWidget(self.confirm_button)
        self.op_edit.setLayout(self.opEditLayout)

        # signals and slots
        self.custom_editor_checkbox.stateChanged.connect(
            self.toggle_custom_editor)
        self.confirm_button.clicked.connect(self.op_edit.closeEvent)
        self.op_edit.window_closed.connect(self.edit_done)

        self.op_edit.setMinimumHeight(650)
        self.op_edit.show()
Beispiel #9
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()
Beispiel #10
0
    def __init__(self, files, tab, delete, parent, test=False):
        """
        Keyword arguments:
        files  -- list with dicts containing file names
        tab -- instanseof AudioVideoTab, ImageTab or DocumentTab
               indicating currently active tab
        delete -- boolean that shows if files must removed after conversion
        parent -- parent widget

        files:
        Each dict have only one key and one corresponding value.
        Key is a file to be converted and it's value is the name of the new
        file that will be converted.

        Example list:
        [{"/foo/bar.png" : "/foo/bar.bmp"}, {"/f/bar2.png" : "/f/bar2.bmp"}]
        """
        super(Progress, self).__init__(parent)
        self.parent = parent

        self.files = files
        self.num_total_files = len(self.files)
        self.tab = tab
        self.delete = delete
        if not test:
            self._type = tab.name
        self.ok = 0
        self.error = 0
        self.running = True

        self.nowQL = QLabel(self.tr('In progress: '))
        self.nowQPBar = QProgressBar()
        self.nowQPBar.setValue(0)
        self.shutdownQCB = QCheckBox(self.tr('Shutdown after conversion'))
        self.cancelQPB = QPushButton(self.tr('Cancel'))

        detailsQPB = QCommandLinkButton(self.tr('Details'))
        detailsQPB.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        detailsQPB.setCheckable(True)
        detailsQPB.setMaximumWidth(113)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        self.outputQTE = QTextEdit()
        self.outputQTE.setReadOnly(True)
        self.frame = QFrame()
        frame_layout = utils.add_to_layout('h', self.outputQTE)
        self.frame.setLayout(frame_layout)
        self.frame.hide()

        hlayout1 = utils.add_to_layout('h', None, self.nowQL, None)
        hlayout2 = utils.add_to_layout('h', detailsQPB, line)
        hlayout3 = utils.add_to_layout('h', self.frame)
        hlayout4 = utils.add_to_layout('h', None, self.cancelQPB)
        vlayout = utils.add_to_layout(
                'v', hlayout1, self.nowQPBar, hlayout2, hlayout3,
                self.shutdownQCB, hlayout4
                )
        self.setLayout(vlayout)

        detailsQPB.toggled.connect(self.resize_dialog)
        detailsQPB.toggled.connect(self.frame.setVisible)
        self.cancelQPB.clicked.connect(self.reject)
        self.file_converted_signal.connect(self.next_file)
        self.update_text_edit_signal.connect(self.update_text_edit)

        self.resize(484, 190)
        self.setWindowTitle('FF Multi Converter - ' + self.tr('Conversion'))

        if not test:
            self.get_data() # should be first and not in QTimer.singleShot()
            QTimer.singleShot(0, self.manage_conversions)
Beispiel #11
0
      def initUI(self):
            self.qbtn3 = QPushButton('导出', self)
            # 按钮功能
            self.qbtn3.clicked.connect(self.write_out_msg) #  需要导出的sql



            zh_in = QLabel('输入账号')
            self.zh_inEdit = QLineEdit()
            self.zh_inEdit.setPlaceholderText('默认 lzwul')

            mm_in = QLabel('输入密码')
            self.mm_inEdit = QLineEdit()
            self.mm_inEdit.setPlaceholderText('默认 wul.vtc.142')

            delimiter_in = QLabel('文件分隔符')
            self.delimiter_inEdit = QLineEdit()
            self.delimiter_inEdit.setPlaceholderText('默认 ,')
            
            out_in = QLabel('输出文件路径')
            self.out_inEdit = QLineEdit()
            self.out_inEdit.setPlaceholderText("如 C:\\Users\\dell\\Desktop\\out.csv (默认导出exe所在目录下out.csv中)")

            need_sql3 = QLabel('输入SQL')
            self.need_sql3Edit = QTextEdit()
            self.need_sql3Edit.setPlainText('输入sql')

            out_msg = QLabel('导出情况')
            self.out_msgEdit = QTextEdit()
            _n = "\n" * 9
            self.out_msgEdit.setPlainText('输入到csv的导出情况{}Version: 1.0.0.2019.09\nContact: [email protected]'.format(_n))

            # 窗口布局 
            grid = QGridLayout()
            grid.setSpacing(16)
            grid = QGridLayout()
            grid.setSpacing(16)
            grid.addWidget(zh_in, 1, 0)
            grid.addWidget(self.zh_inEdit, 1, 1, 1, 1)
            grid.addWidget(mm_in, 1, 2)
            grid.addWidget(self.mm_inEdit, 1, 3, 1, 1)
            grid.addWidget(delimiter_in, 1, 4)
            grid.addWidget(self.delimiter_inEdit, 1, 5, 1, 1)
            
            grid.addWidget(out_in, 2, 0)
            grid.addWidget(self.out_inEdit, 2, 1, 1, 5)

            grid.addWidget(need_sql3, 3, 0)
            need_sql3.setAlignment(Qt.AlignTop)
            grid.addWidget(self.need_sql3Edit, 3, 1, 2, 5)

            grid.addWidget(out_msg, 5, 0)
            out_msg.setAlignment(Qt.AlignTop)
            grid.addWidget(self.out_msgEdit, 5, 1, 2, 5)

            grid.addWidget(self.qbtn3, 6, 0)

            self.setLayout(grid)
            
            self.set_decoration(self.need_sql3Edit)
            self.set_decoration(self.out_msgEdit)
            self.set_gui()
Beispiel #12
0
    def __init__(self, parent=None):
        """Class initializer."""
        super(AboutVMDialog, self).__init__(parent)
        self.setWindowTitle(self.tr('About'))
        self.resize(500, 404)
        self.horizontal_layout_3 = QHBoxLayout(self)
        self.vertical_layout_4 = QVBoxLayout()
        self.horizontal_layout_2 = QHBoxLayout()
        self.label = QLabel(self)
        self.label.setMinimumSize(QSize(64, 64))
        self.label.setMaximumSize(QSize(64, 64))
        self.label.setText("")
        self.label.setPixmap(QPixmap(':/logo/videomorph.png'))
        self.label.setScaledContents(True)
        self.horizontal_layout_2.addWidget(self.label)
        self.label_2 = QLabel("<p align=\"center\"><span style=\" "
                              "font-size:20pt; font-weight:600;\">{n}</span>"
                              "</p><p align=\"center\"><span style=\" "
                              "font-size:9pt; font-weight:600;\">version {v}"
                              "</span></p>".format(n=APP_NAME, v=VERSION))
        self.label_2.setMinimumSize(QSize(0, 64))
        self.label_2.setMaximumSize(QSize(16777215, 64))
        self.horizontal_layout_2.addWidget(self.label_2)
        self.vertical_layout_4.addLayout(self.horizontal_layout_2)
        self.tab_widget = QTabWidget(self)
        self.tab = QWidget()
        self.vertical_layout_2 = QVBoxLayout(self.tab)
        self.text_edit_3 = QTextEdit(self.tab)
        self.text_edit_3.setReadOnly(True)
        self.vertical_layout_2.addWidget(self.text_edit_3)
        self.tab_widget.addTab(self.tab, "")
        self.tab_2 = QWidget()
        self.vertical_layout_3 = QVBoxLayout(self.tab_2)
        self.text_edit_2 = QTextEdit(self.tab_2)
        self.text_edit_2.setReadOnly(True)
        self.vertical_layout_3.addWidget(self.text_edit_2)
        self.tab_widget.addTab(self.tab_2, "")
        self.tab_3 = QWidget()
        self.vertical_layout = QVBoxLayout(self.tab_3)
        self.plain_text_edit = QPlainTextEdit(self.tab_3)
        self.plain_text_edit.setReadOnly(True)
        self.vertical_layout.addWidget(self.plain_text_edit)
        self.tab_widget.addTab(self.tab_3, "")
        self.vertical_layout_4.addWidget(self.tab_widget)
        self.horizontal_layout = QHBoxLayout()
        spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontal_layout.addItem(spacer_item)
        self.button_box = QDialogButtonBox(self)
        self.button_box.setOrientation(Qt.Horizontal)
        self.button_box.setStandardButtons(QDialogButtonBox.Ok)
        self.button_box.accepted.connect(self.accept)
        self.horizontal_layout.addWidget(self.button_box)
        self.vertical_layout_4.addLayout(self.horizontal_layout)
        self.horizontal_layout_3.addLayout(self.vertical_layout_4)

        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab),
                                   self.tr("Info"))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_2),
                                   self.tr("Credits"))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_3),
                                   self.tr("License"))

        self.text_edit_2.setHtml(
            self.
            tr("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
               "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
               "p, li { white-space: pre-wrap; }\n"
               "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Developers:</span></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Ozkar L. Garcell - Project leader & Publisher</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">&lt;[email protected]&gt;</p>\n"
               "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Leodanis Pozo Ramos - Main developer & ArtWork</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">&lt;[email protected]&gt;</p>\n"
               "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-weight:600;\"><br /></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Translators:</span></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Ozkar L. Garcell - en_US, es_ES</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Leodanis Pozo Ramos - en_US, es_ES</p>\n"
               "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-weight:600;\"><br /></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Contributors:</span></p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Carlos Parra Zaldivar - Tester</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Maikel Llamaret Heredia - Tester & ArtWork</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Leonel Salazar Videaux - Tester & Publisher</p>\n"
               "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Osmel Cruz - ArtWork</p>\n"
               "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-weight:600;\"><br /></p></body></html>"
               ))

        self.text_edit_3.setHtml(
            self.
            tr("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
               "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
               "p, li { white-space: pre-wrap; }\n"
               "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
               "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">An easy to use and lightweight video converter</span></p>\n"
               "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;\"><br /></p>\n"
               "<p align=\"justify\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">VideoMorph</span><span style=\" font-size:11pt;\"> is a GUI front-end for </span><a href=\"http://ffmpeg.org/\"><span style=\" font-size:11pt; text-decoration: underline; color:#2980b9;\">ffmpeg</span></a><span style=\" font-size:11pt;\">, based on code from </span><a href=\"https://github.com/senko/python-video-converter\"><span style=\" font-size:11pt; text-decoration: underline; color:#2980b9;\">python-video-converter</span></a><span style=\" font-size:11pt;\"> and presets idea from </span><a href=\"http://qwinff.github.io/\"><span style=\" font-size:11pt; text-decoration: underline; color:#2980b9;\">QWinFF</span></a><span style=\" font-size:11pt;\">.</span></p>\n"
               "<p align=\"justify\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;\"><br /></p>\n"
               "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"https://github.com/videomorph-dev/videomorph\"><span style=\" text-decoration: underline; color:#2980b9;\">https://github.com/videomorph-dev/videomorph</span></a></p></body></html>"
               ))

        self.plain_text_edit.setPlainText(self.get_license_text())
Beispiel #13
0
    def initUI(self):
        self.resize(800,600)
        self.setWindowTitle("QUANT XH 金融终端")
        self.setWindowIcon(QIcon("static/icon.png"))

        self.h1box = QHBoxLayout()
        self.codelabel = QLabel()
        self.codelabel.setText("股票代码")
        self.codelabel.setFont(QFont("仿宋", 12))
        self.codeedit = QTextEdit()
        self.codeedit.setFont(QFont("仿宋", 12))
        self.codeedit.setFixedSize(120,25)
        self.codeedit.setText(self.code)

        self.fromtimelabel = QLabel()
        self.fromtimelabel.setText("起始时间")
        self.fromtimelabel.setFont(QFont("仿宋", 12))
        self.fromtimeedit = QDateEdit()
        self.fromtimeedit.setFixedSize(150, 25)
        self.fromtimeedit.setFont(QFont("仿宋", 12))
        datefrom = datetime.strptime(self.fromtime,"%Y-%m-%d").date()
        self.fromtimeedit.setDate(datefrom)

        self.totimelabel = QLabel()
        self.totimelabel.setText("终止时间")
        self.totimelabel.setFont(QFont("仿宋", 12))
        self.totimeedit = QDateEdit()
        self.totimeedit.setFixedSize(150, 25)
        self.totimeedit.setFont(QFont("仿宋", 12))
        dateto = datetime.strptime(self.totime, "%Y-%m-%d").date()
        self.totimeedit.setDate(dateto)

        self.selectbutton = QPushButton()
        self.selectbutton.setText("选择")
        self.selectbutton.setFont(QFont("仿宋", 12))
        self.selectbutton.clicked.connect(self.updateKlines)

        self.h1box.addStretch(1)
        self.h1box.addWidget(self.codelabel)
        self.h1box.addWidget(self.codeedit)
        self.h1box.addStretch(1)
        self.h1box.addWidget(self.fromtimelabel)
        self.h1box.addWidget(self.fromtimeedit)
        self.h1box.addStretch(1)
        self.h1box.addWidget(self.totimelabel)
        self.h1box.addWidget(self.totimeedit)
        self.h1box.addStretch(1)
        self.h1box.addWidget(self.selectbutton)
        self.h1box.addStretch(1)

        self.klineswindow = KlinesDialog(type="A",code=self.code,fromtime=self.fromtime,totime=self.totime)

        self.v1box = QVBoxLayout()
        self.v1box.addWidget(self.klineswindow)

        self.vbox = QVBoxLayout()
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.h1box)
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.v1box)
        self.vbox.addStretch(1)

        self.setLayout(self.vbox)
    def initUI(self):
        self.index = ["CCI", "RSI", "KDJ"]
        self.sign = ["大于", "小于", "等于", "不小于", "不大于", "不等于"]

        self.resize(700, 500)
        self.setWindowTitle("QUANT XH 金融终端")
        self.setWindowIcon(QIcon("static/icon.png"))

        self.poollabel = QLabel()
        self.poollabel.setText("股票池")
        self.poollabel.setFont(QFont("仿宋", 15))
        self.pooledit = QTextEdit()
        self.pooledit.setFont(QFont("仿宋", 12))
        self.pooledit.setFixedSize(120, 30)
        self.pooladdbtn = QPushButton()
        self.pooladdbtn.setText("添加股票")
        self.pooladdbtn.setFont(QFont("仿宋", 12))
        self.pooladdbtn.setFixedSize(100, 30)
        self.poolclbtn = QPushButton()
        self.poolclbtn.setText("清空")
        self.poolclbtn.setFont(QFont("仿宋", 12))
        self.poolclbtn.setFixedSize(80, 30)
        self.pooltb = QTextBrowser()
        self.pooltb.setFixedSize(300, 300)

        self.buylabel = QLabel()
        self.buylabel.setText("买入条件")
        self.buylabel.setFont(QFont("仿宋", 13))
        self.buycomboindex = QComboBox()
        self.buycomboindex.addItems(self.index)
        self.buycomboindex.setFixedWidth(40)
        self.buycomboindex.setFont(QFont("仿宋", 10))
        self.buycombosign = QComboBox()
        self.buycombosign.addItems(self.sign)
        self.buycombosign.setFixedWidth(40)
        self.buycombosign.setFont(QFont("仿宋", 10))
        self.buyedit = QPlainTextEdit()
        self.buyedit.setFixedSize(80, 30)
        self.buyedit.setFont(QFont("仿宋", 10))
        self.buyaddbtn = QPushButton()
        self.buyaddbtn.setText("添加")
        self.buyaddbtn.setFixedSize(80, 30)
        self.buyaddbtn.setFont(QFont("仿宋", 10))
        self.buyclearbtn = QPushButton()
        self.buyclearbtn.setText("清除所有条件")
        self.buyclearbtn.setFixedSize(120, 30)
        self.buyclearbtn.setFont(QFont("仿宋", 10))
        self.buytb = QTextBrowser()
        self.buytb.setFixedSize(250, 100)

        self.selllabel = QLabel()
        self.selllabel.setText("买入条件")
        self.selllabel.setFont(QFont("仿宋", 13))
        self.sellcomboindex = QComboBox()
        self.sellcomboindex.addItems(self.index)
        self.sellcomboindex.setFixedWidth(40)
        self.sellcomboindex.setFont(QFont("仿宋", 10))
        self.sellcombosign = QComboBox()
        self.sellcombosign.addItems(self.sign)
        self.sellcombosign.setFixedWidth(40)
        self.sellcombosign.setFont(QFont("仿宋", 10))
        self.selledit = QPlainTextEdit()
        self.selledit.setFixedSize(80, 30)
        self.selledit.setFont(QFont("仿宋", 10))
        self.selladdbtn = QPushButton()
        self.selladdbtn.setText("添加")
        self.selladdbtn.setFixedSize(80, 30)
        self.selladdbtn.setFont(QFont("仿宋", 10))
        self.sellclearbtn = QPushButton()
        self.sellclearbtn.setText("清除所有条件")
        self.sellclearbtn.setFixedSize(120, 30)
        self.sellclearbtn.setFont(QFont("仿宋", 10))
        self.selltb = QTextBrowser()
        self.selltb.setFixedSize(250, 100)

        self.h11box = QHBoxLayout()
        self.h11box.addWidget(self.pooledit)
        self.h11box.addWidget(self.pooladdbtn)
        self.h11box.addWidget(self.poolclbtn)
        self.h12box = QHBoxLayout()
        self.h12box.addWidget(self.pooltb)

        self.h21box = QHBoxLayout()
        self.h21box.addWidget(self.buycomboindex)
        self.h21box.addWidget(self.buycombosign)
        self.h21box.addWidget(self.buyedit)
        self.h22box = QHBoxLayout()
        self.h22box.addWidget(self.buyaddbtn)
        self.h22box.addWidget(self.buyclearbtn)
        self.h23box = QHBoxLayout()
        self.h23box.addWidget(self.buytb)
        self.h24box = QHBoxLayout()
        self.h24box.addWidget(self.sellcomboindex)
        self.h24box.addWidget(self.sellcombosign)
        self.h24box.addWidget(self.selledit)
        self.h25box = QHBoxLayout()
        self.h25box.addWidget(self.selladdbtn)
        self.h25box.addWidget(self.sellclearbtn)
        self.h26box = QHBoxLayout()
        self.h26box.addWidget(self.selltb)

        self.v1box = QVBoxLayout()
        self.v1box.addStretch(1)
        self.v1box.addWidget(self.poollabel)
        self.v1box.addLayout(self.h11box)
        self.v1box.addLayout(self.h12box)
        self.v1box.addStretch(1)

        self.v2box = QVBoxLayout()
        self.v2box.addStretch(1)
        self.v2box.addWidget(self.buylabel)
        self.v2box.addLayout(self.h21box)
        self.v2box.addLayout(self.h22box)
        self.v2box.addLayout(self.h23box)
        self.v2box.addStretch(1)
        self.v2box.addWidget(self.selllabel)
        self.v2box.addLayout(self.h24box)
        self.v2box.addLayout(self.h25box)
        self.v2box.addLayout(self.h26box)
        self.v2box.addStretch(1)

        self.hbox = QHBoxLayout()
        self.hbox.addStretch(1)
        self.hbox.addLayout(self.v1box)
        self.hbox.addStretch(1)
        self.hbox.addLayout(self.v2box)
        self.hbox.addStretch(1)

        self.setLayout(self.hbox)
Beispiel #15
0
    def __init__(self):
        super().__init__()

        self.confman = ConfigFileManager()

        self.graphWidget = GraphWidget()
        self.setCentralWidget(self.graphWidget)

        self.sourcesWidget = SourcesWidget()
        self.sourcesWidget.updateRequested.connect(self.update)
        self.sourcesWidget.hide()
        self.sourcesDockWidget = QDockWidget('Sources')
        self.sourcesDockWidget.setObjectName('dock_sources')
        self.sourcesDockWidget.setWidget(self.sourcesWidget)

        self.logTextEdit = QTextEdit()
        self.logTextEdit.setReadOnly(True)
        self.logDockWidget = QDockWidget('Log')
        self.logDockWidget.setObjectName('dock_log')
        self.logDockWidget.setWidget(self.logTextEdit)

        dock_p = None
        toolDockWidgets = []
        self.toolIAD = IADToolWidget(self.graphWidget)
        self.tools = []
        self.toolWidgets = [self.toolIAD, FitToolWidget(self.graphWidget)]
        self.curTool = self.toolIAD.tool
        for t in self.toolWidgets:
            t.plotRequested.connect(self.plotRequested)
            dock = QDockWidget(t.tool.label)
            dock.setObjectName('dock_%s' % t.tool.name)
            dock.setWidget(t)
            toolDockWidgets.append(dock)
            self.tools.append(t.tool)
            self.addDockWidget(Qt.RightDockWidgetArea, dock)
            if dock_p:
                self.tabifyDockWidget(dock_p, dock)
            dock_p = dock

        self.addDockWidget(Qt.BottomDockWidgetArea, self.sourcesDockWidget)
        self.resizeDocks(toolDockWidgets, [400] * len(toolDockWidgets),
                         Qt.Horizontal)
        self.toolIAD.raise_()

        self.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget)
        self.tabifyDockWidget(self.logDockWidget, self.sourcesDockWidget)
        self.resizeDocks([self.sourcesDockWidget, self.logDockWidget],
                         [200, 200], Qt.Vertical)
        self.logDockWidget.raise_()

        actions = [
            ('act_file_import', '&Import file',
             QKeySequence(Qt.CTRL | Qt.Key_I), self.showImportFileDialog),
            ('act_session_new', '&New session', QKeySequence.New,
             self.newSession),
            ('act_session_open', '&Open session', QKeySequence.Open,
             self.showOpenSessionDialog),
            ('act_session_save', '&Save session', QKeySequence.Save,
             self.saveSession),
            ('act_session_save_as', 'Save session as', QKeySequence.SaveAs,
             lambda: self.saveSession(True)),
        ]

        for name, label, key, func in actions:
            act = QAction(label)
            act.setShortcut(key)
            act.triggered.connect(func)
            setattr(self, name, act)

        menubar = self.menuBar()
        filemenu = menubar.addMenu('&File')
        filemenu.addAction(self.act_file_import)

        sessionmenu = menubar.addMenu('&Session')
        sessionmenu.addAction(self.act_session_new)
        sessionmenu.addAction(self.act_session_open)
        sessionmenu.addAction(self.act_session_save)
        sessionmenu.addAction(self.act_session_save_as)

        self.act_session_relative = sessionmenu.addAction(
            'Save with relative path')
        self.act_session_relative.setCheckable(True)

        viewmenu = menubar.addMenu('&View')
        for dockw in toolDockWidgets + [
                self.sourcesDockWidget, self.logDockWidget
        ]:
            viewmenu.addAction(dockw.toggleViewAction())

        self.resize(1000, 800)
        self.setAcceptDrops(True)

        self._prevSheetSet = None
        self.sessionFilename = None
        self.performanceReport = False

        try:
            self.loadConfig()
        except:
            log.warnException()
            return
Beispiel #16
0
    def initUI(self):
        grid = QGridLayout()
        self.setLayout(grid)

        # title_img QLabel
        self.title_img = QLabel()
        self.title_img.setStyleSheet(self.hover_css())
        self.title_img.setAlignment(Qt.AlignCenter)
        grid.addWidget(self.title_img, 0, 0, 1, 3)

        # ts QDateTimeEdit
        time_label = QLabel()
        time_label.setPixmap(self.time_img)
        grid.addWidget(time_label, 1, 0)

        # now_btn QRadioButton
        self.now_btn = QRadioButton('Now')
        self.now_btn.setChecked(True)
        self.now_btn.setCursor(QCursor(Qt.PointingHandCursor))
        grid.addWidget(self.now_btn, 1, 1, 1, 1)

        # manual_btn QRadioButton
        self.manual_btn = QRadioButton('Manually')
        self.manual_btn.setCursor(QCursor(Qt.PointingHandCursor))
        grid.addWidget(self.manual_btn, 1, 2, 1, 1)

        # ts QDateTimeEdit
        self.ts = QDateTimeEdit(self)
        self.ts.setDateTime(self.datetime)
        self.ts.setDateTimeRange(QDateTime(1900, 1, 1, 00, 00, 00),
                                 QDateTime(2100, 1, 1, 00, 00, 00))
        self.ts.setDisplayFormat('yyyy.MM.dd hh:mm')
        grid.addWidget(self.ts, 2, 2, 1, 1)

        # msg label
        msg_label = QLabel()
        msg_label.setPixmap(self.msg_img)
        grid.addWidget(msg_label, 3, 0)

        # msg QTextEdit
        self.msg = QTextEdit()
        self.msg.setStyleSheet(
            "background-color: white; border-radius: 10px; border: 3px solid white;"
        )
        self.msg.installEventFilter(self)
        grid.addWidget(self.msg, 4, 0, 1, 3)

        # in_btn, out_btn Qlabel
        self.in_btn = QLabel()
        self.in_btn.setAlignment(Qt.AlignCenter)
        self.in_btn.setCursor(QCursor(Qt.PointingHandCursor))

        self.out_btn = QLabel()
        self.out_btn.setAlignment(Qt.AlignCenter)
        self.out_btn.setCursor(QCursor(Qt.PointingHandCursor))

        grid.addWidget(self.in_btn, 5, 1)
        grid.addWidget(self.out_btn, 5, 2)

        # stats_btn QLabel
        stats_btn = QLabel()
        stats_btn.setPixmap(self.stats_img)
        stats_btn.setAlignment(Qt.AlignLeft)
        stats_btn.setCursor(QCursor(Qt.PointingHandCursor))
        grid.addWidget(stats_btn, 5, 0)

        # confirm text QLabel
        self.confirmlabel = QLabel(self.confirm_msg, self)
        grid.addWidget(self.confirmlabel, 6, 0, 1, 3)

        # conditional images
        if self.status == 'IN':
            self.in_btn.setPixmap(self.in_grey_img)
            self.out_btn.setPixmap(self.out_img)
            self.title_img.setPixmap(self.awake_img)
        else:
            self.in_btn.setPixmap(self.in_img)
            self.out_btn.setPixmap(self.out_grey_img)
            self.title_img.setPixmap(self.sleep_img)

        ### EVENT ###
        clickable(self.in_btn).connect(self.inCheck)
        clickable(self.out_btn).connect(self.outCheck)
        clickable(stats_btn).connect(self.openWeb)

        self.setWindowTitle('BENJI')
        self.setStyleSheet("background-color: rgb(220,208,255);")
        self.setGeometry(300, 300, 300, 200)
        self.show()
    def __init__(self,parent=None):
        super().__init__(parent)

        self.setWindowTitle("安信可TB模块烧录工具 " + __version__)
        self.setWindowIcon(QIcon("aithinker.png"))
        #self.setWindowFlags(Qt.FramelessWindowHint)
        self.resize(500,300)
        self.layout=QVBoxLayout()

        self.tbox_log=QTextEdit()


        line_1=QHBoxLayout()

        self.serial_cb=QComboBox()

        btn_refresh_p=QPushButton("刷新串口")
        btn_erase_fw =QPushButton("擦除固件")
        btn_erase_key=QPushButton("擦除Mesh Key")
        btn_erase_all=QPushButton("整片擦除")
        btn_rst_chip =QPushButton("复位芯片")

        btn_refresh_p.clicked.connect(self.refresh_p_fn)
        btn_erase_fw.clicked.connect (lambda:self.erase_fn("fw"))
        btn_erase_key.clicked.connect(lambda:self.erase_fn("key"))
        btn_erase_all.clicked.connect(lambda:self.erase_fn("all"))

        btn_rst_chip.clicked.connect(self.rst_chip_fn)

        line_1.addWidget(self.serial_cb)
        line_1.addWidget(btn_refresh_p)
        line_1.addWidget(btn_erase_fw)
        line_1.addWidget(btn_erase_key)
        line_1.addWidget(btn_erase_all)
        line_1.addWidget(btn_rst_chip)

        line_1.setContentsMargins(0, 0, 0, 0)

        line_2=QHBoxLayout()
        
        self.tbox_file = QLineEdit()
        btn_open_file =QPushButton("···")
        btn_burn=QPushButton("烧录固件")

        btn_open_file.clicked.connect(self.open_file_fn)
        btn_burn.clicked.connect(self.burn_fn)

        line_2.addWidget(self.tbox_file)
        line_2.addWidget(btn_open_file)
        line_2.addWidget(btn_burn)

        line_2.setContentsMargins(0, 0, 0, 0)

        line_3=QHBoxLayout()

        self.tbox_ali_pID = QLineEdit()
        self.tbox_ali_Mac = QLineEdit()
        self.tbox_ali_Sct = QLineEdit()
        btn_burn_triad=QPushButton("烧录三元组")
        btn_burn_triad.clicked.connect(self.burn_triad_fn)

        line_3.addWidget(self.tbox_ali_pID)
        line_3.addWidget(self.tbox_ali_Mac)
        line_3.addWidget(self.tbox_ali_Sct)
        line_3.addWidget(btn_burn_triad)

        line_3.setContentsMargins(0, 0, 0, 0)

        line_3.setStretch(0, 1)
        line_3.setStretch(1, 2)
        line_3.setStretch(2, 5)
        line_3.setStretch(3, 1)


        self.layout.addWidget(self.tbox_log)
        self.layout.addLayout(line_1)
        self.layout.addLayout(line_2)
        self.layout.addLayout(line_3)

        self.pbar = QProgressBar(self)
        self.layout.addWidget(self.pbar)

        self.setLayout(self.layout)
        self.refresh_p_fn()
Beispiel #18
0
 def __init__(self, grid):
     super().__init__()
     self.grid = grid
     self.text_edit = QTextEdit()
     self.init_ui()
Beispiel #19
0
        def navigateToNextTest(self):
                if self.state:
                        self.tr =Thread(target = self.timer)
                        self.tr.start()
                        self.state = False
                if self.text:
                        self.qwidgets[self.qindex].hide()
                        self.testOver()
                        return None
                try:
                        if self.attempted:
                                self.frame = self.qindex
                                pick = self.prepared_questions[self.qindex]
                                question_no = QLabel()
                                question_no.setFont(QFont('Ariel', 15))
                                question_no.setText(pick[0].strip('\n'))
                                question_no.setObjectName('q_number')
                                question_no.setMaximumHeight(30)

                                question = QTextEdit()
                                question.setObjectName('question')
                                question_text = self.arrangeText(pick[1])
                                question.setText(question_text)
                                question.setFont(QFont('Ariel', 15))
                                #question.setWordWrap(True)
                                question.setReadOnly(True)
                                question.setMaximumSize(720, 350)
                                question.setMinimumSize(720, 350)
                                
                                

                                option_group = QButtonGroup(self)
                                
                                question_gb = QGroupBox()
                                question_gb.setObjectName('question')
                                question_gb.setTitle('')
                                question_gb.setFont(QFont('Ariel', 15))
                                question_gb.resize(500,500)
                                question_gb.setMaximumSize(750,400)
                                question_gb.setMinimumSize(750, 400)
                                
                                question_layout = QVBoxLayout()
                                #question_layout.addWidget(question, alignment=Qt.AlignTop)
                                if len(pick) == 3:
                                        file_path = pick[2]
                                        image_url = QUrl(file_path)
                                        image = QImage(QImageReader(file_path).read())

                                        question.document().addResource(QTextDocument.ImageResource,image_url,QVariant(image))

                                        image_format = QTextImageFormat()
                                        image_format.setWidth(image.width())
                                        image_format.setHeight(image.height())
                                        image_format.setName(image_url.toString())

                                        text_cursor = question.textCursor()
                                        text_cursor.movePosition(QTextCursor.End,QTextCursor.MoveAnchor)
                                        text_cursor.insertImage(image_format)

                                question_layout.addWidget(question, alignment=Qt.AlignTop)       

                                question_gb.setLayout(question_layout)
                                
                                rb_box = QVBoxLayout()
                                rb_box.setSpacing(2)
                                rb_box.setObjectName('options')
                                rb_box.setAlignment(Qt.AlignCenter)
                                


                                options = self.prepared_options[self.qindex]
                                
                                for items in options:
                                        rb = QRadioButton(items.strip('\n'), self)
                                        rb.setFont(QFont('Ariel', 15))
                                        rb.setObjectName('options')
                                        rb_box.addWidget(rb)
                                        option_group.addButton(rb)
                                option_group.buttonClicked.connect(self.getChoice)
                                
                                
                                
                                button_next = QPushButton('Next')
                                button_next.setObjectName('next')
                                button_next.resize(10,5)
                                button_next.clicked.connect(self.navigateToNextTest)

                                button_previous = QPushButton('Previous')
                                button_previous.setObjectName('next')
                                button_previous.resize(10,5)
                                button_previous.clicked.connect(self.navigateToPreviousTest)
                        

                                container = QGridLayout()
                                container.setContentsMargins(5,5,5,5)
                                #container.setSpacing(2)


                                container.addWidget(question_no, 0, 0,alignment=Qt.AlignLeft  )
                                container.addWidget(self.time_display,0,4, alignment=Qt.AlignRight)
                                container.addWidget(question_gb, 1 , 1, 1, 3,)
                                container.addLayout(rb_box, 3, 2)
                                container.addWidget(button_next, 4, 4, 1, 1)
                                if (self.qindex == 1):
                                        pass
                                else:
                                        container.addWidget(button_previous, 4, 0, 1, 1)
                                if self.qindex == (len(self.prepared_questions)- 1):
                                        button_next.setText('Submit')

                                self.qwidgets[self.qindex].setLayout(container)
                                self.qwidgets[self.qindex].setObjectName('main')
                                
                                self.qwidgets[self.qindex-1].hide()
                                self.layout.addWidget(self.qwidgets[self.qindex])
                                
                                
                                self.qindex +=1
                                
                                self.check = self.qindex
                                
                        else:
                                if self.qindex == self.check-1:
                                        self.attempted = True
                                else:
                                        self.attempted = False
                                self.qwidgets[self.qindex-1].hide()
                                self.qwidgets[self.qindex].show()
                                self.qindex += 1
                                self.frame += 1
                                

                except IndexError:
                        print("Questions Exhausted")
                        done = QMessageBox.question(self.qwidgets[self.qindex],"Submit Test?", "Are you sure you want to submit the test?", QMessageBox.No | QMessageBox.Yes, QMessageBox.No)
                        if done == QMessageBox.Yes:
                                self.testOver()
                        else:
                                pass
Beispiel #20
0
 def editor(self):
     self.textEdit = QTextEdit()
     self.setCentralWidget(self.textEdit)
Beispiel #21
0
    def initUI(self):
        # 执行时间标签
        self.time = QLabel('', self)
        self.time.move(100, 80)
        self.time.resize(200, 20)
        # ID标签
        self.sid = QLabel('ID', self)
        self.sid.move(25, 50)
        self.sid.resize(50, 20)
        # ID搜索框
        self.searchBar = QLineEdit(self)
        self.searchBar.move(100, 30)
        self.searchBar.resize(450, 50)
        # 搜索按钮
        self.searchButton = QPushButton("Search", self)
        self.searchButton.move(600, 30)
        self.searchButton.resize(80, 50)
        # 清空按钮
        self.clearButton = QPushButton("Clear", self)
        self.clearButton.move(700, 30)
        self.clearButton.resize(80, 50)
        # cnlabels
        self.cnlabels = QLabel('CNLABELS', self)
        self.cnlabels.move(15, 140)
        self.cnlabels.resize(50, 20)
        self.cnlabelsEdit = QTextEdit(self)
        self.cnlabelsEdit.move(100, 120)
        self.cnlabelsEdit.resize(680, 60)
        # enlabels
        self.enlabels = QLabel('ENLABELS', self)
        self.enlabels.move(15, 200)
        self.enlabels.resize(50, 20)
        self.enlabelsEdit = QTextEdit(self)
        self.enlabelsEdit.move(100, 180)
        self.enlabelsEdit.resize(680, 60)
        # descriptions
        self.descriptions = QLabel('DESCRIPTIONS', self)
        self.descriptions.move(15, 260)
        self.descriptions.resize(80, 20)
        self.descriptionsEdit = QTextEdit(self)
        self.descriptionsEdit.move(100, 240)
        self.descriptionsEdit.resize(680, 60)
        # aliases
        self.aliases = QLabel('ALIASES', self)
        self.aliases.move(15, 320)
        self.aliases.resize(80, 20)
        self.aliasesEdit = QTextEdit(self)
        self.aliasesEdit.move(100, 300)
        self.aliasesEdit.resize(680, 60)
        # properties
        self.properties = QLabel('PROPERTIES', self)
        self.properties.move(15, 380)
        self.properties.resize(80, 20)
        self.propertiesEdit = QTextEdit(self)
        self.propertiesEdit.move(100, 360)
        self.propertiesEdit.resize(680, 60)
        # datavalue
        self.datavalue = QLabel('DATAVALUE', self)
        self.datavalue.move(15, 440)
        self.datavalue.resize(80, 20)
        self.datavalueEdit = QTextEdit(self)
        self.datavalueEdit.move(100, 420)
        self.datavalueEdit.resize(680, 60)
        # qhash
        self.qhash = QLabel('QHASH', self)
        self.qhash.move(15, 500)
        self.qhash.resize(80, 20)
        self.qhashEdit = QTextEdit(self)
        self.qhashEdit.move(100, 480)
        self.qhashEdit.resize(680, 60)
        # qdatavalue
        self.qdatavalue = QLabel('QDATAVALUE', self)
        self.qdatavalue.move(15, 560)
        self.qdatavalue.resize(80, 20)
        self.qdatavalueEdit = QTextEdit(self)
        self.qdatavalueEdit.move(100, 540)
        self.qdatavalueEdit.resize(680, 60)
        # rhash
        self.rhash = QLabel('RHASH', self)
        self.rhash.move(15, 620)
        self.rhash.resize(80, 20)
        self.rhashEdit = QTextEdit(self)
        self.rhashEdit.move(100, 600)
        self.rhashEdit.resize(680, 60)
        # rdatavalue
        self.rdatavalue = QLabel('RDATAVALUE', self)
        self.rdatavalue.move(15, 680)
        self.rdatavalue.resize(80, 20)
        self.rdatavalueEdit = QTextEdit(self)
        self.rdatavalueEdit.move(100, 660)
        self.rdatavalueEdit.resize(680, 60)
        # snakorder
        self.snakorder = QLabel('SNAKORDER', self)
        self.snakorder.move(15, 740)
        self.snakorder.resize(80, 20)
        self.snakorderEdit = QTextEdit(self)
        self.snakorderEdit.move(100, 720)
        self.snakorderEdit.resize(680, 60)

        self.resize(800, 800)
        self.center()
        self.setWindowTitle('WikiData---ID-SEARCH')
        self.setWindowIcon(QIcon('icon.jpg'))
        self.show()
        self.searchButton.clicked.connect(self.fun)
        self.clearButton.clicked.connect(self.clear)
    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 15))
        self.setFont(QFont('cairo', 12))
        self.setToolTip(self.__lang_strings['mainWindow']['toolTip'])
        #print(type(self.__lang_strings['mainWindow']['width']))

        self.setWindowTitle(self.__lang_strings['mainWindow']['windowTitle'])
        self.setWindowIcon(QIcon(self.__lang_strings['mainWindow']['windowIcon']))
        
        self.createMenuBar()

        #Creating the status bar
        self.statusBar().showMessage(self.__lang_strings['statusBar']['msg'])
        
        #To Center the window
        self.center()
        
        #Button
        btn = self.createButton(self.__lang_strings['buttons']['analyseButton']['name'],
        50,50,self.__lang_strings['buttons']['analyseButton']['name'])
        #Quit Button
        qbtn = self.createButton(self.__lang_strings['buttons']['quitButton']['name']
        ,100,100,self.__lang_strings['buttons']['quitButton']['toolTip'])
        
        #Quit Button
        loadModelBtn = self.createButton(self.__lang_strings['buttons']['loadModelBtn']['name']
        ,100,100,self.__lang_strings['buttons']['loadModelBtn']['toolTip'])
        
        #Setting events
        qbtn.clicked.connect(QApplication.instance().quit)
        btn.clicked.connect(self.analizeButtonClicked)
        loadModelBtn.clicked.connect(self.loadModelButtonClicked)

        self.central_widget = QWidget()               # define central widget
        self.setCentralWidget(self.central_widget)    # set QMainWindow.centralWidget

        combo = QComboBox(self)
        combo.addItem(self.__models_set[0])
        combo.addItem(self.__models_set[1])
        combo.addItem(self.__models_set[2])
        '''
        combo.addItem("Desision Tree")
        combo.addItem("Tokenizer")
        combo.addItem("RNN (Recurrent Neural Network)")
        combo.addItem("CNN (Convolutional Neural Network)")
        '''         
        self.resultEdit = QTextEdit()
        self.inputTextEdit = QTextEdit()
        review = QLabel(self.__lang_strings['textLabels']['review'])
        resultLbl = QLabel(self.__lang_strings['textLabels']['result'])
        #Creating layout
        hboxCombo = QHBoxLayout()
        hboxCombo.addStretch(1)
        hboxCombo.addWidget(combo)
        hboxCombo.addWidget(loadModelBtn)
        combo.activated[str].connect(self.onActivated) 
        
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(btn)
        hbox.addWidget(qbtn)
        
        vbox = QVBoxLayout()
        vbox.addLayout(hboxCombo)
        vbox.addWidget(review)
        vbox.addWidget(self.inputTextEdit)
        vbox.addWidget(resultLbl)
        vbox.addWidget(self.resultEdit)
        #vbox.addStretch(1)
        vbox.addLayout(hbox)
        
        self.centralWidget().setLayout(vbox) 
        
        
        self.setGeometry(300, 300, self.__lang_strings['mainWindow']['width'],
        self.__lang_strings['mainWindow']['height'])
        self.show()
        '''
Beispiel #23
0
    def initUI(self):
        self.setGeometry(300, 300, 780, 250)
        self.setWindowTitle('Reservation System')

        #label,LineEdit,TextEdit,ComboBox 생성
        label_name = QLabel('이름:')
        label_phone = QLabel('번호:')
        label_year = QLabel('년도(yyyy):')
        label_month = QLabel('월(mm):')
        label_date = QLabel('일(dd):')
        label_hours = QLabel('시(hh):')
        label_minutes = QLabel('분(mm):')
        label_seconds = QLabel('초(ss):')
        label_key = QLabel('옵션:')
        label_status = QLabel('Status')

        self.text_name = QLineEdit()
        self.text_name.setFixedWidth(60)
        self.text_name.setAlignment(Qt.AlignRight)
        self.text_name.setMaxLength(6)
        self.text_phone = QLineEdit()
        self.text_phone.setFixedWidth(100)
        self.text_phone.setAlignment(Qt.AlignRight)
        self.text_phone.setMaxLength(11)
        self.text_year = QLineEdit()
        self.text_year.setFixedWidth(80)
        self.text_year.setAlignment(Qt.AlignRight)
        self.text_year.setMaxLength(4)
        self.text_month = QLineEdit()
        self.text_month.setFixedWidth(60)
        self.text_month.setAlignment(Qt.AlignRight)
        self.text_month.setMaxLength(2)
        self.text_date = QLineEdit()
        self.text_date.setFixedWidth(60)
        self.text_date.setAlignment(Qt.AlignRight)
        self.text_date.setMaxLength(2)
        self.text_hours = QLineEdit()
        self.text_hours.setFixedWidth(60)
        self.text_hours.setAlignment(Qt.AlignRight)
        self.text_hours.setMaxLength(2)
        self.text_minutes = QLineEdit()
        self.text_minutes.setFixedWidth(60)
        self.text_minutes.setAlignment(Qt.AlignRight)
        self.text_minutes.setMaxLength(2)
        self.text_seconds = QLineEdit()
        self.text_seconds.setFixedWidth(60)
        self.text_seconds.setAlignment(Qt.AlignRight)
        self.text_seconds.setMaxLength(2)
        self.text_status = QLineEdit()

        self.text_title = QTextEdit()
        self.text_title.setReadOnly(True)
        font = self.text_title.font()
        font.setPointSize(font.pointSize() + 20)
        self.text_title.setFont(font)
        self.text_title.setText("Reservation System")
        self.text_title.setAlignment(Qt.AlignCenter)

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

        self.combobox_key = QComboBox()

        #콤보박스 항목추가
        self.combobox_key.addItem('All')
        self.combobox_key.addItem('이름')
        self.combobox_key.addItem('날짜')

        #PushButton추가
        button_add = QPushButton('add')
        button_del = QPushButton('del')
        button_show = QPushButton('Show')

        #수평방향레이아웃생성
        hlayout_option1 = QHBoxLayout()  #이름,번호
        hlayout_option2 = QHBoxLayout()  #년도,월,일
        hlayout_option3 = QHBoxLayout()  #시간
        hlayout_option4 = QHBoxLayout()  #키
        hlayout_buttons = QHBoxLayout()  #버튼
        hlayout_status_bar = QHBoxLayout()  #상태바

        hlayout_main = QHBoxLayout()

        hlayout_option1.addStretch(300)
        hlayout_option1.addWidget(label_name)
        hlayout_option1.addWidget(self.text_name)
        hlayout_option1.addWidget(label_phone)
        hlayout_option1.addWidget(self.text_phone)

        hlayout_option2.addStretch()
        hlayout_option2.addWidget(label_year)
        hlayout_option2.addWidget(self.text_year)
        hlayout_option2.addWidget(label_month)
        hlayout_option2.addWidget(self.text_month)
        hlayout_option2.addWidget(label_date)
        hlayout_option2.addWidget(self.text_date)

        hlayout_option3.addStretch()
        hlayout_option3.addWidget(label_hours)
        hlayout_option3.addWidget(self.text_hours)
        hlayout_option3.addWidget(label_minutes)
        hlayout_option3.addWidget(self.text_minutes)
        hlayout_option3.addWidget(label_seconds)
        hlayout_option3.addWidget(self.text_seconds)

        hlayout_option4.addStretch()
        hlayout_option4.addWidget(label_key)
        hlayout_option4.addWidget(self.combobox_key)

        hlayout_buttons.addWidget(button_add)
        hlayout_buttons.addWidget(button_del)
        hlayout_buttons.addWidget(button_show)

        hlayout_status_bar.addWidget(label_status)
        hlayout_status_bar.addWidget(self.text_status)

        #수직방향레이아웃생성
        vlayout = QVBoxLayout()
        vlayout.addLayout(hlayout_option1)
        vlayout.addLayout(hlayout_option2)
        vlayout.addLayout(hlayout_option3)
        vlayout.addLayout(hlayout_option4)
        vlayout.addLayout(hlayout_buttons)
        vlayout.addWidget(self.text_title)
        vlayout.addLayout(hlayout_status_bar)

        hlayout_main.addWidget(self.text_print)
        hlayout_main.addLayout(vlayout)

        self.setLayout(hlayout_main)
        self.show()

        #신호설정
        button_add.clicked.connect(self.goAddReservationList)
        button_del.clicked.connect(self.goDelReservationList)
        button_show.clicked.connect(self.goShowReservationList)
Beispiel #24
0
    def __init__(self, parameters, color, editable=False):
        """
            Init the ShowNewFile.
        """
        super().__init__()
        print(parameters)
        self.editable = editable
        """
            Here is a little hack: in the QTreeWidget (see below), we will add
            some QTreeWidgetItem. Each one of them will be removable. But each
            time we remove a QTreeWidgetItem, the index of the QTreeWidgetItem
            below it will be reindexed. So, we need to remember how many
            QTreeWidgetItem were deleted to calculate the old index.
            This is done throught a list. Each time we add a node, we add its
            id to the list. This way, when we delete the node, we search the
            position of its id in the list, and we delete the node at this
            position.
            The same process is used later for the node of other nodes.
        """
        self.nb_created = 0
        self.correspondence_index_position = []

        self.setMinimumSize(690, 500)
        tabs = QTabWidget()
        tabs.setFocusPolicy(Qt.NoFocus)  # prevent the "horrible orange box effect" on Ubuntu
        # set the style
        tabs.setStyleSheet(tabs.styleSheet() + """
        QTabBar::tab:!selected {
            color: rgb(242, 241, 240);
            background-color: rgb(0, 126, 148);
        }

        QTabBar::tab:selected {
            color: rgb(0, 126, 148);
        }
        """)

        # change the background color
        p = self.palette()
        red, green, blue, alpha = color
        p.setColor(self.backgroundRole(), QColor(red, green, blue, alpha))
        self.setPalette(p)

        # get the equation from the file
        list_data_equation = []
        for key in parameters["equation"]:
            if key == "D":
                first_coef_type = "D_0"
                second_coef_type = "E_D"
            elif key == "S":
                first_coef_type = "S_0"
                second_coef_type = "E_S"
            elif key == "Kr":
                first_coef_type = "Kr_0"
                second_coef_type = "E_r"
            

            sorted_coefficients = []
            sorted_coefficients.append(key)
            sorted_coefficients.append((first_coef_type, parameters["equation"][key][first_coef_type]))
            sorted_coefficients.append((second_coef_type, parameters["equation"][key][second_coef_type]))
            comment = parameters["equation"][key].get("comment", "")
            sorted_coefficients.append(("comment", comment))
            list_data_equation.append(sorted_coefficients)

        self.list_data_equation = list_data_equation
        # create a tab based on this informations
        tabs.addTab(makeWidget.make_scroll(self.make_vbox_from_data_equation(list_data_equation)), "Coefficients values")

        """
        # display a nice name for the area
        adatome_name = parameters["material"]["adatome"]
        adatome_name = str(adatome_name) if adatome_name is not None else "None"
        material_name = parameters["material"]["name"]
        material_name = str(material_name) if material_name is not None else "None"
        name_of_area = QLabel("diffusion of " + adatome_name + " in " + material_name)
        myFont=QFont()
        myFont.setBold(True)
        name_of_area.setFont(myFont)
        """

        material_container = makeWidget.make_vbox()
        material_container.setObjectName("material")
        gb_material = QGroupBox()
        gb_material.setTitle("material")
        gb_material.setObjectName("gb_material")
        grid_material = QGridLayout()
        grid_material.setObjectName("grid_material")
        gb_material.layout = grid_material
        gb_material.setLayout(gb_material.layout)

        gb_adatome = QGroupBox()
        gb_adatome.setTitle("adatome")
        gb_adatome.setObjectName("gb_adatome")
        grid_adatome = QGridLayout()
        grid_adatome.setObjectName("grid_adatome")
        gb_adatome.layout = grid_adatome
        gb_adatome.setLayout(gb_adatome.layout)

        material_container.layout.addWidget(gb_adatome)
        material_container.layout.addWidget(gb_material)

        adatome_counter = 0
        for key in ["adatome", "adatome_atomic_number", "adatome_atomic_symbol"]:
            value = ""
            try:
                value = str(parameters["material"][key])
            except KeyError:
                print("There is no key named", key, "in the file loaded, thus it is not possible to diplay this information.")
                if self.editable:
                    value = "None"
            if value:
                line = QLineEditWidthed(value, editable, "--------------")
                grid_adatome.addWidget(QLabel(key), adatome_counter, 0)
                grid_adatome.addWidget(line, adatome_counter, 1);
                adatome_counter += 1

        
        material_counter = 0
                # "name" : None,
        # "atomic_symbol" : None,
        # "lattice_type" : None,
        # "melting_point" : None,
        # "atomic_number" : None,
        # "mean_lattice_constant" : None,
        # "density" : None,

        # "adatome" : None,
        # "adatome_atomic_number" : None,
        # "adatome_atomic_symbol" : None

        keys = ("name", "atomic_symbol", "lattice_type", "melting_point", "atomic_number", "mean_lattice_constant", "density")
        units = ("", "", "", "K", "", "m", "atoms/m³")
        for key, unit in zip(keys, units):
            value = ""
            try:
                value = str(parameters["material"][key])
            except KeyError:
                print("There is no key named", key, "in the file loaded, thus it is not possible to diplay this information.")
                if self.editable:
                    value = "None"
            if value:
                line = QLineEditWidthed(value, editable, "--------------")
                grid_material.addWidget(QLabel(key), material_counter, 0)
                grid_material.addWidget(QLabel("     "), material_counter, 1)  # todo: find a better way to align Qlabels inside the grid
                grid_material.addWidget(line, material_counter, 2)

                if unit:
                    grid_material.addWidget(QLabel("("+unit+")"), material_counter, 3)
                    if key == "density":
                        eq_density = makeWidget.make_pixmap("ressources/latex_equation_density_resized.png")
                        grid_material.addWidget(eq_density, material_counter, 4)
                    else:
                        grid_material.addWidget(QLabel(""), material_counter, 4)
                material_counter += 1

        tabs.addTab(makeWidget.make_scroll(material_container), "Material")

        gridSource = QWidget()
        gridSource.layout = QGridLayout()
        gridSource.setLayout(gridSource.layout)
        gridSource.setObjectName("source")
        i = 0

        self.list_data_source = parameters["source"]
        # last edit
        prop = "last_edit"
        gridSource.layout.addWidget(QLabel(prop), i, 0)
        value = parameters["source"].get("last_edit", get_today_date())
        gridSource.layout.addWidget(QLineEditWidthed(value, False, "2019-07-01 10:56:89"), i, 1)
        i += 1

        # author_name
        prop = "author_name"
        gridSource.layout.addWidget(QLabel(prop), i, 0)
        value = parameters["source"][prop]
        if value is None:
            value = "None"
        elif type(value) is not str:
            value = "{:.2e}".format(float(value))
        gridSource.layout.addWidget(QLineEditWidthed(value, editable, "-------------------------------"), i, 1)
        i += 1

        # DOI
        prop = "doi"
        gridSource.layout.addWidget(QLabel(prop), i, 0)
        doi_api_success = False
        to_insert = None
        if not self.editable:
            try:
                import signal
                from crossref.restful import Works

                class TimeoutException(Exception):
                    pass

                def deadline(timeout, *args):
                    """
                        "decorator of a decorator" that allow the decorator
                        to accept an argument. If the decorated function didn't
                        finish before 'timeout' seconds, then a
                        TimeoutException is raised.
                    """
                    def decorate(f):
                        """ the decorator creation """
                        def handler(signum, frame):
                            """ the handler for the timeout """
                            raise TimeoutException()
                
                        def new_f(*args):
                            """ the initiation of the handler, 
                            the lauch of the function and the end of it"""
                            signal.signal(signal.SIGALRM, handler)
                            signal.alarm(timeout)
                            res = f(*args)
                            signal.alarm(0)
                            return res
                    
                        new_f.__name__ = f.__name__
                        return new_f
                    return decorate

                @deadline(3)
                def request_doi_api():
                    works = Works()
                    address = parameters["source"][prop]
                    data = works.doi(address)
                    if data:
                        value = data["URL"]
                        to_insert = QLabel("<html><a href=\"" + value + "\">" + value + "</a></html>")
                    else:
                        to_insert = None
                    return to_insert
                
                try:
                    # to_insert = request_doi_api()
                    if to_insert:
                        doi_api_success = True
                except TimeoutException:
                    print("time out")
            except Exception as e:
                print(e)
        if not doi_api_success:
            value = parameters["source"][prop]
            if value is None:
                value = "None"
            elif type(value) is not str:
                value = "{:.2e}".format(float(value))
            to_insert = QLineEditWidthed(value, editable, "https://doi.org/10.1016/j.nme.2018.11.020-------------")
        gridSource.layout.addWidget(to_insert, i, 1)
        i += 1
        # YEAR
        prop = "year"
        gridSource.layout.addWidget(QLabel(prop), i, 0)
        value = parameters["source"][prop]
        if value is None:
            value = "None"
        elif type(value) is not str:
            value = str(int(value))
        gridSource.layout.addWidget(QLineEditWidthed(value, editable, "------"), i, 1)
        i += 1

        tabs.addTab(makeWidget.make_scroll(gridSource), "Source")
        
        tree = QTreeWidget()
        tree.setItemsExpandable(False)
        tabs.setStyleSheet(tabs.styleSheet() + """
        QTreeWidget::item {
            margin: 3px 0;
        }
        """)
        if self.editable:
            tree.setColumnCount(4)
            tree.setHeaderLabels([
                "Density",
                "",
                "energy",
                "",
                "frequence",
                "",
                "Delete this trap",
                "Add data to this trap"
            ])
        else:
            tree.setColumnCount(2)
            tree.setHeaderLabels([
                "Density",
                "",
                "energy",
                "",
                "frequence",
                ""
            ])
        tree.header().resizeSection(0, 120)
        tree.header().resizeSection(1, 50)
        tree.header().resizeSection(2, 100)
        tree.header().resizeSection(3, 35)
        tree.header().resizeSection(4, 100)
        tree.header().resizeSection(5, 35)

        tree.header().resizeSection(6, 115)
        tree.header().resizeSection(7, 145)
        tree.header().setStretchLastSection(False)
        tree.setObjectName("traps")
        
        for trap in parameters["traps"]:
            tree_item_for_this_trap = self.create_subtree_for_a_trap(tree, trap)
            for data in trap["data"]:
                self.addEnergyToATrap(tree, tree_item_for_this_trap, data)
        vbox = makeWidget.make_vbox()
        vbox.layout.addWidget(tree)

        if self.editable:
            bt_add_new_trap = QPushButton("Add a trap")
            vbox.layout.addWidget(bt_add_new_trap)
            empty_trap = {"density":None, "angular_frequency":None, "energy":[]}
            bt_add_new_trap.clicked.connect(partial(self.create_subtree_for_a_trap, tree, empty_trap))
        comment = parameters.get("traps-comment", "")
        textedit = QTextEdit(comment)
        textedit.setReadOnly(not self.editable)
        textedit.setObjectName("traps-comment")
        tabs.addTab(makeWidget.make_vbox(vbox, textedit), "Traps")
        
        layout = QVBoxLayout()  # contient les tabs
        layout.addWidget(tabs)
        self.setLayout(layout)
        self.tabs = tabs
    def __init__(self, parent, receiver_slot, settings, video_dict={}):
        super().__init__(parent, receiver_slot, settings, video_dict)
        self.setWindowTitle(
            QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video Finder'))
        self.size_label.hide()

        # empty lists for no_audio and no_video and video_audio files
        self.no_audio_list = []
        self.no_video_list = []
        self.video_audio_list = []

        self.media_title = ''

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        # extension_label
        self.extension_label = QLabel(self.link_frame)
        self.change_name_horizontalLayout.addWidget(self.extension_label)

        # Fetch Button
        self.url_submit_pushButtontton = QPushButton(self.link_frame)
        self.link_horizontalLayout.addWidget(self.url_submit_pushButtontton)

        # Status Box
        self.status_box_textEdit = QTextEdit(self.link_frame)
        self.status_box_textEdit.setMaximumHeight(150)
        self.link_verticalLayout.addWidget(self.status_box_textEdit)

        # Select format horizontal layout
        select_format_horizontalLayout = QHBoxLayout()

        # Selection Label
        self.select_format_label = QLabel(self.link_frame)
        select_format_horizontalLayout.addWidget(self.select_format_label)

        # Selection combobox
        self.media_comboBox = QComboBox(self.link_frame)
        self.media_comboBox.setMinimumWidth(200)
        select_format_horizontalLayout.addWidget(self.media_comboBox)

        # Duration label
        self.duration_label = QLabel(self.link_frame)
        select_format_horizontalLayout.addWidget(self.duration_label)

        self.format_selection_frame = QFrame(self)
        self.format_selection_frame.setLayout(select_format_horizontalLayout)
        self.link_verticalLayout.addWidget(self.format_selection_frame)

        # advanced_format_selection_checkBox
        self.advanced_format_selection_checkBox = QCheckBox(self)
        self.link_verticalLayout.addWidget(
            self.advanced_format_selection_checkBox)

        # advanced_format_selection_frame
        self.advanced_format_selection_frame = QFrame(self)
        self.link_verticalLayout.addWidget(
            self.advanced_format_selection_frame)

        advanced_format_selection_horizontalLayout = QHBoxLayout(
            self.advanced_format_selection_frame)

        # video_format_selection
        self.video_format_selection_label = QLabel(
            self.advanced_format_selection_frame)
        self.video_format_selection_comboBox = QComboBox(
            self.advanced_format_selection_frame)

        # audio_format_selection
        self.audio_format_selection_label = QLabel(
            self.advanced_format_selection_frame)
        self.audio_format_selection_comboBox = QComboBox(
            self.advanced_format_selection_frame)

        for widget in [
                self.video_format_selection_label,
                self.video_format_selection_comboBox,
                self.audio_format_selection_label,
                self.audio_format_selection_comboBox
        ]:
            advanced_format_selection_horizontalLayout.addWidget(widget)

        # Set Texts
        self.url_submit_pushButtontton.setText(
            QCoreApplication.translate("ytaddlink_src_ui_tr",
                                       'Fetch Media List'))
        self.select_format_label.setText(
            QCoreApplication.translate("ytaddlink_src_ui_tr",
                                       'Select a format'))

        self.video_format_selection_label.setText(
            QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video format:'))
        self.audio_format_selection_label.setText(
            QCoreApplication.translate("ytaddlink_src_ui_tr", 'Audio format:'))

        self.advanced_format_selection_checkBox.setText(
            QCoreApplication.translate("ytaddlink_src_ui_tr",
                                       'Advanced options'))

        # Add Slot Connections
        self.url_submit_pushButtontton.setEnabled(False)
        self.change_name_lineEdit.setEnabled(False)
        self.ok_pushButton.setEnabled(False)
        self.download_later_pushButton.setEnabled(False)

        self.format_selection_frame.setEnabled(True)
        self.advanced_format_selection_frame.setEnabled(False)
        self.advanced_format_selection_checkBox.toggled.connect(
            self.advancedFormatFrame)

        self.url_submit_pushButtontton.clicked.connect(self.submitClicked)

        self.media_comboBox.activated.connect(
            partial(self.mediaSelectionChanged, 'video_audio'))

        self.video_format_selection_comboBox.activated.connect(
            partial(self.mediaSelectionChanged, 'video'))

        self.audio_format_selection_comboBox.activated.connect(
            partial(self.mediaSelectionChanged, 'audio'))

        self.link_lineEdit.textChanged.disconnect(
            super().linkLineChanged)  # Should be disconnected.
        self.link_lineEdit.textChanged.connect(self.linkLineChangedHere)

        self.setMinimumSize(650, 480)

        self.status_box_textEdit.hide()
        self.format_selection_frame.hide()
        self.advanced_format_selection_frame.hide()
        self.advanced_format_selection_checkBox.hide()

        if 'link' in video_dict.keys() and video_dict['link']:
            self.link_lineEdit.setText(video_dict['link'])
            self.url_submit_pushButtontton.setEnabled(True)
        else:
            # check clipboard
            clipboard = QApplication.clipboard()
            text = clipboard.text()
            if (("tp:/" in text[2:6]) or ("tps:/" in text[2:7])):
                self.link_lineEdit.setText(str(text))

            self.url_submit_pushButtontton.setEnabled(True)
Beispiel #26
0
        def fillVboxWithAnything(equations_container, name, coef1, coef2, comment_content, is_in_the_file=True):
            """
                Create a QGroupBox, fill it with the informations contained in
                'name', 'coef1' and 'coef2'.
                Then, add this widget to equations_container.
            """
            coef2kJmol = "None" if coef2 == "None" else "{:.2e}".format(float(coef2)/0.0104)
            equation_container = QGroupBox()
            unit2 = ("(eV)", "(kJ/mol)")
            if name == "D":
                unit1 = "(m²/s)"
                # latex_equation = makeWidget.make_pixmap("ressources/latex_equation_diffusivity_resized.png")
                latex_equation_text = \
                    r"$D = D_0 \cdot e^{-\frac{E_D}{k_B \cdot T}}$"
                latex_equation = mathTex_to_QPixmap(latex_equation_text, 16)
                title = "For interstitial diffusivity"
                objectName = "diffusivity"
                coef1_name = "D_0"
                coef2_name = "E_D"
            elif name == "S":
                unit1 = "(adatome/(m³*Pa½))"  # todo: update it (like JS)
                # latex_equation = makeWidget.make_pixmap("ressources/latex_equation_solubility_resized.png")
                latex_equation_text = \
                    r"$S = S_0 \cdot e^{-\frac{E_S}{k_B \cdot T}}$"
                latex_equation = mathTex_to_QPixmap(latex_equation_text, 16)
                title = "For solubility"
                objectName = "solubility"
                coef1_name = "S_0"
                coef2_name = "E_S"
            elif name == "Kr":
                unit1 = "(m⁴/s)"
                # latex_equation = makeWidget.make_pixmap("ressources/latex_equation_combination_resized.png")
                latex_equation_text = \
                    r"$K_r = K_{r_0} \cdot e^{-\frac{E_r}{k_B \cdot T}}$"
                latex_equation = mathTex_to_QPixmap(latex_equation_text, 16)
                title = "For combination"  # todo: check translation
                objectName = "combination"
                coef1_name = "Kr_0"
                coef2_name = "E_r"
            equation_container.setTitle(title)
            equation_container.setObjectName(objectName)

            grid_data_coef = QWidget()
            grid_data_coef.layout = QGridLayout()
            grid_data_coef.setLayout(grid_data_coef.layout)

            grid_data_coef.layout.addWidget(latex_equation, 0, 0)
            grid_data_coef.layout.addWidget(QLabel(coef1_name), 1, 0)
            grid_data_coef.layout.addWidget(QLineEditWidthed(coef1, self.editable, "--------------"), 1, 1)
            grid_data_coef.layout.addWidget(QLabel(unit1), 1, 2)
            if self.editable:
                checkbox = QCheckBox("Take it into account")
                checkbox.setChecked(is_in_the_file)
                grid_data_coef.layout.addWidget(checkbox, 1, 4)
            grid_data_coef.layout.addWidget(QLabel(coef2_name), 2, 0)

            # eV
            coef2_line = QLineEditWidthed(coef2, self.editable, "--------------")
            grid_data_coef.layout.addWidget(coef2_line, 2, 1)
            grid_data_coef.layout.addWidget(QLabel(unit2[0]), 2, 2)

            # kJ/mol
            coef2kJmol_line = QLineEditWidthed(coef2kJmol, self.editable, "--------------")
            grid_data_coef.layout.addWidget(coef2kJmol_line, 2, 3)
            grid_data_coef.layout.addWidget(QLabel(unit2[1]), 2, 4)

            # automatic update
            coef2_line.setAutoUpdate(coef2kJmol_line, 1/0.0104)
            coef2kJmol_line.setAutoUpdate(coef2_line, 0.0104)

            textedit = QTextEdit(comment_content)
            textedit.setReadOnly(not self.editable)
            vbox = makeWidget.make_vbox(grid_data_coef, textedit)
            equation_container.setLayout(vbox.layout)
            equations_container.layout.addWidget(equation_container)
Beispiel #27
0
    def init_ui(self):
        # ouster lidar
        # self.os1 = OS1('10.5.5.66', '10.5.5.1', mode='2048x10')
        # self.os1.start()
        # self.unprocessed_packets = Queue()
        # self.beam_intrinsics = json.loads(self.os1.get_beam_intrinsics())
        # self.beam_alt_angles = self.beam_intrinsics['beam_altitude_angles']
        # self.beam_az_angles = self.beam_intrinsics['beam_azimuth_angles']
        # self.pc_handler = frame_handler(self.unprocessed_packets)
        # self.ind_list = np.array(range(1, 1024, 4))

        self.setWindowTitle(self.title)
        self.setGeometry(*self.bbox_window)
        # self.statusBar().showMessage('Message in statusbar.')
        control_panel_layout = QVBoxLayout()
        root_path = self.json_setting.get("kitti_root_path", "")
        self.w_root_path = QLineEdit(root_path)
        image_idx = self.json_setting.get("image_idx", "0")
        self.w_imgidx = QLineEdit(image_idx)
        det_path = self.json_setting.get("latest_det_path", "")
        self.w_det_path = QLineEdit(det_path)
        up_scale = self.json_setting.get("up_scale", "")
        self.w_up_scale = QLineEdit(up_scale)
        w_x_shift = self.json_setting.get("w_x_shift", "0")
        self.w_x_shift = QLineEdit(w_x_shift)
        w_y_shift = self.json_setting.get("w_y_shift", "0")
        self.w_y_shift = QLineEdit(w_y_shift)
        w_z_shift = self.json_setting.get("w_z_shift", "0")
        self.w_z_shift = QLineEdit(w_z_shift)

        # self.w_cmd = QLineEdit()
        # self.w_cmd.returnPressed.connect(self.on_CmdReturnPressed)
        self.w_load = QPushButton('load info')
        self.w_load.clicked.connect(self.on_loadButtonPressed)
        self.w_load_det = QPushButton('load detection')
        self.w_load_det.clicked.connect(self.on_loadDetPressed)
        self.w_config = KittiDrawControl('ctrl')
        config = self.json_setting.get("config", "")
        if config != "":
            self.w_config.loads(config)
        self.w_config.configChanged.connect(self.on_configchanged)
        self.w_plot = QPushButton('plot')
        self.w_plot.clicked.connect(self.on_plotButtonPressed)

        self.w_show_panel = QPushButton('control panel')
        self.w_show_panel.clicked.connect(self.on_panel_clicked)

        center_widget = QWidget(self)
        self.w_output = QTextEdit()
        self.w_config_gbox = QGroupBox("Read Config")
        layout = QFormLayout()
        layout.addRow(QLabel("root path:"), self.w_root_path)
        layout.addRow(QLabel("PC path:"), self.w_det_path)
        layout.addRow(QLabel("Up Scale:"), self.w_up_scale)
        layout.addRow(QLabel("x shift:"), self.w_x_shift)
        layout.addRow(QLabel("y shift:"), self.w_y_shift)
        layout.addRow(QLabel("z shift:"), self.w_z_shift)
        self.w_config_gbox.setLayout(layout)

        control_panel_layout.addWidget(self.w_config_gbox)
        h_layout = QHBoxLayout()
        h_layout.addWidget(self.w_load)
        control_panel_layout.addLayout(h_layout)

        h_layout = QHBoxLayout()
        control_panel_layout.addLayout(h_layout)
        control_panel_layout.addWidget(self.w_show_panel)

        vcfg_path = self.json_setting.get("latest_vxnet_cfg_path", "")
        self.w_vconfig_path = QLineEdit(vcfg_path)
        vckpt_path = self.json_setting.get("latest_vxnet_ckpt_path", "")
        self.w_vckpt_path = QLineEdit(vckpt_path)
        layout = QFormLayout()
        layout.addRow(QLabel("config path:"), self.w_vconfig_path)
        layout.addRow(QLabel("ckpt path:"), self.w_vckpt_path)
        control_panel_layout.addLayout(layout)
        self.w_build_net = QPushButton('Build Network')
        self.w_build_net.clicked.connect(self.on_BuildVxNetPressed)

        self.w_load_ckpt = QPushButton('load Network checkpoint')
        self.w_load_ckpt.clicked.connect(self.on_loadVxNetCkptPressed)
        h_layout = QHBoxLayout()
        h_layout.addWidget(self.w_build_net)
        h_layout.addWidget(self.w_load_ckpt)
        control_panel_layout.addLayout(h_layout)
        self.w_inference = QPushButton('Inference Network')
        self.w_inference.clicked.connect(self.on_InferenceVxNetPressed)
        control_panel_layout.addWidget(self.w_inference)
        self.w_load_infer = QPushButton('Load and Inference Network')
        self.w_load_infer.clicked.connect(self.on_LoadInferenceVxNetPressed)
        control_panel_layout.addWidget(self.w_load_infer)

        self.gt_combobox = QComboBox()
        self.gt_combobox.addItem("All")

        save_image_path = self.json_setting.get("save_image_path", "")
        self.w_image_save_path = QLineEdit(save_image_path)
        self.w_save_image = QPushButton('save image')
        self.w_save_image.clicked.connect(self.on_saveimg_clicked)
        control_panel_layout.addWidget(self.w_image_save_path)
        control_panel_layout.addWidget(self.w_save_image)
        control_panel_layout.addWidget(self.w_output)
        self.center_layout = QHBoxLayout()

        self.w_pc_viewer = KittiPointCloudView(
            self.w_config, coors_range=self.w_config.get("CoorsRange"))

        self.center_layout.addWidget(self.w_pc_viewer)
        self.center_layout.addLayout(control_panel_layout)
        self.center_layout.setStretch(0, 2)
        self.center_layout.setStretch(1, 1)
        center_widget.setLayout(self.center_layout)
        self.setCentralWidget(center_widget)
        self.show()
Beispiel #28
0
    def __init__(self, parent=None, status=None):
        QWidget.__init__(self, parent)
        self.title = translate('Settings', 'Tag Sources')

        label = QLabel(
            translate("WebDB", '&Display format for individual tracks.'))
        self._text = QLineEdit()
        label.setBuddy(self._text)

        albumlabel = QLabel(
            translate("WebDB", 'Display format for &retrieved albums'))
        self._albumdisp = QLineEdit()
        albumlabel.setBuddy(self._albumdisp)

        sortlabel = QLabel(
            translate("WebDB", 'Sort retrieved albums using order:'))
        self._sortoptions = QComboBox()
        sortlabel.setBuddy(self._sortoptions)
        editoptions = QPushButton(translate("Defaults", '&Edit'))
        editoptions.clicked.connect(self._editOptions)

        ua_label = QLabel(
            translate("WebDB", 'User-Agent to when accessing web sites.'))
        self._ua = QTextEdit()

        self.jfdi = QCheckBox(
            translate('Profile Editor', 'Brute force unmatched files.'))
        self.jfdi.setToolTip(
            translate(
                'Profile Editor',
                "<p>If a proper match isn't found for a file, the files "
                "will get sorted by filename, the retrieved tag sources "
                "by filename and corresponding (unmatched) tracks will "
                "matched.</p>"))

        self.matchFields = QLineEdit('artist, title')
        self.matchFields.setToolTip(
            translate(
                'Profile Editor',
                "<p>The fields listed here will be used in determining "
                "whether a track matches the retrieved track. Each "
                "field will be compared using a fuzzy matching algorithm. "
                "If the resulting average match percentage is greater "
                'than the "Minimum Percentage" it\'ll be considered to '
                "match.</p>"))

        self.albumBound = QSpinBox()
        self.albumBound.setToolTip(
            translate(
                'Profile Editor',
                "<p>The artist and album fields will be used in "
                "determining whether an album matches the retrieved one. "
                "Each field will be compared using a fuzzy matching "
                "algorithm. If the resulting average match percentage "
                "is greater or equal than what you specify here "
                "it'll be considered to match.</p>"))

        self.albumBound.setRange(0, 100)
        self.albumBound.setValue(70)

        self.trackBound = QSpinBox()
        self.trackBound.setRange(0, 100)
        self.trackBound.setValue(80)

        vbox = QVBoxLayout()
        vbox.addWidget(label)
        vbox.addWidget(self._text)

        vbox.addWidget(albumlabel)
        vbox.addWidget(self._albumdisp)

        vbox.addWidget(sortlabel)
        sortbox = QHBoxLayout()
        sortbox.addWidget(self._sortoptions, 1)
        sortbox.addWidget(editoptions)
        vbox.addLayout(sortbox)

        vbox.addWidget(ua_label)
        vbox.addWidget(self._ua)

        frame = QGroupBox(translate('WebDB', 'Automatic retrieval options'))

        auto_box = QVBoxLayout()
        frame.setLayout(auto_box)

        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor',
                          'Minimum &percentage required for album matches.'),
                self.albumBound))
        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor', 'Match tracks using &fields: '),
                self.matchFields))
        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor',
                          'Minimum percentage required for track match.'),
                self.trackBound))
        auto_box.addWidget(self.jfdi)

        vbox.addWidget(frame)

        vbox.addStretch()
        self.setLayout(vbox)
        self.loadSettings()
    def __init__(self, parent=None):
        super(VistaInserisciEsitoVisita, self).__init__(parent)
        self.controller = ControllerListaVisiteMediche()
        self.controller_clienti = ControllerListaClienti()

        self.stylesheet_window = """
                    QWidget{
                        background-color: #efefef;
                    }
                """

        self.stylesheet_label = """
                    QLabel{
                        background-color: transparent;
                    }

                    QComboBox{
                        background-color: white;
                        border: 1px solid grey;
                        color: black;
                    }

                    QLineEdit{
                        background-color: white;
                        border: 2px solid #dfdfdf
                    }

                    QTextEdit{
                        background-color: white;
                        border: 2px solid #dfdfdf
                    }
                """

        self.stylesheet_frame = """
                    QFrame{
                        border-radius: 15px;
                        background-color: white;
                        border: 2px solid #efefef;
                    }
                """

        self.stylesheet_button = """
                    QPushButton{
                        background-color: #cc3234;
                        color: white;
                        border-radius: 15px;
                    }

                    QPushButton::Pressed{
                        background-color: grey
                    }        
                """
        self.stylesheet_button_back = """
                         QPushButton{
                             border-radius: 15px;
                             background-color: transparent;
                         }

                         QPushButton::Pressed{
                             background-color: transparent;
                         }       
        """

        # Inserimento e impostazioni grafiche dell'immagine dello sfondo della finestra.
        self.imagePath = "Image/foto.png"
        self.image = QImage(self.imagePath)
        self.label = QLabel(self)
        self.label.setPixmap(QPixmap.fromImage(self.image))
        self.label.setScaledContents(True)
        self.label.setGeometry(0, 0, 1000, 450)

        # Inserimento e impostazioni grafiche dell'etichetta 'Inserisci Dati Esito'.
        self.label = QLabel(self)
        self.font = QFont("Arial", 18, QFont.Bold)
        self.label.setText("Inserisci Dati Esito")
        self.label.setFont(self.font)
        self.label.setStyleSheet(self.stylesheet_label)
        self.label.setGeometry(50, 55, 400, 40)

        # Inserimento e impostazioni grafiche del frame nella finestra.
        self.frame = QFrame(self)
        self.frame.setStyleSheet(self.stylesheet_frame)
        self.frame.setGeometry(50, 100, 900, 250)

        self.create_label("Seleziona cliente", 150)
        self.create_label("Descrizione", 250)

        # Inserimento e impostazioni grafiche del menù a tendina contenente la lista dei clienti.
        # La colonna dell'esito della visita potrà essere modificata solamente se il cliente
        # non ha ancora effettuato la visita e quindi non è presente alcun valore su 'Esito'.
        self.edit_cf_cliente = QComboBox(self)
        for visita in self.controller.get_lista_visite():
            self.controller_visita = ControllerVisitaMedica(visita)
            if self.controller_visita.get_esito() == "None":
                self.edit_cf_cliente.addItem(
                    self.controller_visita.get_cliente() + " - " +
                    self.controller_visita.get_data())
        self.edit_cf_cliente.setGeometry(250, 150, 250, 30)
        self.edit_cf_cliente.setStyleSheet(self.stylesheet_label)

        # Inserimento e impostazioni grafiche della casella di testo.
        self.edit_descrizione = QTextEdit(self)
        self.edit_descrizione.setGeometry(250, 250, 200, 50)
        self.edit_descrizione.setStyleSheet(self.stylesheet_label)

        # Inserimento e impostazioni grafiche dell'etichetta 'Esito'.
        self.label_edit = QLabel(self)
        self.label_edit.setText("Esito")
        self.label_edit.setGeometry(600, 150, 60, 20)
        self.label_edit.setStyleSheet(self.stylesheet_label)
        self.font_label = QFont("Times", 9)
        self.label_edit.setFont(self.font_label)

        # Inserimento e impostazioni grafiche del menù a tendina per selezionare l'esito della visita.
        self.edit_esito = QComboBox(self)
        self.edit_esito.addItem("IDONEO")
        self.edit_esito.addItem("NON IDONEO")
        self.edit_esito.setGeometry(670, 150, 110, 20)
        self.edit_esito.setStyleSheet(self.stylesheet_label)

        # Inserimento e impostazioni grafiche del bottone per confermare l'inserimento dell'esito.
        self.button_ricevuta = QPushButton(self)
        self.button_ricevuta.setText("Inserisci esito")
        self.font_button = QFont("Times", 11)
        self.button_ricevuta.setFont(self.font_button)
        self.button_ricevuta.setGeometry(800, 375, 150, 50)
        self.button_ricevuta.setStyleSheet(self.stylesheet_button)
        self.button_ricevuta.clicked.connect(self.go_ricevuta)

        # Inserimento e impostazioni grafiche del bottone per tornare alla vista precedente.
        self.button_back = QPushButton(self)
        self.button_back.setIcon(QIcon('Image/back.png'))
        self.button_back.setIconSize(QSize(65, 65))
        self.button_back.setGeometry(20, 375, 150, 50)
        self.button_back.setStyleSheet(self.stylesheet_button_back)
        self.button_back.clicked.connect(self.go_back)

        # Impostazioni grafiche generali della finestra del programma.
        self.setWindowTitle("Inserisci Esito")
        self.setStyleSheet(self.stylesheet_window)
        self.resize(1000, 450)
        self.setFixedSize(self.size())
Beispiel #30
0
    def initUI(self):
        NameLabel = QLabel("Name:", self)
        self.NameEdit = QLineEdit(self)
        AgeLabel = QLabel("Age:", self)
        self.AgeEdit = QLineEdit(self)
        ScoreLabel = QLabel("Score:", self)
        self.ScoreEdit = QLineEdit(self)

        inputHbox = QHBoxLayout()
        inputHbox.addStretch(1)
        inputHbox.addWidget(NameLabel)
        inputHbox.addWidget(self.NameEdit)
        inputHbox.addWidget(AgeLabel)
        inputHbox.addWidget(self.AgeEdit)
        inputHbox.addWidget(ScoreLabel)
        inputHbox.addWidget(self.ScoreEdit)

        AmountLabel = QLabel("Amount:", self)
        self.AmountEdit = QLineEdit(self)
        showLabel = QLabel("Key:", self)
        self.showKeyCombo = QComboBox(self)
        self.showKeyCombo.addItem("Name")
        self.showKeyCombo.addItem("Age")
        self.showKeyCombo.addItem("Score")

        input2Hbox = QHBoxLayout()
        input2Hbox.addStretch(1)
        input2Hbox.addWidget(AmountLabel)
        input2Hbox.addWidget(self.AmountEdit)
        input2Hbox.addWidget(showLabel)
        input2Hbox.addWidget(self.showKeyCombo)

        addButton = QPushButton("Add")
        addButton.clicked.connect(self.addClicked)

        delButton = QPushButton("Del")
        delButton.clicked.connect(self.delClicked)

        findButton = QPushButton("Find")
        findButton.clicked.connect(self.findClicked)

        incButton = QPushButton("Inc")
        incButton.clicked.connect(self.incClicked)

        showButton = QPushButton("show")
        showButton.clicked.connect(self.showClicked)

        commandHbox = QHBoxLayout()
        commandHbox.addStretch(2)
        commandHbox.addWidget(addButton)
        commandHbox.addWidget(delButton)
        commandHbox.addWidget(findButton)
        commandHbox.addWidget(incButton)
        commandHbox.addWidget(showButton)

        resultLabel = QLabel("Result:", self)
        self.resultEdit = QTextEdit()

        vbox = QVBoxLayout()
        vbox.addStretch(10)
        vbox.addLayout(inputHbox)
        vbox.addLayout(input2Hbox)
        vbox.addLayout(commandHbox)
        vbox.addWidget(resultLabel)
        vbox.addWidget(self.resultEdit)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 500, 250)
        self.setWindowTitle('Assignment6 using MVC')