def __init__(self, parent=None):
        super(PropulsionTestDialog, self).__init__(None)
        self._client = None
        self._propulsion_enable_button = QPushButton('propulsion enable')
        self._propulsion_disable_button = QPushButton('propulsion disable')
        self._motors_enable_button = QPushButton('motor enable')
        self._motors_disable_button = QPushButton('motors disable')
        self._left_pwm_spinbox = QSpinBox()
        self._left_pwm_spinbox.setRange(-100, 100)
        self._right_pwm_spinbox = QSpinBox()
        self._right_pwm_spinbox.setRange(-100, 100)
        self._set_pwm_button = QPushButton('set pwm')
        self._zero_pwm_button = QPushButton('zero pwm')

        self._position_steps_button = QPushButton('position steps')
        self._speed_steps_button = QPushButton('speed steps')
        self._yaw_rate_steps_button = QPushButton('yaw rate steps')
        self._yaw_steps_button = QPushButton('yaw steps')
        self._execute_rotation_button = QPushButton('rotation')
        self._execute_trajectory_button = QPushButton('trajectory')
        self._start_traj_edit_button = QPushButton('start_traj_edit')
        self._end_traj_edit_button = QPushButton('end_traj_edit')

        self._pose_x_edit = QLineEdit('0')
        self._pose_y_edit = QLineEdit('0')
        self._pose_yaw_edit = QLineEdit('0')
        self._button_set_pose = QPushButton('set pose')
        self._button_reposition = QPushButton('reposition')

        layout = QGridLayout()
        layout.addWidget(self._propulsion_enable_button, 0, 0)
        layout.addWidget(self._propulsion_disable_button, 0, 1)

        layout.addWidget(self._motors_enable_button, 1, 0)
        layout.addWidget(self._motors_disable_button, 1, 1)

        layout.addWidget(QLabel('left pwm'), 2, 0)
        layout.addWidget(self._left_pwm_spinbox, 3, 0)

        layout.addWidget(QLabel('right pwm'), 2, 1)
        layout.addWidget(self._right_pwm_spinbox, 3, 1)

        layout.addWidget(self._set_pwm_button, 4, 0)
        layout.addWidget(self._zero_pwm_button, 4, 1)

        #layout.addWidget(self._set_pwm_button,5,0)
        layout.addWidget(self._speed_steps_button, 5, 0)
        layout.addWidget(self._yaw_rate_steps_button, 5, 1)
        layout.addWidget(self._yaw_steps_button, 6, 1)
        layout.addWidget(self._position_steps_button, 6, 0)

        layout.addWidget(QLabel('x(mm)'), 7, 0)
        layout.addWidget(self._pose_x_edit, 7, 1)

        layout.addWidget(QLabel('y(mm)'), 8, 0)
        layout.addWidget(self._pose_y_edit, 8, 1)

        layout.addWidget(QLabel('yaw(deg)'), 9, 0)
        layout.addWidget(self._pose_yaw_edit, 9, 1)

        layout.addWidget(self._button_set_pose, 10, 0)
        layout.addWidget(self._button_reposition, 11, 0)

        # translation command
        self._execute_translation_button = QPushButton('translation')
        self._execute_translation_edit = QLineEdit('0')
        self._execute_translation_button.clicked.connect(
            self._execute_translation)

        layout.addWidget(self._execute_translation_button, 12, 0)
        layout.addWidget(self._execute_translation_edit, 12, 1)

        # rotation command
        self._execute_rotation_button = QPushButton('rotation')
        self._execute_rotation_edit = QLineEdit('0')
        self._execute_rotation_button.clicked.connect(self._execute_rotation)

        layout.addWidget(self._execute_rotation_button, 13, 0)
        layout.addWidget(self._execute_rotation_edit, 13, 1)

        layout.addWidget(self._start_traj_edit_button, 14, 0)
        layout.addWidget(self._end_traj_edit_button, 14, 1)
        layout.addWidget(self._execute_trajectory_button, 15, 0)

        self.setLayout(layout)

        self._propulsion_enable_button.clicked.connect(self._propulsion_enable)
        self._propulsion_disable_button.clicked.connect(
            self._propulsion_disable)
        self._motors_enable_button.clicked.connect(self._motors_enable)
        self._motors_disable_button.clicked.connect(self._motors_disable)
        self._set_pwm_button.clicked.connect(self._set_pwm)
        self._zero_pwm_button.clicked.connect(self._zero_pwm)

        self._position_steps_button.clicked.connect(self._position_steps)
        self._speed_steps_button.clicked.connect(self._speed_steps)
        self._yaw_rate_steps_button.clicked.connect(self._yaw_rate_steps)
        self._yaw_steps_button.clicked.connect(self._yaw_steps)

        self._button_set_pose.clicked.connect(self._set_pose)
        self._button_reposition.clicked.connect(self._reposition_forward)

        self._start_traj_edit_button.clicked.connect(self._start_traj_edit)
        self._end_traj_edit_button.clicked.connect(self._end_traj_edit)
        #self._execute_trajectory_button.clicked.connect(self._test_trajectory)
        self._execute_trajectory_button.clicked.connect(self._test_traj_goldo)

        self._telemetry_buffer = []
        self._current_telemetry = None
        self._current_telemetry_ex = None

        self._editing_traj = False
        self._traj_point_l = [(0.0, 0.0)]
Exemple #2
0
       def __init__(self):
           QDialog.__init__(self)
           
           grid = QGridLayout()
           grid.setSpacing(20)
           self.setWindowTitle("Opvragen Parameters")
           self.setWindowIcon(QIcon('./images/logos/logo.jpg'))
           
           self.setFont(QFont('Arial', 10))   
           
           self.Item = QLabel()
           q1Edit = QLineEdit(rppar[1])
           q1Edit.setCursorPosition(0)
           q1Edit.setFixedWidth(150)
           q1Edit.setFont(QFont("Arial",10))
           q1Edit.setDisabled(True)
                           
           self.Tarief = QLabel()
           q2Edit = QLineEdit(str(rppar[2]))
           q2Edit.setFixedWidth(100)
           q2Edit.setFont(QFont("Arial",10))
           q2Edit.setDisabled(True)
            
           self.Verrekening = QLabel()
           q3Edit = QLineEdit(rppar[3])
           q3Edit.setFixedWidth(200)
           q3Edit.setFont(QFont("Arial",10))
           q3Edit.setDisabled(True)
                                      
           self.Ondergrens = QLabel()
           q4Edit = QLineEdit(str(rppar[4]))
           q4Edit.setFixedWidth(100)
           q4Edit.setFont(QFont("Arial",10))
           q4Edit.setDisabled(True)
           
           self.Bovengrens = QLabel()
           q5Edit = QLineEdit(str(rppar[5]))
           q5Edit.setFixedWidth(100)
           q5Edit.setFont(QFont("Arial",10))
           q5Edit.setDisabled(True)
           
           self.Tarieffactor = QLabel()
           q6Edit = QLineEdit(str(rppar[8]))
           q6Edit.setFixedWidth(100)
           q6Edit.setFont(QFont("Arial",10))
           q6Edit.setDisabled(True)
 
           grid = QGridLayout()
           grid.setSpacing(20)
           
           lbl1 = QLabel('Parameternummer')  
           grid.addWidget(lbl1, 1, 0)
           
           lbl2 = QLabel(str(rppar[0]))
           grid.addWidget(lbl2, 1, 1)
                  
           lbl3 = QLabel('Item')  
           grid.addWidget(lbl3, 2, 0)
           grid.addWidget(q1Edit, 2, 1, 1, 2) 
                                                
           lbl4 = QLabel('Tarief')  
           grid.addWidget(lbl4, 3, 0)
           grid.addWidget(q2Edit, 3, 1)
           
           lbl5 = QLabel('Verrekening')  
           grid.addWidget(lbl5, 4, 0)
           grid.addWidget(q3Edit, 4, 1, 1, 2)
           
           lbl6 = QLabel('Ondergrens')  
           grid.addWidget(lbl6, 5, 0)
           grid.addWidget(q4Edit, 5, 1)
                          
           lbl7 = QLabel('Bovengrens')  
           grid.addWidget(lbl7, 6, 0)
           grid.addWidget(q5Edit, 6, 1)
           
           lbl8 = QLabel('Aanpassing')
           grid.addWidget(lbl8, 7, 0)
           lbl9 = QLabel(rppar[6])
           grid.addWidget(lbl9, 7, 1)
           
           lbl10 = QLabel('Lock: '+str(rppar[7]))
           grid.addWidget(lbl10, 7, 2)
           
           lbl11 = QLabel('Tarieffactor: ')
           grid.addWidget(lbl11, 8, 0)
           grid.addWidget(q6Edit, 8, 1)
                                   
           lbl = QLabel()
           pixmap = QPixmap('./images/logos/verbinding.jpg')
           lbl.setPixmap(pixmap)
           grid.addWidget(lbl, 0, 0, 1, 2)
             
           logo = QLabel()
           pixmap = QPixmap('./images/logos/logo.jpg')
           logo.setPixmap(pixmap)
           grid.addWidget(logo , 0, 2, 1 , 1, Qt.AlignRight)
                                           
           grid.addWidget(QLabel('\u00A9 2017 all rights reserved [email protected]'), 10, 0, 1, 3, Qt.AlignCenter)
             
           self.setLayout(grid)
           self.setGeometry(500, 300, 150, 150)
   
           applyBtn = QPushButton('Sluiten')
           applyBtn.clicked.connect(self.accept)
   
           grid.addWidget(applyBtn, 9, 2, 1, 1, Qt.AlignRight)
           applyBtn.setFont(QFont("Arial",10))
           applyBtn.setFixedWidth(100)
           applyBtn.setStyleSheet("color: black;  background-color: gainsboro")
    def initUI(self):

        self.view = CView(self)
        self.a = QPoint()
        print(self.mapToGlobal(QPoint(0, 0)))
        #### Sticker manager Group Area
        ManageGroup = QGroupBox("Manage Sticker")

        self.stickerLabel = QLabel("스티커 번호/종류")
        self.stickernumberManageBox = QComboBox()
        self.kindofstickerManageBox = QComboBox()

        self.stickernumberManageBox.setStyleSheet(
            "color:white;background:gray")

        self.stickernumberManageBox.addItems(
            ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
        #self.kindofstickerManageBox.addItems(stickerName)
        model = UserModel(list(zip(stickerName, stickerPath)))
        self.kindofstickerManageBox.setModel(model)

        self.makeButton = QPushButton("만들기")
        self.removeButton = QPushButton("지우기")

        Managelayout = QGridLayout()
        Managelayout.addWidget(self.stickerLabel, 0, 0)
        Managelayout.addWidget(self.stickernumberManageBox, 0, 1)
        Managelayout.addWidget(self.kindofstickerManageBox, 0, 2)
        Managelayout.addWidget(self.makeButton, 0, 3)
        Managelayout.addWidget(self.removeButton, 0, 4)

        ManageGroup.setLayout(Managelayout)
        #### Sticker manager Group Area

        #### Edit Group Area
        EditGroup = QGroupBox("Edit")
        self.currentEditLabel = QLabel("현재 편집중인 스티커 : " + str(currentSticker))

        opacityLabel = QLabel("투명도: ")
        sizeLabel = QLabel("  크기: ")

        self.opacity = QSlider(Qt.Horizontal, self)  #투명도 슬라이더
        self.size = QSlider(Qt.Horizontal, self)  #크기 슬라이더

        #각각 슬라이더의 최대 최소값
        self.opacity.setMaximum(100)
        self.opacity.setMinimum(0)
        self.size.setMaximum(479)
        self.size.setMinimum(20)

        Editlayout = QGridLayout()
        Editlayout.addWidget(self.currentEditLabel, 0, 0)
        Editlayout.addWidget(opacityLabel, 1, 1)
        Editlayout.addWidget(sizeLabel, 2, 1)
        Editlayout.addWidget(self.opacity, 1, 2)
        Editlayout.addWidget(self.size, 2, 2)

        EditGroup.setLayout(Editlayout)
        ##Edit Group Area

        ##Save Group Area
        SaveGroup = QGroupBox("Save")
        self.filename_ = QLabel("파일 명")
        self.savenameEdit = QLineEdit()
        self.saveButton = QPushButton("저장")

        Savelayout = QGridLayout()
        Savelayout.addWidget(self.filename_, 0, 0)
        Savelayout.addWidget(self.savenameEdit, 0, 1)
        Savelayout.addWidget(self.saveButton, 0, 2)

        SaveGroup.setLayout(Savelayout)
        ##Save Group Area

        ##Upload Group Area

        UploadGroup = QGroupBox("Upload")
        self.filename = QLabel("파일 명")
        self.filenameEdit = QLineEdit()
        self.uploadtitle = QLabel("글 제목")
        self.uploadtitleEdit = QLineEdit()
        self.uploadcontent = QLabel("글 내용")
        self.uploadcontentEdit = QLineEdit()
        self.uploadusername = QLabel("사용자 이름")
        self.uploadusernameEdit = QLineEdit()
        self.uploadButton = QPushButton("업로드")

        #내 블로그 해당 카테고리링크를 qlabel에 하이퍼링크로 걸기
        bloglink = QLabel(
            "<a href=\"mybloglink\">"
            "Click this link to go to my naverblog sticker category</a>")
        bloglink.setOpenExternalLinks(True)

        Uploadlayout = QGridLayout()
        Uploadlayout.addWidget(self.filename, 0, 0)
        Uploadlayout.addWidget(self.filenameEdit, 0, 1)
        Uploadlayout.addWidget(self.uploadtitle, 1, 0)
        Uploadlayout.addWidget(self.uploadtitleEdit, 1, 1)
        Uploadlayout.addWidget(self.uploadcontent, 2, 0)
        Uploadlayout.addWidget(self.uploadcontentEdit, 2, 1)
        Uploadlayout.addWidget(self.uploadusername, 3, 0)
        Uploadlayout.addWidget(self.uploadusernameEdit, 3, 1)
        Uploadlayout.addWidget(self.uploadButton, 4, 1)
        Uploadlayout.addWidget(bloglink, 5, 1)

        UploadGroup.setLayout(Uploadlayout)
        ##Upload Group Area

        self.removeButton.clicked.connect(self.view.removebuttonClicked)
        self.makeButton.clicked.connect(self.view.makebuttonClicked)
        self.saveButton.clicked.connect(self.view.savebuttonClicked)
        self.uploadButton.clicked.connect(self.view.uploadbuttonClicked)

        self.opacity.valueChanged.connect(self.view.OpsliderValueChanged)
        self.size.valueChanged.connect(self.view.sizesliderValueChanged)

        mainLayout = QGridLayout()

        mainLayout.addWidget(self.view, 0, 0, 4, 3)
        mainLayout.addWidget(ManageGroup, 0, 3)
        mainLayout.addWidget(EditGroup, 1, 3)
        mainLayout.addWidget(SaveGroup, 2, 3)
        mainLayout.addWidget(UploadGroup, 3, 3)
        self.setLayout(mainLayout)

        self.setWindowTitle('QPixmap')
        self.show()
        self.setFixedSize(self.width(), self.height())
Exemple #4
0
    def __init_meau_main__(self, *args):
        """
        主菜单栏
        :return:
        """
        # 窗口顶部主布局
        self.glayout_top = QGridLayout()
        self.glayout_main.addLayout(self.glayout_top, 1, 0, Qt.AlignTop)

        # 菜单栏 左侧
        self.glayout_meau = QGridLayout()
        self.glayout_top.addLayout(self.glayout_meau, 0, 0)
        self.meau_main = QMenuBar()
        self.meau_main.setFixedSize(100, 30)
        # self.meau_main.setWindowIcon(QIcon('{}/Ico/bg_img.png'.format(ROOTDIR)))
        self.glayout_meau.addWidget(self.meau_main, 0, 0, 1, 1)

        self.set_btn = QAction('设置', self.meau_main)
        self.set_btn.setText('设置')
        # meau.triggered.connect(self._test_ui)
        self.meau_main.addAction(self.set_btn)
        self.floder_btn = QAction('文件', self.meau_main)
        self.floder_btn.setText('文件')
        self.floder_btn.setToolTip('打开所有用户数据保存文件夹')
        self.floder_btn.triggered.connect(self.floder_btn_triggered)
        # meau.triggered.connect(self._test_ui)
        self.meau_main.addAction(self.floder_btn)

        # 返回按钮等
        self.btn_top_back = QToolButton()
        self.btn_top_back.setIcon(
            QIcon('{}/Ico/back.png'.format(ROOTDIR).format(ROOTDIR)))
        self.btn_top_back.setStyleSheet('*{width:22px;height:22px;border:0}')
        self.glayout_meau.addWidget(self.btn_top_back, 0, 1, 1, 1)
        self.btn_top_forward = QToolButton()
        self.btn_top_forward.setIcon(
            QIcon('{}/Ico/forward.png'.format(ROOTDIR).format(ROOTDIR)))
        self.btn_top_forward.setStyleSheet(
            '*{width:22px;height:22px;border:0}')
        self.glayout_meau.addWidget(self.btn_top_forward, 0, 2, 1, 1)

        self.btn_top_forward.setVisible(False)
        self.btn_top_back.setVisible(False)

        # 顶部中心
        self.glayout_top_center = QGridLayout()
        self.glayout_top.addLayout(self.glayout_top_center, 0, 1)

        self.label_top_center = QLabel()
        self.glayout_top_center.addWidget(self.label_top_center, 0, 1, 1, 1)
        self.label_top_center.setFixedHeight(25)
        # self.label_top_center.setMouseTracking(True)
        self.label_top_center.setAlignment(Qt.AlignCenter)

        # 顶部右侧
        self.glayout_top_right = QGridLayout()
        self.glayout_top.addLayout(self.glayout_top_right, 0, 2)

        self.label_top_right = ScrollLabel()
        self.label_top_right.setObjectName('label_top_right')
        # self.label_top_right.setText('label')
        self.label_top_right.setFixedWidth(150)
        self.label_top_right.setAlignment(Qt.AlignCenter)

        # self.label_top_show.setAutoFillBackground(True)
        self.label_top_right.setMouseTracking(True)
        self.glayout_top_right.addWidget(self.label_top_right, 0, 0, 1, 1)

        self.meau_widgets = [
            self.meau_main, self.btn_top_back, self.btn_top_forward,
            self.label_top_center, self.label_top_right
        ]
        color = (TopColor, random_color(mode='font'),
                 random_color(mode='background'), random_color(mode='font'))
        # self.meau_main.setStyleSheet("*{background-color:%s;color:%s;border:0;font:YaHei;} :pressed{background-color:%s;color:%s;}" % color)

        for widget in self.meau_widgets:
            widget.setFixedHeight(25)
            widget.setStyleSheet(
                "*{background-color:%s;color:%s;border:0;font:YaHei;} :pressed{background-color:%s;color:%s;}"
                % color)

        self.btn_top_forward.clicked.connect(self.btn_top_forward_clicked)
        self.btn_top_back.clicked.connect(self.btn_top_back_clicked)
Exemple #5
0
    def create_fee_controls(self):

        self.size_e = TxSizeLabel()
        self.size_e.setAlignment(Qt.AlignCenter)
        self.size_e.setAmount(0)
        self.size_e.setStyleSheet(ColorScheme.DEFAULT.as_stylesheet())

        self.feerate_e = FeerateEdit(lambda: 0)
        self.feerate_e.setAmount(self.config.fee_per_byte())
        self.feerate_e.textEdited.connect(
            partial(self.on_fee_or_feerate, self.feerate_e, False))
        self.feerate_e.editingFinished.connect(
            partial(self.on_fee_or_feerate, self.feerate_e, True))

        self.fee_e = BTCAmountEdit(self.main_window.get_decimal_point)
        self.fee_e.textEdited.connect(
            partial(self.on_fee_or_feerate, self.fee_e, False))
        self.fee_e.editingFinished.connect(
            partial(self.on_fee_or_feerate, self.fee_e, True))

        self.fee_e.textChanged.connect(self.entry_changed)
        self.feerate_e.textChanged.connect(self.entry_changed)

        self.fee_slider = FeeSlider(self, self.config,
                                    self.fee_slider_callback)
        self.fee_combo = FeeComboBox(self.fee_slider)
        self.fee_slider.setFixedWidth(self.fee_e.width())

        def feerounding_onclick():
            text = (
                self.feerounding_text + '\n\n' +
                _('To somewhat protect your privacy, Electrum tries to create change with similar precision to other outputs.'
                  ) + ' ' +
                _('At most 100 satoshis might be lost due to this rounding.') +
                ' ' + _("You can disable this setting in '{}'.").format(
                    _('Preferences')) + '\n' +
                _('Also, dust is not kept as change, but added to the fee.') +
                '\n' +
                _('Also, when batching RBF transactions, BIP 125 imposes a lower bound on the fee.'
                  ))
            self.show_message(title=_('Fee rounding'), msg=text)

        self.feerounding_icon = QToolButton()
        self.feerounding_icon.setIcon(read_QIcon('info.png'))
        self.feerounding_icon.setAutoRaise(True)
        self.feerounding_icon.clicked.connect(feerounding_onclick)
        self.feerounding_icon.setVisible(False)

        self.feecontrol_fields = QWidget()
        hbox = QHBoxLayout(self.feecontrol_fields)
        hbox.setContentsMargins(0, 0, 0, 0)
        grid = QGridLayout()
        grid.addWidget(QLabel(_("Target fee:")), 0, 0)
        grid.addWidget(self.feerate_e, 0, 1)
        grid.addWidget(self.size_e, 0, 2)
        grid.addWidget(self.fee_e, 0, 3)
        grid.addWidget(self.feerounding_icon, 0, 4)
        grid.addWidget(self.fee_slider, 1, 1)
        grid.addWidget(self.fee_combo, 1, 2)
        hbox.addLayout(grid)
        hbox.addStretch(1)
    def __init__(self, parent=None, result=None):
        super().__init__(parent)

        self._result = result
        self.only_main_states = False

        self._grid = QGridLayout()

        self._plotS21 = PlotWidget(parent=None, toolbar=True)
        self._plotVswrIn = PlotWidget(parent=None, toolbar=True)
        self._plotVswrOut = PlotWidget(parent=None, toolbar=True)

        self._grid.addWidget(self._plotS21, 0, 0)
        self._grid.addWidget(self._plotVswrIn, 0, 1)
        self._grid.addWidget(self._plotVswrOut, 1, 0)

        self._win = pg.GraphicsLayoutWidget(show=True)
        self._win.setBackground('w')
        self._testPlot = self._win.addPlot(row=1, col=0)
        self._label = pg.LabelItem(justify='right')
        self._win.addItem(self._label, row=0, col=0)
        self._grid.addWidget(self._win, 1, 1)

        # https://www.learnpyqt.com/tutorials/plotting-pyqtgraph/
        # https://pyqtgraph.readthedocs.io/en/latest/introduction.html#what-is-pyqtgraph
        # matplotlib colors ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']
        self._data1 = [30, 32, 34, 32, 33, 31, 29, 32, 35, 45]
        self._data2 = [50, 35, 44, 22, 38, 32, 27, 38, 32, 44]
        self._curve1 = pg.PlotCurveItem([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
                                        self._data1,
                                        pen=pg.mkPen(
                                            color='#1f77b4',
                                            width=2,
                                        ),
                                        symbol='o',
                                        symbolSize=5,
                                        symbolBrush='#1f77b4',
                                        name='test plot 1')
        self._curve2 = pg.PlotCurveItem([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
                                        self._data2,
                                        pen=pg.mkPen(
                                            color='#ff7f0e',
                                            width=2,
                                        ),
                                        symbol='o',
                                        symbolSize=5,
                                        symbolBrush='#ff7f0e',
                                        name='test plot 2')
        self._testPlot.addItem(self._curve1)
        self._testPlot.addItem(self._curve2)
        style = {'color': 'k', 'font-size': '15px'}
        self._testPlot.setLabel('left', 'y-s', **style)
        self._testPlot.setLabel('bottom', 'x-es', **style)

        self._testPlot.setXRange(0, 11, padding=0)
        self._testPlot.setYRange(20, 55, padding=0)
        self._testPlot.enableAutoRange('x')
        self._testPlot.enableAutoRange('y')

        self._testPlot.addLegend()
        self._testPlot.showGrid(x=True, y=True)

        self._vb = self._testPlot.vb
        self._vLine = pg.InfiniteLine(angle=90, movable=False)
        self._hLine = pg.InfiniteLine(angle=0, movable=False)
        self._testPlot.addItem(self._vLine, ignoreBounds=True)
        self._testPlot.addItem(self._hLine, ignoreBounds=True)
        self._proxy = pg.SignalProxy(self._testPlot.scene().sigMouseMoved,
                                     rateLimit=60,
                                     slot=self.mouseMoved)

        self.setLayout(self._grid)

        self._init()
Exemple #7
0
 def __init__(self, *args):
     super(HorizontalGroup, self).__init__(*args)
     self.internal_layout = QGridLayout()
     self.setLayout(self.internal_layout)
Exemple #8
0
    def __init__(self, window, plugin, keystore, device_id):
        title = _("{} Settings").format(plugin.device)
        super(SettingsDialog, self).__init__(window, title)
        self.setMaximumWidth(540)

        devmgr = plugin.device_manager()
        config = devmgr.config
        handler = keystore.handler
        thread = keystore.thread
        hs_cols, hs_rows = (128, 64)

        def invoke_client(method, *args, **kw_args):
            unpair_after = kw_args.pop('unpair_after', False)

            def task():
                client = devmgr.client_by_id(device_id)
                if not client:
                    raise RuntimeError("Device not connected")
                if method:
                    getattr(client, method)(*args, **kw_args)
                if unpair_after:
                    devmgr.unpair_id(device_id)
                return client.features

            thread.add(task, on_success=update)

        def update(features):
            self.features = features
            set_label_enabled()
            if features.bootloader_hash:
                bl_hash = bh2u(features.bootloader_hash)
                bl_hash = "\n".join([bl_hash[:32], bl_hash[32:]])
            else:
                bl_hash = "N/A"
            noyes = [_("No"), _("Yes")]
            endis = [_("Enable Passphrases"), _("Disable Passphrases")]
            disen = [_("Disabled"), _("Enabled")]
            setchange = [_("Set a PIN"), _("Change PIN")]

            version = "%d.%d.%d" % (features.major_version,
                                    features.minor_version,
                                    features.patch_version)

            device_label.setText(features.label)
            pin_set_label.setText(noyes[features.pin_protection])
            passphrases_label.setText(disen[features.passphrase_protection])
            bl_hash_label.setText(bl_hash)
            label_edit.setText(features.label)
            device_id_label.setText(features.device_id)
            initialized_label.setText(noyes[features.initialized])
            version_label.setText(version)
            clear_pin_button.setVisible(features.pin_protection)
            clear_pin_warning.setVisible(features.pin_protection)
            pin_button.setText(setchange[features.pin_protection])
            pin_msg.setVisible(not features.pin_protection)
            passphrase_button.setText(endis[features.passphrase_protection])
            language_label.setText(features.language)

        def set_label_enabled():
            label_apply.setEnabled(label_edit.text() != self.features.label)

        def rename():
            invoke_client('change_label', label_edit.text())

        def toggle_passphrase():
            title = _("Confirm Toggle Passphrase Protection")
            currently_enabled = self.features.passphrase_protection
            if currently_enabled:
                msg = _("After disabling passphrases, you can only pair this "
                        "Electrum-DOI wallet if it had an empty passphrase.  "
                        "If its passphrase was not empty, you will need to "
                        "create a new wallet with the install wizard.  You "
                        "can use this wallet again at any time by re-enabling "
                        "passphrases and entering its passphrase.")
            else:
                msg = _(
                    "Your current Electrum-DOI wallet can only be used with "
                    "an empty passphrase.  You must create a separate "
                    "wallet with the install wizard for other passphrases "
                    "as each one generates a new set of addresses.")
            msg += "\n\n" + _("Are you sure you want to proceed?")
            if not self.question(msg, title=title):
                return
            invoke_client('toggle_passphrase', unpair_after=currently_enabled)

        def change_homescreen():
            dialog = QFileDialog(self, _("Choose Homescreen"))
            filename, __ = dialog.getOpenFileName()
            if not filename:
                return  # user cancelled

            if filename.endswith('.toif'):
                img = open(filename, 'rb').read()
                if img[:8] != b'TOIf\x90\x00\x90\x00':
                    handler.show_error(
                        'File is not a TOIF file with size of 144x144')
                    return
            else:
                from PIL import Image  # FIXME
                im = Image.open(filename)
                if im.size != (128, 64):
                    handler.show_error('Image must be 128 x 64 pixels')
                    return
                im = im.convert('1')
                pix = im.load()
                img = bytearray(1024)
                for j in range(64):
                    for i in range(128):
                        if pix[i, j]:
                            o = (i + j * 128)
                            img[o // 8] |= (1 << (7 - o % 8))
                img = bytes(img)
            invoke_client('change_homescreen', img)

        def clear_homescreen():
            invoke_client('change_homescreen', b'\x00')

        def set_pin():
            invoke_client('set_pin', remove=False)

        def clear_pin():
            invoke_client('set_pin', remove=True)

        def wipe_device():
            wallet = window.wallet
            if wallet and sum(wallet.get_balance()):
                title = _("Confirm Device Wipe")
                msg = _("Are you SURE you want to wipe the device?\n"
                        "Your wallet still has namecoins in it!")
                if not self.question(
                        msg, title=title, icon=QMessageBox.Critical):
                    return
            invoke_client('wipe_device', unpair_after=True)

        def slider_moved():
            mins = timeout_slider.sliderPosition()
            timeout_minutes.setText(_("{:2d} minutes").format(mins))

        def slider_released():
            config.set_session_timeout(timeout_slider.sliderPosition() * 60)

        # Information tab
        info_tab = QWidget()
        info_layout = QVBoxLayout(info_tab)
        info_glayout = QGridLayout()
        info_glayout.setColumnStretch(2, 1)
        device_label = QLabel()
        pin_set_label = QLabel()
        passphrases_label = QLabel()
        version_label = QLabel()
        device_id_label = QLabel()
        bl_hash_label = QLabel()
        bl_hash_label.setWordWrap(True)
        language_label = QLabel()
        initialized_label = QLabel()
        rows = [
            (_("Device Label"), device_label),
            (_("PIN set"), pin_set_label),
            (_("Passphrases"), passphrases_label),
            (_("Firmware Version"), version_label),
            (_("Device ID"), device_id_label),
            (_("Bootloader Hash"), bl_hash_label),
            (_("Language"), language_label),
            (_("Initialized"), initialized_label),
        ]
        for row_num, (label, widget) in enumerate(rows):
            info_glayout.addWidget(QLabel(label), row_num, 0)
            info_glayout.addWidget(widget, row_num, 1)
        info_layout.addLayout(info_glayout)

        # Settings tab
        settings_tab = QWidget()
        settings_layout = QVBoxLayout(settings_tab)
        settings_glayout = QGridLayout()

        # Settings tab - Label
        label_msg = QLabel(
            _("Name this {}.  If you have multiple devices "
              "their labels help distinguish them.").format(plugin.device))
        label_msg.setWordWrap(True)
        label_label = QLabel(_("Device Label"))
        label_edit = QLineEdit()
        label_edit.setMinimumWidth(150)
        label_edit.setMaxLength(plugin.MAX_LABEL_LEN)
        label_apply = QPushButton(_("Apply"))
        label_apply.clicked.connect(rename)
        label_edit.textChanged.connect(set_label_enabled)
        settings_glayout.addWidget(label_label, 0, 0)
        settings_glayout.addWidget(label_edit, 0, 1, 1, 2)
        settings_glayout.addWidget(label_apply, 0, 3)
        settings_glayout.addWidget(label_msg, 1, 1, 1, -1)

        # Settings tab - PIN
        pin_label = QLabel(_("PIN Protection"))
        pin_button = QPushButton()
        pin_button.clicked.connect(set_pin)
        settings_glayout.addWidget(pin_label, 2, 0)
        settings_glayout.addWidget(pin_button, 2, 1)
        pin_msg = QLabel(
            _("PIN protection is strongly recommended.  "
              "A PIN is your only protection against someone "
              "stealing your namecoins if they obtain physical "
              "access to your {}.").format(plugin.device))
        pin_msg.setWordWrap(True)
        pin_msg.setStyleSheet("color: red")
        settings_glayout.addWidget(pin_msg, 3, 1, 1, -1)

        # Settings tab - Homescreen
        homescreen_label = QLabel(_("Homescreen"))
        homescreen_change_button = QPushButton(_("Change..."))
        homescreen_clear_button = QPushButton(_("Reset"))
        homescreen_change_button.clicked.connect(change_homescreen)
        try:
            import PIL
        except ImportError:
            homescreen_change_button.setDisabled(True)
            homescreen_change_button.setToolTip(
                _("Required package 'PIL' is not available - Please install it."
                  ))
        homescreen_clear_button.clicked.connect(clear_homescreen)
        homescreen_msg = QLabel(
            _("You can set the homescreen on your "
              "device to personalize it.  You must "
              "choose a {} x {} monochrome black and "
              "white image.").format(hs_cols, hs_rows))
        homescreen_msg.setWordWrap(True)
        settings_glayout.addWidget(homescreen_label, 4, 0)
        settings_glayout.addWidget(homescreen_change_button, 4, 1)
        settings_glayout.addWidget(homescreen_clear_button, 4, 2)
        settings_glayout.addWidget(homescreen_msg, 5, 1, 1, -1)

        # Settings tab - Session Timeout
        timeout_label = QLabel(_("Session Timeout"))
        timeout_minutes = QLabel()
        timeout_slider = QSlider(Qt.Horizontal)
        timeout_slider.setRange(1, 60)
        timeout_slider.setSingleStep(1)
        timeout_slider.setTickInterval(5)
        timeout_slider.setTickPosition(QSlider.TicksBelow)
        timeout_slider.setTracking(True)
        timeout_msg = QLabel(
            _("Clear the session after the specified period "
              "of inactivity.  Once a session has timed out, "
              "your PIN and passphrase (if enabled) must be "
              "re-entered to use the device."))
        timeout_msg.setWordWrap(True)
        timeout_slider.setSliderPosition(config.get_session_timeout() // 60)
        slider_moved()
        timeout_slider.valueChanged.connect(slider_moved)
        timeout_slider.sliderReleased.connect(slider_released)
        settings_glayout.addWidget(timeout_label, 6, 0)
        settings_glayout.addWidget(timeout_slider, 6, 1, 1, 3)
        settings_glayout.addWidget(timeout_minutes, 6, 4)
        settings_glayout.addWidget(timeout_msg, 7, 1, 1, -1)
        settings_layout.addLayout(settings_glayout)
        settings_layout.addStretch(1)

        # Advanced tab
        advanced_tab = QWidget()
        advanced_layout = QVBoxLayout(advanced_tab)
        advanced_glayout = QGridLayout()

        # Advanced tab - clear PIN
        clear_pin_button = QPushButton(_("Disable PIN"))
        clear_pin_button.clicked.connect(clear_pin)
        clear_pin_warning = QLabel(
            _("If you disable your PIN, anyone with physical access to your "
              "{} device can spend your namecoins.").format(plugin.device))
        clear_pin_warning.setWordWrap(True)
        clear_pin_warning.setStyleSheet("color: red")
        advanced_glayout.addWidget(clear_pin_button, 0, 2)
        advanced_glayout.addWidget(clear_pin_warning, 1, 0, 1, 5)

        # Advanced tab - toggle passphrase protection
        passphrase_button = QPushButton()
        passphrase_button.clicked.connect(toggle_passphrase)
        passphrase_msg = WWLabel(PASSPHRASE_HELP)
        passphrase_warning = WWLabel(PASSPHRASE_NOT_PIN)
        passphrase_warning.setStyleSheet("color: red")
        advanced_glayout.addWidget(passphrase_button, 3, 2)
        advanced_glayout.addWidget(passphrase_msg, 4, 0, 1, 5)
        advanced_glayout.addWidget(passphrase_warning, 5, 0, 1, 5)

        # Advanced tab - wipe device
        wipe_device_button = QPushButton(_("Wipe Device"))
        wipe_device_button.clicked.connect(wipe_device)
        wipe_device_msg = QLabel(
            _("Wipe the device, removing all data from it.  The firmware "
              "is left unchanged."))
        wipe_device_msg.setWordWrap(True)
        wipe_device_warning = QLabel(
            _("Only wipe a device if you have the recovery seed written down "
              "and the device wallet(s) are empty, otherwise the namecoins "
              "will be lost forever."))
        wipe_device_warning.setWordWrap(True)
        wipe_device_warning.setStyleSheet("color: red")
        advanced_glayout.addWidget(wipe_device_button, 6, 2)
        advanced_glayout.addWidget(wipe_device_msg, 7, 0, 1, 5)
        advanced_glayout.addWidget(wipe_device_warning, 8, 0, 1, 5)
        advanced_layout.addLayout(advanced_glayout)
        advanced_layout.addStretch(1)

        tabs = QTabWidget(self)
        tabs.addTab(info_tab, _("Information"))
        tabs.addTab(settings_tab, _("Settings"))
        tabs.addTab(advanced_tab, _("Advanced"))
        dialog_vbox = QVBoxLayout(self)
        dialog_vbox.addWidget(tabs)
        dialog_vbox.addLayout(Buttons(CloseButton(self)))

        # Update information
        invoke_client(None)
Exemple #9
0
    def init_ui(self):
        setting_pacs_button = QToolButton()
        setting_pacs_button.setIcon(QIcon('src/icon/settings_pacs_button.ico'))
        setting_pacs_button.clicked.connect(self.pacs_setting_view.show)

        pacs_list = QComboBox()  # get list of pacs
        pacs_list.addItems(['All PACS location'])

        modalities_list = QComboBox()  # get list modalities
        modalities_list.addItems(['All modalities'])

        self.list_param_search_name.addItems([
            'Patient name',
            'Patient ID',
            'Accession number',
            'Study description',
            'Referring physician',
            # 'Performing physician',
            # 'Reading physician',
            'Institute name'
        ])

        search_button = QPushButton('Search')
        search_button.clicked.connect(self.start_search)
        clear_button = QPushButton('Clear')
        clear_button.clicked.connect(self.param_search_value.clear)
        # clear_button.clicked.connect(self.patient_list_widget.setRowCount)

        settings_grid_layout = QGridLayout()
        settings_grid_layout.addWidget(setting_pacs_button, 0, 0)
        settings_grid_layout.addWidget(pacs_list, 0, 1)
        settings_grid_layout.addWidget(modalities_list, 0, 2)
        settings_grid_layout.addWidget(self.list_param_search_name, 1, 0, 1, 2)
        settings_grid_layout.addWidget(self.param_search_value, 1, 2, 1, 3)
        settings_grid_layout.addWidget(search_button, 1, 5)
        settings_grid_layout.addWidget(clear_button, 1, 6)

        vertical_layout = QVBoxLayout()
        vertical_layout.addLayout(settings_grid_layout)
        # vertical_layout.addStretch(1)

        self.patient_list_widget.setHorizontalHeaderLabels([
            'Study date',
            'Patient name',
            'Birth date',
            'Patient ID',
            'Study description',
            'Accession number ',
            'Referring physician',
            # 'Physicians reading',
            'Institution name',
            # 'Performing physician'
        ])
        self.patient_list_widget.resizeColumnsToContents()
        self.patient_list_widget.update()

        vertical_layout.addWidget(self.patient_list_widget)

        # Test
        button_test = QPushButton('Load')
        lay_out_test = QHBoxLayout()
        lay_out_test.addStretch(1)
        lay_out_test.addWidget(button_test)
        vertical_layout.addLayout(lay_out_test)

        self.setLayout(vertical_layout)
Exemple #10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.resize(700, 105)
        self.setMinimumWidth(700)

        # Widgets
        self.work_type = QComboBox(self)
        self.work_type.setToolTip('Тип работы')
        self.work_type.addItems(work_types)
        self.work_type.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.Preferred)
        self.lesson = QComboBox(self)
        self.lesson.setToolTip('Урок')
        self.lesson.addItems(school_lessons)
        self.lesson.setSizePolicy(QSizePolicy.MinimumExpanding,
                                  QSizePolicy.Preferred)
        actuality_label = QLabel('Дата начала', self)
        self.actuality = QDateEdit(self)
        self.actuality.setDate(date.today())
        self.actuality.setMinimumDate(date(2017, 9, 1))
        self.actuality.setToolTip('Дата начала')
        deadline_label = QLabel('Дата окончания', self)
        self.deadline = QDateEdit(self)
        self.deadline.setDate(date.today() + timedelta(1))
        self.deadline.setMinimumDate(date.today())
        self.deadline.setToolTip('Дата окончания')
        priority_label = QLabel('Приоритет', self)
        self.priority = QDoubleSpinBox(self)
        # self.priority.setMaximumWidth(80)
        self.priority.setMaximum(1.0)
        self.priority.setSingleStep(0.01)
        self.priority.setValue(0.5)
        self.priority.setToolTip('Приоритет')
        time_label = QLabel('Время выполнения', self)
        self.time = QTimeEdit(self)
        # self.time.setMaximumWidth(80)
        self.time.setDisplayFormat('HH:mm')
        self.time.setToolTip('Время выполнения')
        self.add_button = QPushButton('Добавить', self)
        self.add_button.setToolTip('Добавить в список')

        # Layouts
        actuality_layout = QHBoxLayout()
        actuality_layout.setSizeConstraint(QHBoxLayout.SetFixedSize)
        actuality_layout.addWidget(actuality_label)
        actuality_layout.addWidget(self.actuality)
        deadline_layout = QHBoxLayout()
        deadline_layout.setSizeConstraint(QHBoxLayout.SetFixedSize)
        deadline_layout.addWidget(deadline_label)
        deadline_layout.addWidget(self.deadline)
        priority_layout = QHBoxLayout()
        priority_layout.setSizeConstraint(QHBoxLayout.SetFixedSize)
        priority_layout.addWidget(priority_label)
        priority_layout.addWidget(self.priority)
        time_layout = QHBoxLayout()
        time_layout.setSizeConstraint(QHBoxLayout.SetFixedSize)
        time_layout.addWidget(time_label)
        time_layout.addWidget(self.time)
        layout = QGridLayout(self)
        layout.addWidget(self.lesson, 0, 0)
        layout.addWidget(self.work_type, 1, 0)
        layout.addLayout(actuality_layout, 0, 2)
        layout.addLayout(deadline_layout, 1, 2)
        layout.addLayout(time_layout, 0, 3)
        layout.addLayout(priority_layout, 1, 3)
        layout.addWidget(self.add_button, 2, 3)

        # Tab order
        self.setTabOrder(self.lesson, self.work_type)
        self.setTabOrder(self.work_type, self.actuality)
        self.setTabOrder(self.actuality, self.deadline)
        self.setTabOrder(self.deadline, self.time)
        self.setTabOrder(self.time, self.priority)
        self.setTabOrder(self.priority, self.add_button)
Exemple #11
0
    def personal_details(self):
        group_box = QGroupBox()
        grid = QGridLayout()
        group_box.setLayout(grid)

        group_box.setTitle("Personal Details")

        # for views containing school detail of student
        pd_view = QHBoxLayout()
        pd_detail_view = QGridLayout()

        grid.addLayout(pd_view, 0, 0, 1, 0)

        pd_view.addLayout(pd_detail_view)
        pd_view.addWidget(self.comp.profile_pic)

        pd_detail_view.addWidget(self.comp.l_name, 0, 0)
        l_name_text = QLabel()
        pd_detail_view.addWidget(l_name_text, 0, 1)
        l_name_text.setText(self.profile["last_name"])

        pd_detail_view.addWidget(self.comp.m_name, 1, 0)
        m_name_text = QLabel()
        pd_detail_view.addWidget(m_name_text, 1, 1)
        m_name_text.setText(self.profile["middle_name"])

        pd_detail_view.addWidget(self.comp.f_name, 2, 0)
        f_name_text = QLabel()
        pd_detail_view.addWidget(f_name_text, 2, 1)
        f_name_text.setText(self.profile["first_name"])

        pd_detail_view.addWidget(self.comp.profession, 3, 0)
        profession_text = QLabel()
        pd_detail_view.addWidget(profession_text, 3, 1)
        profession_text.setText(self.profile["profession"])

        pd_detail_view.addWidget(self.comp.age, 4, 0)
        age_text = QLabel()
        pd_detail_view.addWidget(age_text, 4, 1)
        age_text.setText(str(self.profile["age"]))

        r = requests.get(url=self.profile["pic"], stream=True)

        pic = QImage()
        pic.loadFromData(r.content)

        self.comp.profile_pic.setPixmap(QPixmap.fromImage(pic))

        grid.addWidget(self.comp.dob_label, 1, 0)
        dob_text = QLabel()
        grid.addWidget(dob_text, 1, 1)
        dob_text.setText(str(self.profile["date_of_birth"]))

        grid.addWidget(self.comp.gender, 2, 0)
        gender_text = QLabel()
        grid.addWidget(gender_text, 2, 1)
        gender_text.setText(self.profile["gender"])

        grid.addWidget(self.comp.nationality, 3, 0)
        nationality_text = QLabel()
        grid.addWidget(nationality_text, 3, 1)
        nationality_text.setText(self.profile["nationality"])

        grid.addWidget(self.comp.state_origin, 4, 0)
        state_origin_text = QLabel()
        grid.addWidget(state_origin_text, 4, 1)
        state_origin_text.setText(self.profile["state_of_origin"])

        grid.addWidget(self.comp.lga_origin, 5, 0)
        lga_origin_text = QLabel()
        grid.addWidget(lga_origin_text, 5, 1)
        lga_origin_text.setText(self.profile["lga_origin"])

        grid.addWidget(self.comp.marital, 6, 0)
        marital_text = QLabel()
        grid.addWidget(marital_text, 6, 1)
        marital_text.setText(self.profile["marital_status"])

        self.vbox.addWidget(group_box)
    def __init__(self, templateDirectory):
        super().__init__()
        self.templateDirectory = templateDirectory
        self.setWindowTitle(i18n("Create new template"))
        self.setLayout(QVBoxLayout())
        buttons = QDialogButtonBox(QDialogButtonBox.Ok
                                   | QDialogButtonBox.Cancel)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        mainWidget = QWidget()
        self.layout().addWidget(mainWidget)
        self.layout().addWidget(buttons)
        mainWidget.setLayout(QHBoxLayout())
        explanation = QLabel(
            i18n(
                "This allows you to make a template document with guides.\nThe width and height are the size of the live-area, the safe area is the live area minus the margins, and the full image is the live area plus the bleeds."
            ))
        explanation.setWordWrap(True)
        elements = QWidget()
        elements.setLayout(QVBoxLayout())
        mainWidget.layout().addWidget(elements)
        elements.layout().addWidget(explanation)

        self.templateName = QLineEdit()
        elements.layout().addWidget(self.templateName)

        self.DPI = QSpinBox()
        self.DPI.setMaximum(1200)
        self.DPI.setValue(300)
        self.spn_width = QDoubleSpinBox()
        self.spn_width.setMaximum(10000)
        self.spn_height = QDoubleSpinBox()
        self.spn_height.setMaximum(10000)
        self.widthUnit = simpleUnitBox()
        self.heightUnit = simpleUnitBox()

        widgetSize = QWidget()
        sizeForm = QFormLayout()
        sizeForm.addRow(i18n("DPI:"), self.DPI)
        widthLayout = QHBoxLayout()
        widthLayout.addWidget(self.spn_width)
        widthLayout.addWidget(self.widthUnit)
        sizeForm.addRow(i18n("Width:"), widthLayout)
        heightLayout = QHBoxLayout()
        heightLayout.addWidget(self.spn_height)
        heightLayout.addWidget(self.heightUnit)
        sizeForm.addRow(i18n("Height:"), heightLayout)
        widgetSize.setLayout(sizeForm)
        elements.layout().addWidget(widgetSize)

        marginAndBleed = QTabWidget()
        elements.layout().addWidget(marginAndBleed)

        margins = QWidget()
        marginForm = QGridLayout()
        margins.setLayout(marginForm)
        self.marginLeft = QDoubleSpinBox()
        self.marginLeft.setMaximum(1000)
        self.marginLeftUnit = simpleUnitBox()
        self.marginRight = QDoubleSpinBox()
        self.marginRight.setMaximum(1000)
        self.marginRightUnit = simpleUnitBox()
        self.marginTop = QDoubleSpinBox()
        self.marginTop.setMaximum(1000)
        self.marginTopUnit = simpleUnitBox()
        self.marginBottom = QDoubleSpinBox()
        self.marginBottom.setMaximum(1000)
        self.marginBottomUnit = simpleUnitBox()
        marginForm.addWidget(QLabel(i18n("Left:")), 0, 0, Qt.AlignRight)
        marginForm.addWidget(self.marginLeft, 0, 1)
        marginForm.addWidget(self.marginLeftUnit, 0, 2)
        marginForm.addWidget(QLabel(i18n("Top:")), 1, 0, Qt.AlignRight)
        marginForm.addWidget(self.marginTop, 1, 1)
        marginForm.addWidget(self.marginTopUnit, 1, 2)
        marginForm.addWidget(QLabel(i18n("Right:")), 2, 0, Qt.AlignRight)
        marginForm.addWidget(self.marginRight, 2, 1)
        marginForm.addWidget(self.marginRightUnit, 2, 2)
        marginForm.addWidget(QLabel(i18n("Bottom:")), 3, 0, Qt.AlignRight)
        marginForm.addWidget(self.marginBottom, 3, 1)
        marginForm.addWidget(self.marginBottomUnit, 3, 2)
        marginAndBleed.addTab(margins, i18n("Margins"))

        bleeds = QWidget()
        bleedsForm = QGridLayout()
        bleeds.setLayout(bleedsForm)
        self.bleedLeft = QDoubleSpinBox()
        self.bleedLeft.setMaximum(1000)
        self.bleedLeftUnit = simpleUnitBox()
        self.bleedRight = QDoubleSpinBox()
        self.bleedRight.setMaximum(1000)
        self.bleedRightUnit = simpleUnitBox()
        self.bleedTop = QDoubleSpinBox()
        self.bleedTop.setMaximum(1000)
        self.bleedTopUnit = simpleUnitBox()
        self.bleedBottom = QDoubleSpinBox()
        self.bleedBottom.setMaximum(1000)
        self.bleedBottomUnit = simpleUnitBox()
        bleedsForm.addWidget(QLabel(i18n("Left:")), 0, 0, Qt.AlignRight)
        bleedsForm.addWidget(self.bleedLeft, 0, 1)
        bleedsForm.addWidget(self.bleedLeftUnit, 0, 2)
        bleedsForm.addWidget(QLabel(i18n("Top:")), 1, 0, Qt.AlignRight)
        bleedsForm.addWidget(self.bleedTop, 1, 1)
        bleedsForm.addWidget(self.bleedTopUnit, 1, 2)
        bleedsForm.addWidget(QLabel(i18n("Right:")), 2, 0, Qt.AlignRight)
        bleedsForm.addWidget(self.bleedRight, 2, 1)
        bleedsForm.addWidget(self.bleedRightUnit, 2, 2)
        bleedsForm.addWidget(QLabel(i18n("Bottom:")), 3, 0, Qt.AlignRight)
        bleedsForm.addWidget(self.bleedBottom, 3, 1)
        bleedsForm.addWidget(self.bleedBottomUnit, 3, 2)
        marginAndBleed.addTab(bleeds, i18n("Bleeds"))
    def __init__(self):
        # set up basic geometry of main window
        super().__init__()
        self.title = 'yt2mp3 - Your simple Youtube to MP3 converter'
        self.left = 0
        self.top = 0
        self.width = 900
        self.height = 385
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        ###################################################################################
        # set up threading work backend, leaving at least one cpu for the OS and other crap
        ###################################################################################
        self.worker_thread_pool = ThreadPoolExecutor(
            max_workers=max(1,
                            os.cpu_count() - 1))
        self.gui_communicator_thread_pool = ThreadPoolExecutor(
            max_workers=max(1,
                            os.cpu_count() - 1))

        ###############################
        # set up layout of main window
        ###############################

        # first, some buttons to the right
        self.add_tab_button = QPushButton(
            '+ Tab')  # button for adding new tabs (see below)
        self.run_all_jobs_button = QPushButton(
            'Run all (?)'
        )  # button to run all runnable (not yet running and un-run) jobs
        self.stop_all_jobs_button = QPushButton(
            'Stop all (?)')  # button to terminate all running jobs

        # labels for summarizing job stati
        self.previous_job_stati = None  # memorize the previously received status to avoid uneccessary rendering.
        self.status_widget = QWidget()
        self.job_status_layout = QGridLayout()
        self.status_widget.setLayout(self.job_status_layout)

        self.n_jobs_idle_label = QLabel('Idle:')
        self.n_jobs_idle_number_label = QLabel('?')
        self.n_jobs_submitted_label = QLabel('Submitted:')
        self.n_jobs_submitted_number_label = QLabel('?')
        self.n_jobs_running_label = QLabel('Running:')
        self.n_jobs_running_number_label = QLabel('?')
        self.n_jobs_finished_label = QLabel('Finished:')
        self.n_jobs_finished_number_label = QLabel('?')
        self.n_jobs_stopped_label = QLabel('Stopped:')
        self.n_jobs_stopped_number_label = QLabel('?')
        self.n_jobs_failed_label = QLabel('Failed:')
        self.n_jobs_failed_number_label = QLabel('?')

        self.job_status_layout.addWidget(self.n_jobs_idle_label, 0, 0)
        self.job_status_layout.addWidget(self.n_jobs_idle_number_label, 0, 1)
        self.job_status_layout.addWidget(self.n_jobs_submitted_label, 1, 0)
        self.job_status_layout.addWidget(self.n_jobs_submitted_number_label, 1,
                                         1)
        self.job_status_layout.addWidget(self.n_jobs_running_label, 2, 0)
        self.job_status_layout.addWidget(self.n_jobs_running_number_label, 2,
                                         1)
        self.job_status_layout.addWidget(self.n_jobs_stopped_label, 3, 0)
        self.job_status_layout.addWidget(self.n_jobs_stopped_number_label, 3,
                                         1)
        self.job_status_layout.addWidget(self.n_jobs_failed_label, 4, 0)
        self.job_status_layout.addWidget(self.n_jobs_failed_number_label, 4, 1)
        self.job_status_layout.addWidget(self.n_jobs_finished_label, 5, 0)
        self.job_status_layout.addWidget(self.n_jobs_finished_number_label, 5,
                                         1)

        self.button_panel = QWidget()  # widget and layout to group buttons
        button_layout = QVBoxLayout(self)

        button_layout.addWidget(self.add_tab_button)  # assemble buttons
        button_layout.addStretch()  # add some spacing
        button_layout.addWidget(self.status_widget)
        button_layout.addStretch()  # add some spacing
        button_layout.addWidget(self.run_all_jobs_button)
        button_layout.addWidget(self.stop_all_jobs_button)
        self.button_panel.setLayout(button_layout)

        # second, a tab panel for job specification to the left
        # list of icons for the tabs to use.
        self.tab_icons = {
            JobPanel.STATUS_IDLE: QIcon('resources/edit.png'),
            JobPanel.STATUS_SUBMITTED: QIcon('resources/stopwatch.png'),
            JobPanel.STATUS_RUNNING: QIcon('resources/download.png'),
            JobPanel.STATUS_STOPPED: QIcon('resources/stop.png'),
            JobPanel.STATUS_FINISHED: QIcon('resources/finish-flag.png'),
            JobPanel.STATUS_FAILED: QIcon('resources/alarm.png')
        }

        self.tab_status = {}  # keep track of each tab's job's status
        self.tab_icon_size = QSize(24, 24)
        self.tab_panel = QTabWidget()
        self.tab_panel.setTabsClosable(True)  # make tabs closable.
        self.tab_panel.setIconSize(self.tab_icon_size)
        self.tabs_created = 0  # count how many tabs have been created

        # assemble gui elements
        window_layout = QHBoxLayout(self)
        window_layout.addWidget(self.tab_panel)  # tab panel to the left
        window_layout.addWidget(self.button_panel)  # controls to the right
        self.setLayout(window_layout)

        # add initial tab from argparse_namespace input and show
        self.add_tab()

        # create process output monitor
        self.process_output_monitor = ProcessOutputMonitor(self.tab_panel)

        ################################
        # add functionality and controls
        ################################
        self.add_tab_button.clicked.connect(self.add_tab)
        self.tab_panel.tabCloseRequested.connect(self.close_tab)
        self.run_all_jobs_button.clicked.connect(self.run_all_jobs)
        self.stop_all_jobs_button.clicked.connect(self.stop_all_jobs)

        self.process_output_monitor.update_output.connect(
            self.handle_process_output)
        self.process_output_monitor.update_tabinfo.connect(
            self.handle_tabinfo_change)
        self.process_output_monitor.update_stati.connect(
            self.handle_process_status_summary)
        self.process_output_monitor.update_runnable_stoppable_count.connect(
            self.handle_runnable_stoppable_count)
        self.process_output_monitor.monitor_outputs()

        self.show()
Exemple #14
0
    def setupUi(self, mainWindow):
        # 窗口主题设置 尺寸以及固定
        mainWindow.setObjectName("mainWindow")
        mainWindow.setEnabled(True)
        mainWindow.resize(470, 500)
        mainWindow.setFixedSize(470, 500)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            mainWindow.sizePolicy().hasHeightForWidth())
        mainWindow.setSizePolicy(sizePolicy)

        # 设置窗口文字字体
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setBold(False)
        font.setWeight(50)
        mainWindow.setFont(font)

        # 设置窗口图标
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("./icon/wfl.jpg"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        mainWindow.setWindowIcon(icon)

        self.centralwidget = QWidget(mainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.layoutWidget = QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QtCore.QRect(20, 180, 431, 31))
        self.layoutWidget.setObjectName("layoutWidget")
        self.gridLayout_2 = QGridLayout(self.layoutWidget)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setObjectName("gridLayout_2")

        # 状态输出控件
        self.outPrint = QTextEdit(self.centralwidget)
        self.outPrint.setGeometry(QtCore.QRect(20, 230, 431, 221))
        self.outPrint.setReadOnly(True)
        self.outPrint.setObjectName("outPrint")

        # frp开启按钮
        self.frpOn = QPushButton(self.layoutWidget)
        self.frpOn.setObjectName("frpOn")
        self.gridLayout_2.addWidget(self.frpOn, 0, 0, 1, 1)

        # frp关闭按钮
        self.frpOff = QPushButton(self.layoutWidget)
        self.frpOff.setObjectName("frpOff")
        self.gridLayout_2.addWidget(self.frpOff, 0, 1, 1, 1)

        # nginx开启按钮
        self.nginxOn = QPushButton(self.layoutWidget)
        self.nginxOn.setObjectName("nginxOn")
        self.gridLayout_2.addWidget(self.nginxOn, 0, 2, 1, 1)

        # nginx关闭按钮
        self.nginxOff = QPushButton(self.layoutWidget)
        self.nginxOff.setObjectName("nginxOff")
        self.gridLayout_2.addWidget(self.nginxOff, 0, 3, 1, 1)

        self.widget = QWidget(self.centralwidget)
        self.widget.setGeometry(QtCore.QRect(20, 16, 431, 151))
        self.widget.setObjectName("widget")
        self.gridLayout = QGridLayout(self.widget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")

        # frp文件
        self.frpName = QLabel(self.widget)
        self.frpName.setObjectName("frpName")
        self.gridLayout.addWidget(self.frpName, 0, 0, 1, 1)

        # frp文件输入框
        self.dirNameEdit = QLineEdit(self.widget)
        self.dirNameEdit.setEnabled(True)
        self.dirNameEdit.setText("")
        self.dirNameEdit.setDragEnabled(False)
        self.dirNameEdit.setReadOnly(False)
        self.dirNameEdit.setObjectName("dirNameEdit")
        self.gridLayout.addWidget(self.dirNameEdit, 0, 1, 1, 1)

        # frp路径自动搜索
        self.autoSearch = QPushButton(self.widget)
        self.autoSearch.setObjectName("autoSearch")
        self.gridLayout.addWidget(self.autoSearch, 0, 2, 1, 1)

        # serverIp
        self.serverIp = QLabel(self.widget)
        self.serverIp.setObjectName("serverIp")
        self.gridLayout.addWidget(self.serverIp, 1, 0, 1, 1)

        # serverIp 编辑
        self.serverIpEdit = QLineEdit(self.widget)
        self.serverIpEdit.setText("")
        self.serverIpEdit.setObjectName("serverIpEdit")
        self.gridLayout.addWidget(self.serverIpEdit, 1, 1, 1, 1)

        # serverUser
        self.serverUser = QLabel(self.widget)
        self.serverUser.setObjectName("serverUser")
        self.gridLayout.addWidget(self.serverUser, 2, 0, 1, 1)

        # serverUser 编辑
        self.serverUserEdit = QLineEdit(self.widget)
        self.serverUserEdit.setText("")
        self.serverUserEdit.setObjectName("serverUserEdit")
        self.gridLayout.addWidget(self.serverUserEdit, 2, 1, 1, 1)

        # serverPassword
        self.serverPassword = QLabel(self.widget)
        self.serverPassword.setObjectName("serverPassword")
        self.gridLayout.addWidget(self.serverPassword, 3, 0, 1, 1)

        # serverPassword 编辑
        self.serverPasswordEdit = QLineEdit(self.widget)
        self.serverPasswordEdit.setText("")
        self.serverPasswordEdit.setObjectName("serverPasswordEdit")
        self.gridLayout.addWidget(self.serverPasswordEdit, 3, 1, 1, 1)
        # 设置密码不可见不可复制
        self.serverPasswordEdit.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.serverPasswordEdit.setEchoMode(QLineEdit.Password)

        # nginxStream
        self.nginxStream = QLabel(self.widget)
        self.nginxStream.setObjectName("nginxStream")
        self.gridLayout.addWidget(self.nginxStream, 4, 0, 1, 1)

        # nginxStream 编辑
        self.nginxStreamEdit = QLineEdit(self.widget)
        self.nginxStreamEdit.setText("")
        self.nginxStreamEdit.setObjectName("nginxStreamEdit")
        self.gridLayout.addWidget(self.nginxStreamEdit, 4, 1, 1, 1)

        mainWindow.setCentralWidget(self.centralwidget)

        # 菜单栏设置
        self.menubar = QMenuBar(mainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 480, 18))
        self.menubar.setObjectName("menubar")
        self.menu = QMenu(self.menubar)
        self.menu.setObjectName("menu")
        mainWindow.setMenuBar(self.menubar)

        # 状态栏设置
        self.statusbar = QStatusBar(mainWindow)
        self.statusbar.setObjectName("statusbar")
        mainWindow.setStatusBar(self.statusbar)

        self.openConf = QAction(mainWindow)
        self.openConf.setObjectName("openConf")
        self.menu.addSeparator()
        self.menu.addAction(self.openConf)
        self.menubar.addAction(self.menu.menuAction())

        self.retranslateUi(mainWindow)
        QtCore.QMetaObject.connectSlotsByName(mainWindow)

        self.frpOn.clicked.connect(self.frp_on)
        self.frpOff.clicked.connect(self.frp_off)
        self.autoSearch.clicked.connect(self.auto_search)
        self.nginxOn.clicked.connect(self.nginx_on)
        self.nginxOff.clicked.connect(self.nginx_off)
Exemple #15
0
"""
QGridLayout: Grid Layout
"""
import sys

from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QGridLayout
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QWidget

app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle('QGridLayout')
layout = QGridLayout()
layout.addWidget(QPushButton('Button (0, 0)'), 0, 0)
layout.addWidget(QPushButton('Button (0, 1)'), 0, 1)
layout.addWidget(QPushButton('Button (0, 2)'), 0, 2)
layout.addWidget(QPushButton('Button (1, 0)'), 1, 0)
layout.addWidget(QPushButton('Button (1, 1)'), 1, 1)
layout.addWidget(QPushButton('Button (1, 2)'), 1, 2)
layout.addWidget(QPushButton('Button (2, 0)'), 2, 0)
layout.addWidget(QPushButton('Button (2, 1) + 2 Columns Span'), 2, 1, 1, 2)
window.setLayout(layout)
window.show()
sys.exit(app.exec_())
Exemple #16
0
    def createLayout(self):
        self.layout = QGridLayout(self)
        toplabel1 = QLabel("1-, 2- or 3-Shift CSV File Constructor Algorithm")
        toplabel2 = QLabel(
            "Phase 2: Generate and/or find solution(s) to a combination")
        toplabel2x = QLabel("- - - -  Define the parameters below  - - - -")
        toplabel3 = QLabel("")
        dailyrestingtimelbl = QLabel(
            "Minimum continuous daily resting time [h]: ")
        toplabel1.setAlignment(Qt.AlignCenter)
        toplabel2.setAlignment(Qt.AlignCenter)
        toplabel2x.setAlignment(Qt.AlignCenter)
        toplabel3.setAlignment(Qt.AlignCenter)
        row = 0
        self.layout.addWidget(toplabel1, row, 0, 1, 7)
        row += 1
        self.layout.addWidget(toplabel2, row, 0, 1, 7)
        row += 1
        self.layout.addWidget(toplabel2x, row, 0, 1, 7)
        row += 1
        self.layout.addWidget(toplabel3, row, 0, 1, 7)
        row += 1
        shiftlengthlbl = QLabel("Shift lengths [h]: ")
        self.layout.addWidget(shiftlengthlbl, row, 0, 1, 4)
        self.shiftlengthinput = QDoubleSpinBox()
        self.shiftlengthinput.setValue(self.shiftlengths)
        self.shiftlengthinput.setMinimum(1)
        self.shiftlengthinput.valueChanged.connect(
            self.shiftlengthinputChanged)
        self.layout.addWidget(self.shiftlengthinput, row, 4, 1, 3)
        row += 1
        dailyrestingtimelbl = QLabel(
            "Minimum continuous daily resting time [h]: ")
        self.layout.addWidget(dailyrestingtimelbl, row, 0, 1, 4)
        self.checkWeeklyRestBtn = QPushButton("Check Weekly Rest")
        self.dailyrestinginput = QSpinBox()
        self.dailyrestinginput.setValue(self.dailyresting)
        self.dailyrestinginput.setMinimum(1)
        self.dailyrestinginput.setToolTip("Swedish law: 11 hours minimum")
        self.dailyrestinginput.valueChanged.connect(
            self.dailyrestinginputChanged)
        self.layout.addWidget(self.dailyrestinginput, row, 4, 1, 3)
        row += 1
        weeklyrestingtimelbl = QLabel(
            "Minimum continuous weekly resting time [h]: ")
        self.layout.addWidget(weeklyrestingtimelbl, row, 0, 1, 4)
        self.weeklyrestinginput = QSpinBox()
        self.weeklyrestinginput.setValue(self.weeklyresting)
        self.weeklyrestinginput.setMinimum(1)
        self.weeklyrestinginput.setToolTip("Swedish law: 11 hours minimum")
        self.weeklyrestinginput.valueChanged.connect(
            self.weeklyrestinginputChanged)
        self.layout.addWidget(self.weeklyrestinginput, row, 4, 1, 3)
        row += 1
        toplabel4 = QLabel(
            "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        )
        toplabel4.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(toplabel4, row, 0, 1, 7)
        self.solutionsBrowsing = QSpinBox()
        self.solutionsBrowsing.valueChanged.connect(self.solutionIntChangedI)
        self.solutionsBrowsing.setVisible(False)
        self.solutionsBrowsing.setKeyboardTracking(False)
        if self.shifttype > 1:
            row += 1
            self.findSolutionsBtn = QPushButton("Find solutions")
            self.findSolutionsBtn.clicked.connect(self.findSolution)
            self.layout.addWidget(self.findSolutionsBtn, row, 1, 1, 1)
            self.find1SolutionBtn = QPushButton("Find First Solution")
            self.find1SolutionBtn.clicked.connect(self.find1Solution)
            self.layout.addWidget(self.find1SolutionBtn, row, 2, 1, 2)
            self.checkWeeklyRestBtn.clicked.connect(self.checkWeeklyRest)
            self.layout.addWidget(self.checkWeeklyRestBtn, row, 4, 1, 2)

            row += 1
            self.solutionsLbl = QLabel("Solution index: ")
            self.solutionsLbl.setVisible(False)
            self.layout.addWidget(self.solutionsLbl, row, 0, 1, 2)

            self.layout.addWidget(self.solutionsBrowsing, row, 2, 1, 2)
            self.solutionsSlider = QSlider()
            self.solutionsSlider.setOrientation(Qt.Horizontal)
            self.solutionsSlider.setVisible(False)
            self.solutionsSlider.valueChanged.connect(self.solutionIntChangedS)
            self.solutionsSlider.sliderReleased.connect(
                self.solutionMatrix2Table1)
            self.layout.addWidget(self.solutionsSlider, row, 4, 1, 3)
            row += 1
            toplabel4b = QLabel(
                "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
            )
            toplabel4b.setAlignment(Qt.AlignCenter)
            self.layout.addWidget(toplabel4b, row, 0, 1, 7)
        row += 1
        tablelayout = QVBoxLayout()
        self.layout.addLayout(tablelayout, row, 0, len(self.series), 7)
        self.table = QTableWidget()  # Create table for the series we work with
        tablelayout.addWidget(self.table)
        self.table.setColumnCount(7)
        self.table.setHorizontalHeaderLabels(
            "Mon;Tue;Wed;Thu;Fri;Sat;Sun".split(";"))
        for i in range(0, 7):
            self.table.horizontalHeader().setSectionResizeMode(
                i, QHeaderView.Stretch)
        self.table.setRowCount(len(self.series))
        for rr, serie in enumerate(self.series):
            for col, value in enumerate(serie):
                if value == 0:
                    wdg = QLabel("0")
                    wdg.setAlignment(Qt.AlignCenter)
                else:
                    wdg = QComboBox()
                    for t in self.shifts:
                        wdg.addItem(t)
                    wdg.currentIndexChanged.connect(self.readTableContents)
                self.table.setCellWidget(rr, col, wdg)
        self.table.setMaximumSize(self.getQTableWidgetSize(self.table))
        self.table.setMinimumSize(self.getQTableWidgetSize(self.table))
        row = row + 1 + len(self.series)
        toplabel5 = QLabel(
            "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        )
        toplabel5.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(toplabel5, row, 0, 1, 7)
        row += 1
        self.shifttype1Label = QLabel("Number of " + self.shifts[0] +
                                      "-shifts: ")
        self.layout.addWidget(self.shifttype1Label, row, 0, 1, 2)
        self.shiftsof1 = QLabel(str(self.shift1))
        self.layout.addWidget(self.shiftsof1, row, 2, 1, 2)
        if self.shifttype > 1:
            row += 1
            self.shifttype1Label = QLabel("Number of " + self.shifts[1] +
                                          "-shifts: ")
            self.layout.addWidget(self.shifttype1Label, row, 0, 1, 2)
            self.shiftsof2 = QLabel(str(self.shift2))
            self.layout.addWidget(self.shiftsof2, row, 2, 1, 2)
        if self.shifttype > 2:
            row += 1
            self.shifttype1Label = QLabel("Number of " + self.shifts[2] +
                                          "-shifts: ")
            self.layout.addWidget(self.shifttype1Label, row, 0, 1, 2)
            self.shiftsof3 = QLabel(str(self.shift3))
            self.layout.addWidget(self.shiftsof3, row, 2, 1, 2)
        row += 1
        toplabel6 = QLabel(
            "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        )
        toplabel6.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(toplabel6, row, 0, 1, 7)
        row += 1
        toplabel7 = QLabel("Results:")
        toplabel7.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(toplabel7, row, 0, 1, 7)
        row += 1
        toplabel8 = QLabel(
            "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
        )
        toplabel8.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(toplabel8, row, 0, 1, 7)
        row += 1
        table2layout = QVBoxLayout()
        self.layout.addLayout(table2layout, row, 0, 3, 7)
        self.table2 = QTableWidget(
        )  # Create table for the series we work with
        table2layout.addWidget(self.table2)
        self.table2.setColumnCount(7)
        self.table2.setHorizontalHeaderLabels(
            "Mon;Tue;Wed;Thu;Fri;Sat;Sun".split(";"))
        for i in range(0, 7):
            self.table2.horizontalHeader().setSectionResizeMode(
                i, QHeaderView.Stretch)
        self.table2.setRowCount(self.shifttype)
        verticalHeaders = []
        for rr in range(self.shifttype):
            for col in range(7):
                wdg = QLabel("0")
                wdg.setAlignment(Qt.AlignCenter)
                self.table2.setCellWidget(rr, col, wdg)
            verticalHeaders.append(self.shifts[rr])
        self.table2.setVerticalHeaderLabels(verticalHeaders)
        self.table2.setMaximumSize(self.getQTableWidgetSize(self.table2))
        self.table2.setMinimumSize(self.getQTableWidgetSize(self.table2))
        row = row + 1 + self.shifttype * 10
        self.loadButton = QPushButton("Load")
        self.loadButton.clicked.connect(self.loadFunctionClicked)
        self.layout.addWidget(self.loadButton, row, 0, 3, 2)
        self.saveButton = QPushButton("Save")
        self.saveButton.clicked.connect(self.saveFunction)
        self.layout.addWidget(self.saveButton, row, 2, 3, 2)
        self.exportButton = QPushButton("Export")
        self.exportButton.clicked.connect(self.exportFunction)
        self.exportButton.setToolTip("Export in a CSV format")
        self.layout.addWidget(self.exportButton, row, 4, 3, 3)

        row = row + 1 + self.shifttype * 10
        bottomlabel1 = QLabel(
            "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        bottomlabel2 = QLabel(
            "Coder: Benjamin Bolling ([email protected])")
        self.layout.addWidget(bottomlabel1, row, 0, 1, 7)
        row += 1
        self.layout.addWidget(bottomlabel2, row, 0, 1, 7)
Exemple #17
0
    def __init__(
            self,
            *,
            main_window: 'ElectrumSysWindow',
            tx: PartialTransaction,
            txid: str,
            title: str,
            help_text: str,
    ):
        WindowModalDialog.__init__(self, main_window, title=title)
        self.window = main_window
        self.wallet = main_window.wallet
        self.tx = tx
        assert txid
        self.txid = txid

        fee = tx.get_fee()
        assert fee is not None
        tx_size = tx.estimated_size()
        old_fee_rate = fee / tx_size  # sat/vbyte
        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(help_text))

        ok_button = OkButton(self)
        self.adv_button = QPushButton(_("Show advanced settings"))
        warning_label = WWLabel('\n')
        warning_label.setStyleSheet(ColorScheme.RED.as_stylesheet())
        self.feerate_e = FeerateEdit(lambda: 0)
        self.feerate_e.setAmount(max(old_fee_rate * 1.5, old_fee_rate + 1))

        def on_feerate():
            fee_rate = self.feerate_e.get_amount()
            warning_text = '\n'
            if fee_rate is not None:
                try:
                    new_tx = self.rbf_func(fee_rate)
                except Exception as e:
                    new_tx = None
                    warning_text = str(e).replace('\n', ' ')
            else:
                new_tx = None
            ok_button.setEnabled(new_tx is not None)
            warning_label.setText(warning_text)

        self.feerate_e.textChanged.connect(on_feerate)

        def on_slider(dyn, pos, fee_rate):
            fee_slider.activate()
            if fee_rate is not None:
                self.feerate_e.setAmount(fee_rate / 1000)

        fee_slider = FeeSlider(self.window, self.window.config, on_slider)
        fee_combo = FeeComboBox(fee_slider)
        fee_slider.deactivate()
        self.feerate_e.textEdited.connect(fee_slider.deactivate)

        grid = QGridLayout()
        grid.addWidget(QLabel(_('Current Fee') + ':'), 0, 0)
        grid.addWidget(QLabel(self.window.format_amount(fee) + ' ' + self.window.base_unit()), 0, 1)
        grid.addWidget(QLabel(_('Current Fee rate') + ':'), 1, 0)
        grid.addWidget(QLabel(self.window.format_fee_rate(1000 * old_fee_rate)), 1, 1)
        grid.addWidget(QLabel(_('New Fee rate') + ':'), 2, 0)
        grid.addWidget(self.feerate_e, 2, 1)
        grid.addWidget(fee_slider, 3, 1)
        grid.addWidget(fee_combo, 3, 2)
        vbox.addLayout(grid)
        self._add_advanced_options_cont(vbox)
        vbox.addWidget(warning_label)

        btns_hbox = QHBoxLayout()
        btns_hbox.addWidget(self.adv_button)
        btns_hbox.addStretch(1)
        btns_hbox.addWidget(CancelButton(self))
        btns_hbox.addWidget(ok_button)
        vbox.addLayout(btns_hbox)
Exemple #18
0
    def initUI(self):
        #creation des labels
        titre = QLabel("Assistant de Recherche - Bon de Travail")
        titre.setFont((QFont('SansSerif', 24)))

        #Critère de Recherche

        categorie = QLabel('Catégorie d' 'équipement')
        apres = QLabel('Après le')
        avant = QLabel('Avant le')
        etat = QLabel('Etat')
        cds = QLabel('Centre de Service')
        description = QLabel('Description de la situation')
        apresEdit = QLineEdit()
        avantEdit = QLineEdit()
        descriptionEdit = QLineEdit()

        #creation d'un layout horizontal
        hbox = QHBoxLayout()
        # hbox.addStretch(1)
        hbox.setAlignment(Qt.AlignCenter)

        # Ajout du label du titre dans le layout horizontal 2
        hbox.addWidget(
            titre,
            0,
        )

        #creation d'un layout verticale
        vbox = QVBoxLayout()
        #vbox.addStretch(1)

        #creation d'une grid layout
        grid = QGridLayout()
        grid.setSpacing(10)

        #Postionnement des differents elements dans le grid layout

        grid.addWidget(categorie, 1, 0)

        grid.addWidget(apres, 1, 1)
        grid.addWidget(apresEdit, 2, 1)

        grid.addWidget(avant, 1, 2)
        grid.addWidget(avantEdit, 2, 2)

        grid.addWidget(etat, 1, 3)

        grid.addWidget(cds, 3, 0)

        grid.addWidget(description, 3, 1)
        grid.addWidget(descriptionEdit, 4, 1)

        #///CRÉATION DES LISTES DÉROULANTES\\\

        #Catégorie d'équipement
        categorieEdit = QComboBox(self)
        #On ajoute les differents elements pour la liste deroulante
        #Ça serait bien d'avoir une option pour ajouter automatiquement les catégories

        categorieEdit.addItem("Ajouter une catégorie")

        #État

        etatEdit = QComboBox(self)
        etatEdit.addItem("Ajouter une catégorie")

        #Centre de Service

        cdsEdit = QComboBox(self)
        cdsEdit.addItem("Ajouter une catégorie")

        #ajout de la liste deroulante dans la grid layout
        grid.addWidget(categorieEdit, 2, 0)
        grid.addWidget(etatEdit, 2, 3)
        grid.addWidget(cdsEdit, 4, 0)
        #creation du label qui sera mise a jour lors de la selection de la liste deroulante
        self.label = QLabel("Stylo", self)
        #ajout du label dans la grille
        grid.addWidget(self.label, 5, 0)
        #On connecte la mise a jour du texte a la selection de la liste
        categorieEdit.activated[str].connect(self.onActivated)

        #On ajoute la grid layout et le layout horizontal dans le layout vertical
        vbox.addLayout(hbox)
        vbox.addLayout(grid)

        #on met en place le layout
        self.setLayout(vbox)
        #mise a jour des fenetres
        #Il semble avoir un problème avec la bar de menu
        #  menubar = self.menuBar()
        #  fileMenu = menubar.addMenu('&File')
        #  fileMenu.addAction('Ajouter une action')
        #  fileMenu = menubar.addMenu('&Edit')
        #   fileMenu = menubar.addMenu('&View')
        #   fileMenu = menubar.addMenu('&Insert')
        #   fileMenu = menubar.addMenu('&Format')
        #   fileMenu = menubar.addMenu('&Table')
        #   fileMenu = menubar.addMenu('&Tools')
        #  fileMenu = menubar.addMenu('&Window')
        #  fileMenu = menubar.addMenu('&Help')

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('PC2')
        self.setWindowIcon(QIcon('PC2.png'))
        self.show()
Exemple #19
0
    def play_game(self, number):
        # создание поля игры
        self.widget_of_start_game.hide()
        self.field_size = number

        #количество шагов, имена пользователей, их счёт
        self.number_of_steps = 0
        self.player_1 = QLabel('player 1')
        self.player_1.setText(str(self.username))
        self.player_2 = QLabel('player 2')
        self.steps_over = QLabel('steps over')
        self.steps_everywhing = QLabel(str(self.field_size ** 2 - self.number_of_steps))
        self.whose_player_step = QLabel('Time')
        self.whose_player_step.setText('step player 1')
        #установка белого цвета на фон
        #далее меняется в зависимости от того, чей ход
        self.whose_player_step.setStyleSheet('QLabel {background-color: white; color: black;}')
        self.player_1.setStyleSheet('background-color: white')
        self.player_2.setStyleSheet('background-color: white')
        #счета игроков
        self.count_player_1 = QLabel('0')
        self.count_player_2 = QLabel('0')
        self.player_move = 1

        #создание единичных матриц, аналогичных полю игры
        #
        self.matrix_play = [ [ 1 for i in range(self.field_size ) ] for j in range(self.field_size ) ]
        self.matrix_play2 = [ list(x) for x in zip(*self.matrix_play) ]

        # построения поля для игры
        self.grid_play = QGridLayout()
        for i in range(self.field_size):
            for j in range(self.field_size):
                rand_number = str(random.randint(min_rand_number, max_rand_number))
                button_for_build_area_game = 'pushbuttongrid_%s' % i + '_%s' % j
                setattr(self, button_for_build_area_game, QPushButton(rand_number))
                getattr(self, button_for_build_area_game).setEnabled(False)
                getattr(self, button_for_build_area_game).setStyleSheet('QPushButton {background-color: white; color: black;}')
                self.grid_play.addWidget(getattr(self, button_for_build_area_game), i, j)
        #установка допустимых для нажатия кнопок в первом ходе
        for i in range(self.field_size):
            button_for_build_area_game = 'pushbuttongrid_%s' % i + '_0'
            getattr(self, button_for_build_area_game).setEnabled(True)
            if int(getattr(self, button_for_build_area_game).text()) > 0:
                getattr(self, button_for_build_area_game).setStyleSheet('QPushButton {background-color: green; color: black;}')
            else:
                getattr(self, button_for_build_area_game).setStyleSheet('QPushButton {background-color: orange; color: black;}')

        #установдение функций нажатия на кнопки поля
        for i in range(self.field_size):
            for j in range(self.field_size):
                button_for_build_area_game = 'pushbuttongrid_%s' % i + '_%s' % j
                getattr(self, button_for_build_area_game).pressed.connect(lambda v=i, w=j: self.player_step(v, w))
        #создание поля игры
        horizontal_layout_label = QHBoxLayout()
        horizontal_layout_edit = QHBoxLayout()
        horizontal_layout_whose_step = QHBoxLayout()
        vertical_layout = QVBoxLayout()
        horizontal_layout_main = QHBoxLayout()
        #создание элементов с именами игроков
        horizontal_layout_label.addStretch(4)
        horizontal_layout_label.addWidget(self.player_1)
        horizontal_layout_label.addStretch(1)
        horizontal_layout_label.addWidget(self.steps_over)
        horizontal_layout_label.addStretch(1)
        horizontal_layout_label.addWidget(self.player_2)
        horizontal_layout_label.addStretch(4)
        # создание элементов со счетами игроков и
        # оставшимся количеством ходов
        horizontal_layout_edit.addStretch(1)
        horizontal_layout_edit.addWidget(self.count_player_1)
        horizontal_layout_edit.addStretch(1)
        horizontal_layout_edit.addWidget(self.steps_everywhing)
        horizontal_layout_edit.addStretch(1)
        horizontal_layout_edit.addWidget(self.count_player_2)
        horizontal_layout_edit.addStretch(1)
        #создание для показа имени ходящего сейчас игрока
        horizontal_layout_whose_step.addStretch(4)
        horizontal_layout_whose_step.addWidget(self.whose_player_step)
        horizontal_layout_whose_step.addStretch(4)

        #сборка вышеописанных элементов
        vertical_layout.addStretch(1)
        vertical_layout.addLayout(horizontal_layout_label)
        vertical_layout.addStretch(1)
        vertical_layout.addLayout(horizontal_layout_edit)
        vertical_layout.addStretch(1)
        vertical_layout.addLayout(self.grid_play)
        vertical_layout.addStretch(1)
        vertical_layout.addLayout(horizontal_layout_whose_step)
        horizontal_layout_main.addStretch(1)
        horizontal_layout_main.addLayout(vertical_layout)
        horizontal_layout_main.addStretch(1)
        self.setLayout(horizontal_layout_main)
        self.show()
Exemple #20
0
    def __init__(self, parent=None):
        super().__init__(parent)

        # Display Window
        self.display = QLineEdit()
        self.display.setReadOnly(True)
        self.display.setAlignment(Qt.AlignRight)
        self.display.setMaxLength(15)

        # Digit Buttons
        self.digitButton = [
            Button(str(x), self.buttonClicked) for x in range(0, 10)
        ]

        # . and = Buttons
        self.decButton = Button('.', self.buttonClicked)
        self.eqButton = Button('=', self.buttonClicked)

        # Operator Buttons
        self.mulButton = Button('*', self.buttonClicked)
        self.divButton = Button('/', self.buttonClicked)
        self.addButton = Button('+', self.buttonClicked)
        self.subButton = Button('-', self.buttonClicked)

        # Parentheses Buttons
        self.lparButton = Button('(', self.buttonClicked)
        self.rparButton = Button(')', self.buttonClicked)

        # Clear Button
        self.clearButton = Button('C', self.buttonClicked)

        # Layout
        mainLayout = QGridLayout()
        mainLayout.setSizeConstraint(QLayout.SetFixedSize)

        mainLayout.addWidget(self.display, 0, 0, 1, 2)

        numLayout = QGridLayout()
        for i in range(1, 10):
            numLayout.addWidget(self.digitButton[i], (9 - i) // 3, (i + 2) % 3)
        numLayout.addWidget(self.digitButton[0], 3, 0)

        numLayout.addWidget(self.decButton, 3, 1)
        numLayout.addWidget(self.eqButton, 3, 2)

        mainLayout.addLayout(numLayout, 1, 0)

        opLayout = QGridLayout()

        opLayout.addWidget(self.mulButton, 0, 0)
        opLayout.addWidget(self.divButton, 0, 1)
        opLayout.addWidget(self.addButton, 1, 0)
        opLayout.addWidget(self.subButton, 1, 1)

        opLayout.addWidget(self.lparButton, 2, 0)
        opLayout.addWidget(self.rparButton, 2, 1)

        opLayout.addWidget(self.clearButton, 3, 0)

        mainLayout.addLayout(opLayout, 1, 1)

        self.setLayout(mainLayout)

        self.setWindowTitle("My Calculator")
Exemple #21
0
    def __init__(self, parent=None):
        super(AddressBook, self).__init__(parent)

        self.contacts = SortedDict()
        self.oldName = ""
        self.oldAddress = ""
        self.currentMode = self.NavigationMode

        nameLabel = QLabel("Name:")
        self.nameLine = QLineEdit()
        self.nameLine.setReadOnly(True)

        addressLabel = QLabel("Address:")
        self.addressText = QTextEdit()
        self.addressText.setReadOnly(True)

        self.addButton = QPushButton("&Add")
        self.addButton.show()
        self.editButton = QPushButton("&Edit")
        self.editButton.setEnabled(False)
        self.removeButton = QPushButton("&Remove")
        self.removeButton.setEnabled(False)
        self.submitButton = QPushButton("&Submit")
        self.submitButton.hide()
        self.cancelButton = QPushButton("&Cancel")
        self.cancelButton.hide()

        self.nextButton = QPushButton("&Next")
        self.nextButton.setEnabled(False)
        self.previousButton = QPushButton("&Previous")
        self.previousButton.setEnabled(False)

        self.addButton.clicked.connect(self.addContact)
        self.submitButton.clicked.connect(self.submitContact)
        self.editButton.clicked.connect(self.editContact)
        self.removeButton.clicked.connect(self.removeContact)
        self.cancelButton.clicked.connect(self.cancel)
        self.nextButton.clicked.connect(self.next)
        self.previousButton.clicked.connect(self.previous)

        buttonLayout1 = QVBoxLayout()
        buttonLayout1.addWidget(self.addButton)
        buttonLayout1.addWidget(self.editButton)
        buttonLayout1.addWidget(self.removeButton)
        buttonLayout1.addWidget(self.submitButton)
        buttonLayout1.addWidget(self.cancelButton)
        buttonLayout1.addStretch()

        buttonLayout2 = QHBoxLayout()
        buttonLayout2.addWidget(self.previousButton)
        buttonLayout2.addWidget(self.nextButton)

        mainLayout = QGridLayout()
        mainLayout.addWidget(nameLabel, 0, 0)
        mainLayout.addWidget(self.nameLine, 0, 1)
        mainLayout.addWidget(addressLabel, 1, 0, Qt.AlignTop)
        mainLayout.addWidget(self.addressText, 1, 1)
        mainLayout.addLayout(buttonLayout1, 1, 2)
        mainLayout.addLayout(buttonLayout2, 3, 1)

        self.setLayout(mainLayout)
        self.setWindowTitle("Simple Address Book")
Exemple #22
0
    def __init__(self, orientation):
        super().__init__()

        if orientation == 'V':

            self.resize(400, 550)  #change to 800ish

            layout = QVBoxLayout()
            topLayout = QGridLayout()

            self.distance = QLabel("0 miles")
            self.time = QLabel("0 hours")

            topLayout.addWidget(self.distance, 0, 0)
            topLayout.addWidget(self.time, 0, 1)
            layout.addLayout(topLayout)

            self.hilVec = []

            for i in range(1, numHILs + 1):
                hil = hil_widget.HILWidget(str(i))
                self.hilVec.append(hil)
                layout.addWidget(hil)

            self.userInput = QLineEdit()
            layout.addWidget(self.userInput)

            self.setLayout(layout)
            self.setWindowTitle("SIMformation Widget")

            self.distance.setStyleSheet("color: white; font: bold 35px")
            self.time.setStyleSheet("color: white; font: bold 35px")

        elif orientation == 'H':

            self.resize(775, 600)  #change to 800ish

            layout = QGridLayout()
            topLayout = QGridLayout()

            self.distance = QLabel("0 miles")
            self.time = QLabel("0 hours")

            topLayout.addWidget(self.distance, 0, 0)
            topLayout.addWidget(self.time, 0, 1)
            layout.addLayout(topLayout, 0, 0, 1, 0)

            if numHILs % 3 == 0: totalRows = int(numHILs / 3)
            else: totalRows = int(numHILs / 3) + 1

            self.hilVec = []

            n = 1
            for i in range(0, totalRows):
                for j in range(0, 3):
                    if n <= numHILs:
                        hil = hil_widget.HILWidget(str(n))
                        self.hilVec.append(hil)
                        layout.addWidget(hil, i + 1, j)
                    n = n + 1

            self.userInput = QLineEdit()
            layout.addWidget(self.userInput, totalRows + 1, 0, totalRows + 1,
                             2)

            self.setLayout(layout)
            self.setWindowTitle("SIMformation Widget")

            self.distance.setStyleSheet("color: white; font: bold 35px")
            self.time.setStyleSheet("color: white; font: bold 35px")

        background = QPixmap(
            "/home/pi/Documents/Orasi/matteo-bernardis-QpIayO5KIRE-unsplash.jpg"
        )
        background = background.scaled(self.size(), Qt.IgnoreAspectRatio,
                                       Qt.FastTransformation)
        palette = QPalette()
        palette.setBrush(QPalette.Window, QBrush(background))
        self.setPalette(palette)

        #self.initUI()

        self.userInput.returnPressed.connect(self.changeColor)
Exemple #23
0
    def __init_home__(self, *args):
        """
        主页布局
        :return:
        """
        self.glayout_home = QGridLayout()
        self.glayout_home.setObjectName('grade_1')
        self.glayout_main.addLayout(self.glayout_home, 2, 0, Qt.AlignCenter)
        self.glayout_home.setSpacing(int(self.width() * 0.2 / 6))
        self.glayout_home.setContentsMargins(10, 10, 10, 10)

        # btn及其参数
        self.home_btns = []

        self.btn_home_voice = QPushButton()
        self.home_btns.append([
            self.btn_home_voice, 0, 0, 1, 1, '语音技术', 'btn_home_voice', 80, 60,
            '{}/Ico/voice.png'.format(ROOTDIR)
        ])
        self.btn_home_face = QPushButton()
        self.home_btns.append([
            self.btn_home_face, 0, 1, 1, 1, '人脸识别', 'btn_home_face', 80, 60,
            '{}/Ico/face.png'.format(ROOTDIR)
        ])
        self.btn_home_bodyays = QPushButton()
        self.home_btns.append([
            self.btn_home_bodyays, 0, 2, 1, 1, '人体分析', 'btn_home_bodyays', 80,
            60, '{}/Ico/bodyays.png'.format(ROOTDIR)
        ])
        self.btn_home_ocr = QPushButton()
        self.home_btns.append([
            self.btn_home_ocr, 0, 3, 1, 1, '文字识别', 'btn_home_ocr', 80, 60,
            '{}/Ico/ocr.png'.format(ROOTDIR)
        ])
        self.btn_home_imgrec = QPushButton()
        self.home_btns.append([
            self.btn_home_imgrec, 1, 0, 1, 1, '图像识别', 'btn_home_imgrec', 80,
            60, '{}/Ico/imgrec.png'.format(ROOTDIR)
        ])
        self.btn_home_imgsearch = QPushButton()
        self.home_btns.append([
            self.btn_home_imgsearch, 1, 1, 1, 1, '图像搜索', 'btn_home_imgsearch',
            80, 60, '{}/Ico/imgsearch.png'.format(ROOTDIR)
        ])
        self.btn_home_imgup = QPushButton()
        self.home_btns.append([
            self.btn_home_imgup, 1, 2, 1, 1, '图像效果增强', 'btn_home_imgup', 80,
            60, '{}/Ico/imgup.png'.format(ROOTDIR)
        ])
        self.btn_home_nlp = QPushButton()
        self.home_btns.append([
            self.btn_home_nlp, 1, 3, 1, 1, '自然语言处理', 'btn_home_nlp', 80, 60,
            '{}/Ico/nlp.png'.format(ROOTDIR)
        ])
        self.btn_home_kgraph = QPushButton()
        # self.home_btns.append([self.btn_home_kgraph,2,0,1,1,'知识图谱','btn_home_kgraph',80,60,'{}/Ico/kgraph.png'.format(ROOTDIR)])
        self.btn_home_audit = QPushButton()
        # self.home_btns.append([self.btn_home_audit,2,1,1,1,'内容审核','btn_home_audit',80,60,'{}/Ico/audit.png'.format(ROOTDIR)])
        self.btn_home_music = QPushButton()
        # self.home_btns.append([self.btn_home_music,2,2,1,1,'音乐','btn_home_music',80,60,'{}/Ico/music.png'.format(ROOTDIR)])
        self.btn_home_screen = QPushButton()
        self.home_btns.append([
            self.btn_home_screen, 2, 1, 1, 1, '录屏', 'btn_home_music', 80, 60,
            r'{}/Ico/record.png'.format(ROOTDIR)
        ])
        self.btn_home_video = QPushButton()
        self.home_btns.append([
            self.btn_home_video, 2, 0, 1, 1, '视频', 'btn_home_video', 80, 60,
            '{}/Ico/video.png'.format(ROOTDIR)
        ])

        # 为btn设置参数
        for btn in self.home_btns:
            list(
                map(
                    lambda v1, v2, v3, v4, v5: self.glayout_home.addWidget(
                        v1, v2, v3, v4, v4), [btn[0]], [btn[1]], [btn[2]],
                    [btn[3]], [btn[4]]))
            btn[0].setObjectName(btn[6])
            # btn[0].setText(btn[5])
            # btn[0].setFixedSize(btn[7],btn[8])
            # 设置css样式表
            css = ":hover{background-color:%s;}" \
                  "QPushButton{background-color:%s;}" \
                  "QPushButton:pressed{background-color:%s;}" \
                  "QToolTip{color:%s;font:Yahei;font-size:14px}" %(random_color(),random_color(),random_color(),random_color()) # border:0px
            #background-color:%s; random_color(),
            btn[0].setStyleSheet(css)
            btn[0].setToolTip(btn[5])

            btn[0].setIcon(QIcon(btn[9]))
            btn[0].resize(btn[7], btn[8])

            # btn[0].setIconSize(QSize(btn[7], btn[8]))
            h = self.height() * 0.8 / 5
            w = self.width() * 0.8 / 4
            if h > 100: h = 100
            if w > h * 1.3: w = h * 1.3
            if h > w / 1.3: h = w / 1.3
            btn[0].setIconSize(QSize(w, h))
            # 掩膜,不规则图
            # pix = QPixmap(btn[9])
            # btn[0].setFixedSize(pix.size())
            # btn[0].setMask(pix.mask())

            # self.btn_home_voice.clicked.connect(self._init_voice_ui__)
            btn[0].clicked.connect(self.leave_home_event)

        self._home_reload()
Exemple #24
0
        def __init__(self, parent=None):
            super(Widget, self).__init__(parent)
            self.setWindowTitle("Invoer werkorders")
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))

            self.setFont(QFont('Arial', 10))

            self.Omschrijving = QLabel()
            q1Edit = QLineEdit()
            q1Edit.setFont(QFont("Arial", 10))
            q1Edit.textChanged.connect(self.q1Changed)
            reg_ex = QRegExp("^.{0,49}$")
            input_validator = QRegExpValidator(reg_ex, q1Edit)
            q1Edit.setValidator(input_validator)

            self.StartWerk = QLabel()
            q2Edit = QLineEdit()
            q2Edit.setFixedWidth(110)
            q2Edit.setFont(QFont("Arial", 10))
            q2Edit.textChanged.connect(self.q2Changed)
            reg_ex = QRegExp(
                '^[2]{1}[0]{1}[0-9]{2}[-]{1}[0-1]{1}[0-9]{1}[-]{1}[0-3]{1}[0-9]{1}$'
            )
            input_validator = QRegExpValidator(reg_ex, q2Edit)
            q2Edit.setValidator(input_validator)

            self.Artikelnummer = QLabel()
            q3Edit = QLineEdit()
            q3Edit.setFixedWidth(110)
            q3Edit.setFont(QFont("Arial", 10))
            q3Edit.textChanged.connect(self.q3Changed)
            reg_ex = QRegExp("^[2]{1}[0-9]{8}$")
            input_validator = QRegExpValidator(reg_ex, q3Edit)
            q3Edit.setValidator(input_validator)

            self.Hoeveelheid = QLabel()
            q4Edit = QLineEdit()
            q4Edit.setFixedWidth(110)
            q4Edit.setFont(QFont("Arial", 10))
            q4Edit.textChanged.connect(self.q4Changed)
            reg_ex = QRegExp("^[0-9.]{0,20}$")
            input_validator = QRegExpValidator(reg_ex, q4Edit)
            q4Edit.setValidator(input_validator)

            grid = QGridLayout()
            grid.setSpacing(20)

            lbl1 = QLabel('Werkorder')
            lbl1.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            grid.addWidget(lbl1, 1, 0)

            lbl2 = QLabel(str(bepaalWerknr()))
            grid.addWidget(lbl2, 1, 1)

            lbl3 = QLabel('Omschrijving')
            lbl3.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            grid.addWidget(lbl3, 2, 0)
            grid.addWidget(q1Edit, 2, 1, 1, 3)

            lbl4 = QLabel('Start werk')
            lbl4.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            grid.addWidget(lbl4, 3, 0)
            grid.addWidget(q2Edit, 3, 1)

            lbl5 = QLabel('Artikelnummer\n       Halffabrikaat   ')
            lbl5.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            grid.addWidget(lbl5, 4, 0)
            grid.addWidget(q3Edit, 4, 1)

            lbl6 = QLabel('Hoeveelheid')
            lbl6.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            grid.addWidget(lbl6, 5, 0)
            grid.addWidget(q4Edit, 5, 1)

            lbl = QLabel()
            pixmap = QPixmap('./images/logos/verbinding.jpg')
            lbl.setPixmap(pixmap)
            grid.addWidget(lbl, 0, 0, 1, 2)

            logo = QLabel()
            pixmap = QPixmap('./images/logos/logo.jpg')
            logo.setPixmap(pixmap)
            grid.addWidget(logo, 0, 2, 1, 1, Qt.AlignRight)

            grid.addWidget(
                QLabel('\u00A9 2017 all rights reserved [email protected]'),
                7, 0, 1, 3, Qt.AlignCenter)
            self.setLayout(grid)
            self.setGeometry(500, 300, 150, 150)

            applyBtn = QPushButton('Invoer')
            applyBtn.clicked.connect(self.accept)

            grid.addWidget(applyBtn, 6, 2, 1, 1, Qt.AlignRight)
            applyBtn.setFont(QFont("Arial", 10))
            applyBtn.setFixedWidth(100)
            applyBtn.setStyleSheet(
                "color: black;  background-color: gainsboro")

            cancelBtn = QPushButton('Sluiten')
            cancelBtn.clicked.connect(lambda: windowSluit(self, m_email))

            grid.addWidget(cancelBtn, 6, 1, 1, 1, Qt.AlignRight)
            cancelBtn.setFont(QFont("Arial", 10))
            cancelBtn.setFixedWidth(100)
            cancelBtn.setStyleSheet(
                "color: black;  background-color: gainsboro")
Exemple #25
0
    def __init__(self, timing: datetime.datetime):
        super().__init__()

        # Auto Completer Model
        """
        model = QStringListModel(["Remember to wear your mask!", "Please watch the video and exercise!",
                                  "Exercise and watch the video."])
        """

        grid = QGridLayout()
        grid.setHorizontalSpacing(20)
        grid.setVerticalSpacing(20)
        self.setLayout(grid)

        self.new_event = Event()
        self.new_event.timing = timing

        label_name = QLabel("Name:")
        grid.addWidget(label_name, 0, 0)

        self.name_entry = QLineEdit()
        grid.addWidget(self.name_entry, 0, 1)

        label_hour = QLabel("Hour:")
        grid.addWidget(label_hour, 1, 0)

        self.hour_spinbox = QSpinBox()  # Spinbox to Choose Hour
        self.hour_spinbox.setValue(timing.hour)
        self.hour_spinbox.setMaximum(23)
        grid.addWidget(self.hour_spinbox, 1, 1)

        label_minute = QLabel("Minute:")
        grid.addWidget(label_minute, 2, 0)

        self.minute_spinbox = QSpinBox()  # Spinbox to Choose Hour
        self.minute_spinbox.setMaximum(59)
        grid.addWidget(self.minute_spinbox, 2, 1)

        label_suggestions = QLabel("Suggestions:")
        grid.addWidget(label_suggestions, 3, 0)

        try:
            # Suggestions
            self.suggestions: Dict[str, Event] = pickle.load(
                open("suggestions.pickle", "rb"))
            self.suggestions_lst: List[str] = ["NIL"] + sorted(
                self.suggestions.keys())

            self.suggestions_combobox = QComboBox()
            self.suggestions_combobox.addItems(self.suggestions_lst)
            self.suggestions_combobox.currentIndexChanged.connect(
                self.load_suggestion)
            grid.addWidget(self.suggestions_combobox, 3, 1)
        except:
            print(traceback.format_exc())

        label_language = QLabel("Language:")
        grid.addWidget(label_language, 4, 0)

        # Type of Event
        self.languages = ["English", "Chinese"]
        self.language_combobox = QComboBox()
        self.language_combobox.addItems(self.languages)
        self.language_combobox.currentTextChanged.connect(self.change_language)
        grid.addWidget(self.language_combobox, 4, 1)

        label_type = QLabel("Type of Event:")
        grid.addWidget(label_type, 5, 0)

        # Type of Event
        self.types = ["Reminder", "Video"]
        self.type_combobox = QComboBox()
        self.type_combobox.addItems(self.types)
        self.type_combobox.currentTextChanged.connect(self.change_event_type)
        grid.addWidget(self.type_combobox, 5, 1)

        self.label_reminder_type = QLabel("Type of Reminder:")
        grid.addWidget(self.label_reminder_type, 6, 0)

        # Type of Reminder
        self.reminder_types = ["Type Text", "Audio"]
        self.reminder_type_combobox = QComboBox()
        self.reminder_type_combobox.addItems(self.reminder_types)
        self.reminder_type_combobox.currentTextChanged.connect(
            self.change_reminder_type)
        grid.addWidget(self.reminder_type_combobox, 6, 1)

        # Upload Video Button
        self.video_upload_btn = QPushButton("Upload Video")
        self.video_upload_btn.clicked.connect(self.upload_video)
        self.video_upload_btn.hide()
        grid.addWidget(self.video_upload_btn, 6, 0)

        # Url Entry
        self.video_upload_entry = QLineEdit()
        self.video_upload_entry.setToolTip("Enter Url Here")
        self.video_upload_entry.hide()
        grid.addWidget(self.video_upload_entry, 6, 1)

        # Audio Button
        self.audio_upload_btn = QPushButton("Upload Audio")
        self.audio_upload_btn.clicked.connect(self.upload_audio)
        self.audio_upload_btn.hide()
        grid.addWidget(self.audio_upload_btn, 7, 0)

        # Url Entry
        self.audio_upload_entry = QLineEdit()
        self.audio_upload_entry.setToolTip("Enter Url Here")
        self.audio_upload_entry.hide()
        grid.addWidget(self.audio_upload_entry, 7, 1)

        # Label for Type Text
        self.label_text_2_speech = QLabel("Enter Text Here:")
        grid.addWidget(self.label_text_2_speech, 7, 0)

        # Entry for Text
        self.text_entry = QLineEdit()
        """
        auto_completer = QCompleter()
        auto_completer.setModel(model)
        auto_completer.setCompletionMode(QCompleter)
        self.text_entry.setCompleter(auto_completer)  # Setting Autocompleter
        """

        grid.addWidget(self.text_entry, 7, 1)

        # Okay and Cancel Button
        okay_btn = QPushButton("Ok")
        okay_btn.clicked.connect(self.accept)
        grid.addWidget(okay_btn, 8, 0)

        cancel_btn = QPushButton("Cancel")
        cancel_btn.clicked.connect(self.reject)
        grid.addWidget(cancel_btn, 8, 1)
Exemple #26
0
    def __init__(self,user:User):
        super().__init__()
        self.title = 'User Profile'
        
        self.__profile_grid = QGridLayout()
        self.user = user
        self.controller = ProfileController(self.user)
        
        
        
        self.edit_button = QPushButton("Edit")
        self.edit_button.clicked.connect(lambda:self.getFile())
        
        self.change_password = QPushButton("Change Password")
        self.change_password.clicked.connect(lambda:self.changePassword())
        
        self.username = QLabel("Username")
        
    
        self.firstName = QLabel("First Name")
        
        
        self.lastName = QLabel("Last Name")
       
        
        self.user_username = QLabel(self.user.username)
       
    
        self.user_firstName = QLabel(self.user.first_name)
        
        
        self.user_lastName = QLabel(self.user.last_name)
       
        
        self.image = self.user.image
        self.image_label = QLabel()
       
        if(len(self.image) != 0):
            pm = QPixmap()
            pm.loadFromData(base64.b64decode(self.user.image))
            self.image_label.setPixmap(pm)
            self.image_label.setScaledContents(True);

            
#        self.image_label.resize(200,200);
        
        
       
        
        self.spacer= QSpacerItem(20,5)
        
        self.vbox = QVBoxLayout()
        self.vbox.addWidget(self.image_label)
        
        
#        self.__profile_grid.addWidget(self.spacer,0,1)
#        self.__profile_grid.addWidget(self.image_label,0)
#        self.__profile_grid.addWidget(self.edit_button,1,1)
        self.__profile_grid.addWidget(self.username,2,0)
        self.__profile_grid.addWidget(self.user_username,2,1)
        self.__profile_grid.addWidget(self.firstName,3,0)
        self.__profile_grid.addWidget(self.user_firstName,3,1)
        self.__profile_grid.addWidget(self.lastName,4,0)
        self.__profile_grid.addWidget(self.user_lastName,4,1)
#        self.__profile_grid.addWidget(self.change_password,5,1)
        
        self.vbox.addWidget(self.edit_button)
        self.vbox.addLayout(self.__profile_grid)
        self.vbox.addWidget(self.change_password)
        
        
        self.errorMessage = QLabel()
        self.vbox.addWidget(self.errorMessage)
        
        self.setLayout(self.vbox)
    def setupWidgets(self):
        """
        Create widgets for to-do list GUI and arrange them in the window
        """
        # Grid Layout
        main_grid = QGridLayout()
        edit_title = QLabel("Edit Observation")
        edit_title.setFont(QFont('Arial', 20))
        edit_title.setAlignment(Qt.AlignCenter)
        save_button = QPushButton("Save")
        save_button.clicked.connect(self.save_modifications)
        self.gimp_button = QPushButton("Open GIMP")
        self.gimp_button.setDisabled(True)

        try:
            if self.data_dict['clicks_id'] or self.data_dict['clicks_id'] == 0:
                self.gimp_button.setDisabled(False)
                self.gimp_button.clicked.connect(self.open_gimp)

        except Exception as e:
            print(e)
            print("not a click")

        cancel_button = QPushButton("Cancel")

        # Create Section labels for to-do list
        tags_label = QLabel("Tags")
        tags_label.setFont(QFont('Arial', 20))
        tags_label.setAlignment(Qt.AlignCenter)

        fields_label = QLabel("Fields")
        fields_label.setFont(QFont('Arial', 20))
        fields_label.setAlignment(Qt.AlignCenter)

        start_label = QLabel("start:")
        start_label.setAlignment(Qt.AlignRight)

        data_type_label = QLabel("data type:")
        data_type_label.setAlignment(Qt.AlignRight)

        artifact_label = QLabel("artifact:")
        artifact_label.setAlignment(Qt.AlignRight)

        for tag in self.data_dict.keys():
            self.fields_entry[str(tag)] = QTextEdit()

        # Create labels for appointments seciton
        self.start_entry = QTextEdit()
        self.start_entry.setMinimumSize(35, 35)
        self.data_type_entry = QTextEdit()
        self.data_type_entry.setMinimumSize(35, 35)
        self.artifact_entry = QTextEdit()
        self.artifact_entry.setMinimumSize(35, 35)

        fields_grid = QGridLayout()
        fields_grid.setContentsMargins(5, 5, 5, 5)
        fields_grid.addWidget(start_label, 0, 0)
        fields_grid.addWidget(self.start_entry, 0, 1)
        fields_grid.addWidget(data_type_label, 1, 0)
        fields_grid.addWidget(self.data_type_entry, 1, 1)
        fields_grid.addWidget(artifact_label, 2, 0)
        fields_grid.addWidget(self.artifact_entry, 2, 1)

        row = 3

        for tag, field in self.fields_entry.items():
            data_tag = QCheckBox(tag)
            self.data_checkbox[tag] = data_tag
            field.setMinimumSize(35, 35)
            #data_tag.setAlignment(Qt.AlignRight)
            fields_grid.addWidget(data_tag, row, 0)
            fields_grid.addWidget(field, row, 1)
            row += 1

        # Add other layouts to main grid layout
        main_grid.addWidget(edit_title, 0, 0, 1, 2)
        main_grid.addLayout(fields_grid, 1, 0)
        main_grid.addWidget(save_button, 2, 0)
        main_grid.addWidget(self.gimp_button, 3, 0)

        self.scroll = QScrollArea()
        self.widget = QWidget()
        self.vbox = QVBoxLayout()

        self.vbox.addLayout(main_grid)

        self.widget.setLayout(self.vbox)

        self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(self.widget)

        self.setCentralWidget(self.scroll)
    def createShadowsocksSettingPanel(self):
        labelEmail = QLabel(
            self.translate("OutboundShadowsocksPanel", "Email: "), self)
        self.lineEditOutShadowsocksEmail = QLineEdit()
        labelAddress = QLabel(
            self.translate("OutboundShadowsocksPanel", "Server Address: "),
            self)
        self.lineEditOutShadowsocksAddress = QLineEdit()
        labelPort = QLabel(
            self.translate("OutboundShadowsocksPanel", "Port: "), self)
        self.spinBoxOutShadowsocksPort = QSpinBox()
        labelMethod = QLabel(
            self.translate("OutboundShadowsocksPanel", "Method: "), self)
        labelPassword = QLabel(
            self.translate("OutboundShadowsocksPanel", "Password: "******"OutboundShadowsocksPanel", "One Time Auth (OTA)"),
            self)

        labeluserLevel = QLabel(
            self.translate("OutboundShadowsocksPanel", "User Level: "))
        self.spinBoxOutShadowsocksuserLevel = QSpinBox()
        self.spinBoxOutShadowsocksuserLevel.setRange(0, 65535)
        self.spinBoxOutShadowsocksuserLevel.setValue(0)

        hboxspinboxuserLevel = QHBoxLayout()
        hboxspinboxuserLevel.addWidget(self.spinBoxOutShadowsocksuserLevel)
        hboxspinboxuserLevel.addStretch()

        self.spinBoxOutShadowsocksPort.setRange(0, 65535)
        self.spinBoxOutShadowsocksPort.setValue(495)
        self.comboBoxOutShadowsocksMethod.addItems(
            self.listMethodShadowsocksPanel)

        gridLayout = QGridLayout()
        gridLayout.addWidget(labelEmail, 0, 0)
        gridLayout.addWidget(self.lineEditOutShadowsocksEmail, 0, 1)
        gridLayout.addWidget(labelAddress, 1, 0)
        gridLayout.addWidget(self.lineEditOutShadowsocksAddress, 1, 1)
        gridLayout.addWidget(labelPort, 1, 2)
        gridLayout.addWidget(self.spinBoxOutShadowsocksPort, 1, 3)
        gridLayout.addWidget(labelMethod, 2, 0)
        gridLayout.addWidget(self.comboBoxOutShadowsocksMethod, 2, 1)
        gridLayout.addWidget(labelPassword, 3, 0)
        gridLayout.addWidget(self.lineEditOutShadowsocksPassword, 3, 1)
        gridLayout.addWidget(labeluserLevel, 4, 0)
        gridLayout.addLayout(hboxspinboxuserLevel, 4, 1)
        gridLayout.addWidget(self.checkBoxOutShadowsocksOTA, 5, 0)

        vboxShadowsocksSettingPanel = QVBoxLayout()
        vboxShadowsocksSettingPanel.addLayout(gridLayout)
        vboxShadowsocksSettingPanel.addLayout(
            self.createShadowsocksTableWidget())

        groupBoxShadowsocksSetting = QGroupBox(
            self.translate("OutboundShadowsocksPanel", "Shadowsocks"), self)
        groupBoxShadowsocksSetting.setLayout(vboxShadowsocksSettingPanel)

        if (v2rayshellDebug):
            self.__btnDebug = QPushButton("__DebugTest", self)
            vboxShadowsocksSettingPanel.addWidget(self.__btnDebug)
            self.__btnDebug.clicked.connect(self.__DebugTest)
            self.settingOutboundShadowsocksPanelFromJSONFile(
                self.outboundShadowsocksJSONFile, True)

        self.createOutShadowsocksSignales()

        return groupBoxShadowsocksSetting
Exemple #29
0
    def __init__(self, *args, **kwargs):
        QWidget.__init__(self, None, Qt.WindowStaysOnTopHint, *args, **kwargs)

        self.ImgOriginSelector = ImgOriginSelector(self)
        self.select_coords_thread = SelectCoordsThread(self)
        self.ImageDrawingThread = ImageDrawingThread(self)

        self.layout = QGridLayout()
        self.resize(350, 440)
        self.setWindowTitle("AutoSkribbler")
        self.headline = QLabel("AutoSkribbler", self)
        self.headline.setFont(QFont("Sans Serif", 20, 600))
        self.headline.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Expanding)
        self.headline.setAlignment(Qt.AlignHCenter)
        self.layout.addWidget(self.headline, 0, 0)

        self.groupbox = QGroupBox("Coordinates")
        self.vbox = QVBoxLayout()
        self.coordCanvas = QLabel("Canvas (top left): ")
        self.coordColors = QLabel("Colors (top left): ")
        self.vbox.addWidget(self.coordCanvas)
        self.vbox.addWidget(self.coordColors)
        self.groupbox.setLayout(self.vbox)
        self.layout.addWidget(self.groupbox, 1, 0)

        self.selImgGroupbox = QGroupBox("Selected Image")
        self.vboxSelImg = QVBoxLayout()
        self.imgPreview = QLabel()
        self.imgPreview.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Expanding)
        self.imgPreview.setAlignment(Qt.AlignHCenter)

        # self.imgPreviewScene = QGraphicsScene()
        # self.imgPreview = QGraphicsView(self.imgPreviewScene)
        self.vboxSelImg.addWidget(self.imgPreview)
        self.selImgGroupbox.setLayout(self.vboxSelImg)
        self.layout.addWidget(self.selImgGroupbox, 2, 0)

        self.currentActionLabel = QLabel(" ")
        self.currentActionLabel.setFont(QFont("Sans Serif", 16, 600))
        self.currentActionLabel.setSizePolicy(QSizePolicy.Expanding,
                                              QSizePolicy.Expanding)
        self.currentActionLabel.setAlignment(Qt.AlignHCenter)
        self.layout.addWidget(self.currentActionLabel, 4, 0)

        self.currentActionSubLabel = QLabel(" ")
        self.currentActionSubLabel.setSizePolicy(QSizePolicy.Expanding,
                                                 QSizePolicy.Expanding)
        self.currentActionSubLabel.setAlignment(Qt.AlignHCenter)
        self.layout.addWidget(self.currentActionSubLabel, 5, 0)

        self.useImgWorkaroundCheckbox = QCheckBox(
            "Use google images workaround (slow)")
        self.layout.addWidget(self.useImgWorkaroundCheckbox, 6, 0)

        self.buttonbox = QHBoxLayout()
        self.btnSetCoords = QPushButton("Set Coords")
        self.btnSetCoords.clicked.connect(self.set_coords_btn_click)
        self.btnSelImg = QPushButton("Select Image")
        self.btnSelImg.clicked.connect(self.sel_img_btn_click)
        self.btnStartDraw = QPushButton("Start Drawing")
        self.btnStartDraw.clicked.connect(self.start_draw_btn_click)
        self.buttonbox.addWidget(self.btnSetCoords)
        self.buttonbox.addWidget(self.btnSelImg)
        self.buttonbox.addWidget(self.btnStartDraw)
        self.layout.addLayout(self.buttonbox, 7, 0)

        self.setLayout(self.layout)
        self.show()

        self.img_cache = []

        self.coords = {
            "canvasTopLeft": None,
            "colorsTopLeft": None,
        }

        self.actions = ["canvasTopLeft", "colorsTopLeft"]
        self.imgPath = None
        self.imgObj: Image = None
        self.preferLocalImg = True  # whether to prefer a local image over a grabbed image
Exemple #30
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        # Initialize main-widgets

        # 画像をスライドするボタンの設定
        self.prevButton = QPushButton('&Prev')
        self.prevButton.clicked.connect(self.showPrevImage)
        self.prevButton.setShortcut(QtCore.Qt.Key_Left)

        self.nextButton = QPushButton('&Next')
        self.nextButton.clicked.connect(self.showNextImage)
        self.nextButton.setShortcut(QtCore.Qt.Key_Right)

        buttonLayout = QGridLayout()
        buttonLayout.addWidget(self.prevButton, 0, 0)
        buttonLayout.addWidget(self.nextButton, 0, 1)

        # 画像を表示するラベルの設定
        self.pictureLabel = QLabel()
        self.pictureLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.putPixmap('startimage.png')

        self.indexLabel = QLabel('')
        self.indexLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.pathLabel = QLabel('')
        self.pathLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.classLabel = QLabel('')
        self.classLabel.setAlignment(QtCore.Qt.AlignCenter)
        classLabelFont = QFont()
        classLabelFont.setPointSize(32)
        self.classLabel.setFont(classLabelFont)

        pictureLayout = QGridLayout()
        pictureLayout.addWidget(self.indexLabel, 0, 0)
        pictureLayout.addWidget(self.pictureLabel, 1, 0)
        pictureLayout.addWidget(self.pathLabel, 2, 0)
        pictureLayout.addWidget(self.classLabel, 3, 0)

        # アノテーションをするためのボタンの設定
        annotationButtonLayout = QGridLayout()
        for k, conf in enumerate(BUTTON_CONFIG):
            button = QPushButton('&{0} : {1}'.format(conf['class'], conf['key']))
            button.clicked.connect(self.anotateClass)
            button.setShortcut(conf['key'])
            annotationButtonLayout.addWidget(button, 0, k)

        # 画像のパス一覧を表示するためのリスト
        self.treeWidget = QTreeWidget()
        self.treeWidget.setColumnCount(2)
        self.treeWidget.setHeaderLabels(['#', 'filepath', 'class', 'corrected'])
        self.treeWidget.itemSelectionChanged.connect(self.showImageFromTree)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(pictureLayout)
        mainLayout.addLayout(annotationButtonLayout)
        mainLayout.addLayout(buttonLayout)

        topLayout = QHBoxLayout()
        topLayout.addWidget(self.treeWidget)
        topLayout.addLayout(mainLayout)

        topWidget = QWidget()
        topWidget.setLayout(topLayout)
        self.setCentralWidget(topWidget)
        self.setWindowTitle('koala')

        # Initialize menu bar and status bar
        openAction = QAction('&Open', self)
        openAction.setShortcut('Ctrl+O')
        openAction.setStatusTip('Open annotation file')
        openAction.triggered.connect(self.openAnnotationFile)

        saveAction = QAction('&Save', self)
        saveAction.setShortcut('Ctrl+S')
        saveAction.setStatusTip('Save annotation file')
        saveAction.triggered.connect(self.saveAnnotationFile)

        newSaveAction = QAction('&Save As', self)
        newSaveAction.setShortcut('Ctrl+Shift+S')
        newSaveAction.setStatusTip('Save annotation as new file')
        newSaveAction.triggered.connect(self.newSaveAnnotationFile)

        addImageAction = QAction('&Add Image', self)
        addImageAction.setShortcut('Ctrl+I')
        addImageAction.setStatusTip('Add image files')
        addImageAction.triggered.connect(self.addImageFile)

        self.statusBar()

        menuBar = self.menuBar()
        fileMenu = menuBar.addMenu('&File')
        fileMenu.addAction(openAction)
        fileMenu.addAction(saveAction)
        fileMenu.addAction(newSaveAction)
        fileMenu.addAction(addImageAction)

        # Initialize image annotation information list
        self.imageDataList = []
        self.imageIndex = 0

        # 開いているファイルのパス
        self.openingFilePath = ''