def _setupUi(self):
     self.resize(340, 165)
     self.setWindowTitle(tr("Re-assign Account"))
     self.verticalLayout = QVBoxLayout(self)
     self.label = QLabel(self)
     self.label.setWordWrap(True)
     self.label.setText(tr(
         "You\'re about to delete a non-empty account. Select an account to re-assign its "
         "transactions to."
     ))
     self.verticalLayout.addWidget(self.label)
     self.accountComboBoxView = QComboBox(self)
     sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.accountComboBoxView.sizePolicy().hasHeightForWidth())
     self.accountComboBoxView.setSizePolicy(sizePolicy)
     self.accountComboBoxView.setMinimumSize(QSize(200, 0))
     self.verticalLayout.addWidget(self.accountComboBoxView)
     spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
     self.verticalLayout.addItem(spacerItem)
     self.horizontalLayout = QHBoxLayout()
     spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem1)
     self.cancelButton = QPushButton(self)
     self.cancelButton.setText(tr("Cancel"))
     self.cancelButton.setShortcut("Esc")
     self.horizontalLayout.addWidget(self.cancelButton)
     self.continueButton = QPushButton(self)
     self.continueButton.setDefault(True)
     self.continueButton.setText(tr("Continue"))
     self.horizontalLayout.addWidget(self.continueButton)
     self.verticalLayout.addLayout(self.horizontalLayout)
Exemple #2
0
 def _setupUi(self):
     self.resize(400, 300)
     self.verticalLayout = QVBoxLayout(self)
     self.verticalLayout.setSpacing(0)
     self.verticalLayout.setContentsMargins(0, 0, 0, 0)
     self.filterBar = RadioBox(self)
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.filterBar.sizePolicy().hasHeightForWidth())
     self.filterBar.setSizePolicy(sizePolicy)
     self.filterBar.setMinimumSize(QtCore.QSize(0, 20))
     self.verticalLayout.addWidget(self.filterBar)
     self.tableView = TableView(self)
     self.tableView.setAcceptDrops(True)
     self.tableView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed)
     self.tableView.setDragEnabled(True)
     self.tableView.setDragDropMode(QAbstractItemView.InternalMove)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setSortingEnabled(True)
     self.tableView.setCornerButtonEnabled(False)
     self.tableView.horizontalHeader().setHighlightSections(False)
     self.tableView.horizontalHeader().setMinimumSectionSize(18)
     self.tableView.verticalHeader().setVisible(False)
     self.tableView.verticalHeader().setDefaultSectionSize(18)
     self.verticalLayout.addWidget(self.tableView)
 def _setupUi(self):
     self.resize(259, 32)
     self.horizontalLayout = QHBoxLayout(self)
     self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
     self.prevButton = QPushButton(self)
     icon = QIcon()
     icon.addPixmap(QPixmap(":/nav_left_9"), QIcon.Normal, QIcon.Off)
     self.prevButton.setIcon(icon)
     self.horizontalLayout.addWidget(self.prevButton)
     self.typeButton = QPushButton("<date range>")
     sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.typeButton.sizePolicy().hasHeightForWidth())
     self.typeButton.setSizePolicy(sizePolicy)
     self.typeButton.setMinimumSize(QSize(0, 0))
     self.typeButton.setMaximumSize(QSize(16777215, 16777215))
     self.typeButton.setIconSize(QSize(6, 6))
     self.horizontalLayout.addWidget(self.typeButton)
     self.nextButton = QPushButton(self)
     icon1 = QIcon()
     icon1.addPixmap(QPixmap(":/nav_right_9"), QIcon.Normal, QIcon.Off)
     self.nextButton.setIcon(icon1)
     self.horizontalLayout.addWidget(self.nextButton)
     self.horizontalLayout.setStretch(1, 1)
 def __init__(self, parent=None):
     QGraphicsView.__init__(self, parent)
     self.updateSecs = 0.5
     # Border
     self.setLineWidth(0)
     self.setFrameShape(QtWidgets.QFrame.NoFrame)
     # Size
     sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     sizePolicy.setHeightForWidth(True)
     self.setSizePolicy(sizePolicy)
     # No scrollbars
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     # Scene
     self.scene = QGraphicsScene()
     self.setScene(self.scene)
     self.setBackgroundBrush(QColor("black"))
     # Text of clock
     self.textItem = QGraphicsTextItem()
     self.textItem.color = QColor(QColor("black"))
     self.textItem.setFont(QFont("Segoe UI", 80))
     self.textItem.setDefaultTextColor(QColor("white"))
     self.textItem.setHtml("")
     self.textItem.setZValue(20)
     self.scene.addItem(self.textItem)
     # Start ticking
     self.start()
Exemple #5
0
 def group_tasks_list(self):
     """Define the Tasks Group arrangement."""
     gb_tasks = QGroupBox(self.central_widget)
     gb_tasks.setTitle(self.tr('List of Conversion Tasks'))
     sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(gb_tasks.sizePolicy().hasHeightForWidth())
     gb_tasks.setSizePolicy(sizePolicy)
     hl = QHBoxLayout(gb_tasks)
     self.tb_tasks = QTableWidget(gb_tasks)
     self.tb_tasks.setColumnCount(4)
     self.tb_tasks.setRowCount(0)
     self.tb_tasks.setSelectionMode(QAbstractItemView.SingleSelection)
     self.tb_tasks.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tb_tasks.horizontalHeader().setSectionResizeMode(
         0, QHeaderView.Stretch)
     self.tb_tasks.setHorizontalHeaderLabels(
         [self.tr('File Name'),
          self.tr('Duration'),
          self.tr('Target Quality'),
          self.tr('Progress')])
     self.tb_tasks.cellClicked.connect(self._enable_remove_file_action)
     # Create a combo box for Target quality
     self.tb_tasks.setItemDelegate(TargetQualityDelegate(parent=self))
     hl.addWidget(self.tb_tasks)
     self.vl2.addWidget(gb_tasks)
     self.tb_tasks.doubleClicked.connect(self.update_edit_triggers)
Exemple #6
0
 def __init__(self,position=None,parent=None,value=0):
     #super(OrbButton,self).__init__(parent)
     super().__init__(parent)
     self.value = Orb.Null if value==0 else value
     self.parent = parent
     if position == None:
         pol = QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Fixed)
         pol.setHeightForWidth(True)
         self.setSizePolicy(pol)
         if self.value == Orb.Null:
             p = self.palette()
             p.setColor(self.backgroundRole(),QColor(205,127,50,254))
             self.setPalette(p)
             self.setAutoFillBackground(True)
     else:
         self.setSizePolicy(QSizePolicy())
         self.position = position
         self.pressed.connect(self.onClick)
         p = self.palette()
         if (position[0]+position[1]) % 2 != 0:
             p.setColor(self.backgroundRole(),QColor(205,127,50,254))
         else:
             p.setColor(self.backgroundRole(),QColor(128,70,27,254))
         self.setPalette(p)
         self.setAutoFillBackground(1)
    def __init__(self, buf, parent=None):
        super(HexViewWidget, self).__init__()
        self.setupUi(self)
        self._buf = buf
        self._model = HexTableModel(self._buf)

        self._colored_regions = intervaltree.IntervalTree()
        self._origins = []

        # ripped from pyuic5 ui/hexview.ui
        #   at commit 6c9edffd32706097d7eba8814d306ea1d997b25a
        # so we can add our custom HexTableView instance
        self.view = HexTableView(self)
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.view.sizePolicy().hasHeightForWidth())
        self.view.setSizePolicy(sizePolicy)
        self.view.setMinimumSize(QSize(660, 0))
        self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.view.setSelectionMode(QAbstractItemView.NoSelection)
        self.view.setShowGrid(False)
        self.view.setWordWrap(False)
        self.view.setObjectName("view")
        self.view.horizontalHeader().setDefaultSectionSize(25)
        self.view.horizontalHeader().setMinimumSectionSize(25)
        self.view.verticalHeader().setDefaultSectionSize(21)
        self.mainLayout.insertWidget(0, self.view)
        # end rip

        # TODO: provide a HexViewWidget.setModel method, and don't build it ourselves
        self.view.setModel(self._model)
        for i in range(0x10):
            self.view.setColumnWidth(i, 25)
        self.view.setColumnWidth(0x10, 12)
        for i in range(0x11, 0x22):
            self.view.setColumnWidth(i, 11)

        self._hsm = HexItemSelectionModel(self._model, self.view)
        self.view.setSelectionModel(self._hsm)

        self.view.setContextMenuPolicy(Qt.CustomContextMenu)
        self.view.customContextMenuRequested.connect(self._handle_context_menu_requested)

        self._hsm.selectionRangeChanged.connect(self._handle_selection_range_changed)

        self.originsChanged.connect(self._handle_origins_changed)

        self.view.moveKeyPressed.connect(self._hsm.handle_move_key)
        self.view.selectKeyPressed.connect(self._hsm.handle_select_key)

        f = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.view.setFont(f)
        self.statusLabel.setFont(f)

        self.view.setItemDelegate(HexItemDelegate(self._model, self))

        self.statusLabel.setText("")
Exemple #8
0
    def initUI(self):
        self.setObjectName("naviBar")

        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)

        self.vboxList = QVBoxLayout(self)
        self.vboxList.setContentsMargins(0, 0, 0, 0)
        self.vboxList.setSpacing(6)
        self.initBtnList(self.vboxList)
Exemple #9
0
 def _setupUi(self):
     self.resize(483, 423)
     self.verticalLayout = QVBoxLayout(self)
     self.verticalLayout.setSpacing(0)
     self.verticalLayout.setContentsMargins(0, 0, 0, 0)
     self.horizontalLayout = QHBoxLayout()
     self.horizontalLayout.setSpacing(0)
     self.filterBar = RadioBox(self)
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.filterBar.sizePolicy().hasHeightForWidth())
     self.filterBar.setSizePolicy(sizePolicy)
     self.horizontalLayout.addWidget(self.filterBar)
     self.horizontalLayout.addItem(horizontalSpacer())
     self.reconciliationButton = QPushButton(tr("Reconciliation"))
     self.reconciliationButton.setCheckable(True)
     self.horizontalLayout.addWidget(self.reconciliationButton)
     self.verticalLayout.addLayout(self.horizontalLayout)
     self.splitterView = QSplitter()
     self.splitterView.setOrientation(Qt.Vertical)
     self.splitterView.setChildrenCollapsible(False)
     self.tableView = TableView(self)
     self.tableView.setAcceptDrops(True)
     self.tableView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed)
     self.tableView.setDragEnabled(True)
     self.tableView.setDragDropMode(QAbstractItemView.InternalMove)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setSortingEnabled(True)
     self.tableView.horizontalHeader().setHighlightSections(False)
     self.tableView.horizontalHeader().setMinimumSectionSize(18)
     self.tableView.verticalHeader().setVisible(False)
     self.tableView.verticalHeader().setDefaultSectionSize(18)
     self.splitterView.addWidget(self.tableView)
     self.graphView = QStackedWidget(self)
     sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.graphView.sizePolicy().hasHeightForWidth())
     self.graphView.setSizePolicy(sizePolicy)
     self.graphView.setMinimumSize(0, 200)
     self.lineGraphView = LineGraphView()
     self.graphView.addWidget(self.lineGraphView)
     self.barGraphView = BarGraphView()
     self.graphView.addWidget(self.barGraphView)
     self.splitterView.addWidget(self.graphView)
     self.graphView.setCurrentIndex(1)
     self.splitterView.setStretchFactor(0, 1)
     self.splitterView.setStretchFactor(1, 0)
     self.verticalLayout.addWidget(self.splitterView)
Exemple #10
0
    def __init__(self,parent = None,ImgComp = None,ImgOut = None):
        super(BrowserComp, self).__init__(parent)
        self.ImgObj = ImgComp
        self.ImgOut = ImgOut
        self.webView = QtWebKitWidgets.QWebView(self)
        setting =  self.webView.settings()
        print os.path.join(currDir, "user", "Blocks")
        print setting.setLocalStoragePath(os.path.join(currDir,"user","Blocks"))
        print setting.localStoragePath()
        print setting.defaultTextEncoding()
        
        #sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        #sizePolicy.setHorizontalStretch(1)
        #sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.webView.sizePolicy().hasHeightForWidth())
        self.webView.setSizePolicy(sizePolicy)

        self.webView.setObjectName("webView")
        path = os.path.abspath(os.path.dirname(__file__) )
        url = "file:///{0}".format(os.path.join(path,"lib","editor","index.html").replace("\\","/"))
        
        
        qurl = QUrl(url)
        self.webView.load(qurl)
        # http://nullege.com/codes/search/PyQt5.QtWebKitWidgets.QWebView.loadFinished.connect
        self.webView.loadFinished.connect(self.on_webView_loadFinished)
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.webView)


        self.button = QPushButton("&Execute")
        self.button.clicked.connect(self.executeScript)

        self.button_open = QPushButton("&Open")
        self.button_open.clicked.connect(self.openBlocks)

        self.button_save = QPushButton("&Save")
        self.button_save.clicked.connect(self.saveBlocks)

        #タイマーを設定.
        self.timer = QTimer(parent=self)
        self.timer.setInterval(1*1000)
        self.timer.timeout.connect(self.selectingBlock)
        self.timer.start()

        self.mainLayout.addWidget(self.button)
        self.mainLayout.addWidget(self.button_open)
        self.mainLayout.addWidget(self.button_save)
        self.setLayout(self.mainLayout)
Exemple #11
0
 def _setupPreferenceWidgets(self):
     scanTypeLabels = [
         tr("Filename"),
         tr("Contents"),
         tr("Folders"),
     ]
     self._setupScanTypeBox(scanTypeLabels)
     self._setupFilterHardnessBox()
     self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
     self.widget = QWidget(self)
     self.widget.setMinimumSize(QSize(0, 136))
     self.verticalLayout_4 = QVBoxLayout(self.widget)
     self._setupAddCheckbox('wordWeightingBox', tr("Word weighting"), self.widget)
     self.verticalLayout_4.addWidget(self.wordWeightingBox)
     self._setupAddCheckbox('matchSimilarBox', tr("Match similar words"), self.widget)
     self.verticalLayout_4.addWidget(self.matchSimilarBox)
     self._setupAddCheckbox('mixFileKindBox', tr("Can mix file kind"), self.widget)
     self.verticalLayout_4.addWidget(self.mixFileKindBox)
     self._setupAddCheckbox('useRegexpBox', tr("Use regular expressions when filtering"), self.widget)
     self.verticalLayout_4.addWidget(self.useRegexpBox)
     self._setupAddCheckbox('removeEmptyFoldersBox', tr("Remove empty folders on delete or move"), self.widget)
     self.verticalLayout_4.addWidget(self.removeEmptyFoldersBox)
     self.horizontalLayout_2 = QHBoxLayout()
     self._setupAddCheckbox('ignoreSmallFilesBox', tr("Ignore files smaller than"), self.widget)
     self.horizontalLayout_2.addWidget(self.ignoreSmallFilesBox)
     self.sizeThresholdEdit = QLineEdit(self.widget)
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.sizeThresholdEdit.sizePolicy().hasHeightForWidth())
     self.sizeThresholdEdit.setSizePolicy(sizePolicy)
     self.sizeThresholdEdit.setMaximumSize(QSize(50, 16777215))
     self.horizontalLayout_2.addWidget(self.sizeThresholdEdit)
     self.label_6 = QLabel(self.widget)
     self.label_6.setText(tr("KB"))
     self.horizontalLayout_2.addWidget(self.label_6)
     spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout_2.addItem(spacerItem1)
     self.verticalLayout_4.addLayout(self.horizontalLayout_2)
     self._setupAddCheckbox(
         'ignoreHardlinkMatches',
         tr("Ignore duplicates hardlinking to the same file"), self.widget
     )
     self.verticalLayout_4.addWidget(self.ignoreHardlinkMatches)
     self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"), self.widget)
     self.verticalLayout_4.addWidget(self.debugModeBox)
     self.widgetsVLayout.addWidget(self.widget)
     self._setupBottomPart()
    def __init__(self, doc, parent=None):
        super(PartToolBar, self).__init__(parent)
        self.doc = doc

        # Set the appearance
        _sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        _sizePolicy.setHorizontalStretch(0)
        _sizePolicy.setVerticalStretch(0)
        _sizePolicy.setHeightForWidth(_sizePolicy.hasHeightForWidth())
        self.setSizePolicy(_sizePolicy)
        self.setOrientation(Qt.Vertical)  # default is horizontal
        # _maxH = 40 if app().prefs.show_icon_labels else 30
        # self.setMaximumHeight(_maxH) # horizontal
        self.setMaximumWidth(36)  # vertical
        self.setIconSize(QSize(20, 20))
        self.setLayoutDirection(Qt.LeftToRight)

        if app().prefs.show_icon_labels:
            self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Toolbar Label
        self.action_toolbar_label = self.setupLabel("Add\nPart:", "action_new_honeycomb_part")

        # Origami ToolButton
        self.add_origamipart_button = self.setupToolButton(
            "Origami", None, "add_origamipart_button", ":/parttools/new-origami"
        )

        # Origami Part (Honeycomb)
        self.action_new_honeycomb_part = self.setupAction(
            "Hcomb", None, "action_new_honeycomb_part", ":/parttools/new-honeycomb", self.add_origamipart_button
        )
        self.action_new_honeycomb_part.triggered.connect(self.doc.controller().actionAddHoneycombPartSlot)
        # Origami Part (Square)
        self.action_new_square_part = self.setupAction(
            "Square", None, "action_new_square_part", ":/parttools/new-square", self.add_origamipart_button
        )
        self.action_new_square_part.triggered.connect(self.doc.controller().actionAddSquarePartSlot)
        # Origami Part (H-PX)
        self.action_new_hpx_part = self.setupAction(
            "H-PX", None, "action_new_honeypx_part", ":/parttools/new-hpx", self.add_origamipart_button
        )
        self.action_new_hpx_part.triggered.connect(self.doc.controller().actionAddHpxPartSlot)
        # Origami Part (S-px)
        self.action_new_spx_part = self.setupAction(
            "Sq-PX", None, "action_new_squarepx_part", ":/parttools/new-spx", self.add_origamipart_button
        )
        self.action_new_spx_part.triggered.connect(self.doc.controller().actionAddSpxPartSlot)
Exemple #13
0
    def group_settings(self):
        """Settings group."""
        gb_settings = QGroupBox(self.central_widget)
        gb_settings.setTitle(self.tr('Conversion Presets'))
        size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            gb_settings.sizePolicy().hasHeightForWidth())
        gb_settings.setSizePolicy(size_policy)
        hl = QHBoxLayout(gb_settings)
        vl = QVBoxLayout()
        hl1 = QHBoxLayout()
        label = QLabel(self.tr('Convert to:'))
        hl1.addWidget(label)
        spacer_item = QSpacerItem(40,
                                  20,
                                  QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        hl1.addItem(spacer_item)
        vl.addLayout(hl1)
        self.cb_profiles = QComboBox(
            gb_settings,
            statusTip=self.tr('Select the desired video format'))
        self.cb_profiles.setMinimumSize(QSize(200, 0))
        vl.addWidget(self.cb_profiles)
        hl2 = QHBoxLayout()
        label = QLabel(self.tr('Target Quality:'))
        hl2.addWidget(label)
        spacerItem1 = QSpacerItem(40,
                                  20,
                                  QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        hl2.addItem(spacerItem1)
        vl.addLayout(hl2)
        self.cb_presets = QComboBox(
            gb_settings,
            statusTip=self.tr('Select the desired video quality'))
        self.cb_presets.setMinimumSize(QSize(200, 0))

        self.cb_profiles.currentIndexChanged.connect(partial(
            self.populate_presets, self.cb_presets))

        self.cb_presets.activated.connect(self.update_media_files_status)

        vl.addWidget(self.cb_presets)
        hl.addLayout(vl)
        self.vl1.addWidget(gb_settings)
 def _setupUi(self):
     self.setWindowTitle(tr("Custom Date Range"))
     self.resize(292, 86)
     self.setModal(True)
     self.verticalLayout = QVBoxLayout(self)
     self.label = QLabel(tr("Select start and end dates from your custom range:"))
     self.verticalLayout.addWidget(self.label)
     self.horizontalLayout = QHBoxLayout()
     self.label_2 = QLabel(tr("Start:"))
     self.horizontalLayout.addWidget(self.label_2)
     self.startDateEdit = DateEdit(self)
     self.horizontalLayout.addWidget(self.startDateEdit)
     self.label_3 = QLabel(tr("End:"))
     self.horizontalLayout.addWidget(self.label_3)
     self.endDateEdit = DateEdit(self)
     self.horizontalLayout.addWidget(self.endDateEdit)
     self.verticalLayout.addLayout(self.horizontalLayout)
     self.horizontalLayout_2 = QHBoxLayout()
     self.label_4 = QLabel(tr("Save this range under slot:"))
     self.horizontalLayout_2.addWidget(self.label_4)
     self.slotIndexComboBox = QComboBox(self)
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.slotIndexComboBox.sizePolicy().hasHeightForWidth())
     self.slotIndexComboBox.setSizePolicy(sizePolicy)
     for s in [tr("None"), tr("#1"), tr("#2"), tr("#3")]:
         self.slotIndexComboBox.addItem(s)
     self.horizontalLayout_2.addWidget(self.slotIndexComboBox)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout_2.addItem(spacerItem)
     self.verticalLayout.addLayout(self.horizontalLayout_2)
     self.horizontalLayout_3 = QHBoxLayout()
     self.label_5 = QLabel(tr("Under the name:"))
     self.horizontalLayout_3.addWidget(self.label_5)
     self.slotNameEdit = QLineEdit(self)
     sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.slotNameEdit.sizePolicy().hasHeightForWidth())
     self.slotNameEdit.setSizePolicy(sizePolicy)
     self.horizontalLayout_3.addWidget(self.slotNameEdit)
     self.verticalLayout.addLayout(self.horizontalLayout_3)
     self.buttonBox = QDialogButtonBox(self)
     self.buttonBox.setOrientation(Qt.Horizontal)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
     self.verticalLayout.addWidget(self.buttonBox)
Exemple #15
0
 def _setupUi(self):
     self.setWindowTitle(tr("Account Info"))
     self.resize(274, 121)
     self.setModal(True)
     self.verticalLayout = QVBoxLayout(self)
     self.formLayout = QFormLayout()
     self.formLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
     self.label = QLabel(tr("Name"))
     self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label)
     self.nameEdit = QLineEdit()
     self.formLayout.setWidget(0, QFormLayout.FieldRole, self.nameEdit)
     self.label_2 = QLabel(tr("Type"))
     self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_2)
     self.typeComboBoxView = QComboBox()
     self.formLayout.setWidget(1, QFormLayout.FieldRole, self.typeComboBoxView)
     self.label_3 = QLabel(tr("Currency"))
     self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_3)
     self.currencyComboBoxView = QComboBox()
     sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.currencyComboBoxView.sizePolicy().hasHeightForWidth())
     self.currencyComboBoxView.setSizePolicy(sizePolicy)
     self.currencyComboBoxView.setEditable(True)
     self.currencyComboBoxView.setInsertPolicy(QComboBox.NoInsert)
     self.formLayout.setWidget(2, QFormLayout.FieldRole, self.currencyComboBoxView)
     self.accountNumberLabel = QLabel(tr("Account #"))
     self.formLayout.setWidget(3, QFormLayout.LabelRole, self.accountNumberLabel)
     self.accountNumberEdit = QLineEdit()
     self.accountNumberEdit.setMaximumSize(QSize(80, 16777215))
     self.formLayout.setWidget(3, QFormLayout.FieldRole, self.accountNumberEdit)
     self.inactiveBox = QCheckBox()
     self.formLayout.addRow(tr("Inactive:"), self.inactiveBox)
     self.notesEdit = QPlainTextEdit()
     self.formLayout.addRow(tr("Notes:"), self.notesEdit)
     self.verticalLayout.addLayout(self.formLayout)
     self.buttonBox = QDialogButtonBox()
     self.buttonBox.setOrientation(Qt.Horizontal)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Save)
     self.verticalLayout.addWidget(self.buttonBox)
     self.label.setBuddy(self.nameEdit)
     self.label_2.setBuddy(self.typeComboBoxView)
     self.label_3.setBuddy(self.currencyComboBoxView)
Exemple #16
0
    def __init__(self, doc, parent=None):
        super(PathToolBar, self).__init__(parent)
        self.doc = doc

        # Set the appearance
        _sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        _sizePolicy.setHorizontalStretch(0)
        _sizePolicy.setVerticalStretch(0)
        _sizePolicy.setHeightForWidth(_sizePolicy.hasHeightForWidth())
        self.setSizePolicy(_sizePolicy)
        self.setOrientation(Qt.Vertical)  # default is horizontal
        # _maxH = 40 if app().prefs.show_icon_labels else 30
        # self.setMaximumHeight(_maxH) # horizontal
        self.setMaximumWidth(46) # vertical
        self.setIconSize(QSize(20, 20))
        self.setLayoutDirection(Qt.LeftToRight)

        if app().prefs.show_icon_labels:
            self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Tools
        self.action_path_select = self.setupAction("Select", "V", "action_path_select", ":/pathtools/select")
        self.action_path_pencil = self.setupAction("Pencil", "N", "action_path_pencil", ":/pathtools/force")
        self.action_path_break = self.setupAction("Nick", "K", "action_path_break", ":/pathtools/nick")
        self.action_path_insertion = self.setupAction("Insert", "I", "action_path_insertion", ":/pathtools/insert")
        self.action_path_skip = self.setupAction("Skip", "S", "action_path_skip", ":/pathtools/skip")
        self.action_path_paint = self.setupAction("Paint", "P", "action_path_paint", ":/pathtools/paint")
        self.action_path_mod = self.setupAction("Mod", "M", "action_path_mod", ":/pathtools/mod")
        self.action_path_add_seq = self.setupAction("Seq", "A", "action_path_add_seq", ":/pathtools/addseq")

        # Separator
        self.addSeparator()

        # Buttons
        self.action_autostaple = self.setupAction("Auto", None, "action_autostaple", ":/pathtools/autostaple")
        self.action_autostaple.triggered.connect(self.doc.controller().actionAutostapleSlot)
        self.action_renumber = self.setupAction("Rnum", None, "action_renumber", ":/parttools/renum")
        self.action_renumber.triggered.connect(self.doc.controller().actionRenumberSlot)
        self.action_svg = self.setupAction("SVG", None, "action_svg", ":/filetools/svg")
        self.action_svg.triggered.connect(self.doc.controller().actionSVGSlot)
        self.action_export = self.setupAction("Export", None, "action_export_staples", ":/filetools/export")
        self.action_export.triggered.connect(self.doc.controller().actionExportSequencesSlot)
 def _setupFilterHardnessBox(self):
     self.filterHardnessHLayout = QHBoxLayout()
     self.filterHardnessLabel = QLabel(self)
     self.filterHardnessLabel.setText(tr("Filter Hardness:"))
     self.filterHardnessLabel.setMinimumSize(QSize(0, 0))
     self.filterHardnessHLayout.addWidget(self.filterHardnessLabel)
     self.filterHardnessVLayout = QVBoxLayout()
     self.filterHardnessVLayout.setSpacing(0)
     self.filterHardnessHLayoutSub1 = QHBoxLayout()
     self.filterHardnessHLayoutSub1.setSpacing(12)
     self.filterHardnessSlider = QSlider(self)
     sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.filterHardnessSlider.sizePolicy().hasHeightForWidth())
     self.filterHardnessSlider.setSizePolicy(sizePolicy)
     self.filterHardnessSlider.setMinimum(1)
     self.filterHardnessSlider.setMaximum(100)
     self.filterHardnessSlider.setTracking(True)
     self.filterHardnessSlider.setOrientation(Qt.Horizontal)
     self.filterHardnessHLayoutSub1.addWidget(self.filterHardnessSlider)
     self.filterHardnessLabel = QLabel(self)
     self.filterHardnessLabel.setText("100")
     self.filterHardnessLabel.setMinimumSize(QSize(21, 0))
     self.filterHardnessHLayoutSub1.addWidget(self.filterHardnessLabel)
     self.filterHardnessVLayout.addLayout(self.filterHardnessHLayoutSub1)
     self.filterHardnessHLayoutSub2 = QHBoxLayout()
     self.filterHardnessHLayoutSub2.setContentsMargins(-1, 0, -1, -1)
     self.moreResultsLabel = QLabel(self)
     self.moreResultsLabel.setText(tr("More Results"))
     self.filterHardnessHLayoutSub2.addWidget(self.moreResultsLabel)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.filterHardnessHLayoutSub2.addItem(spacerItem)
     self.fewerResultsLabel = QLabel(self)
     self.fewerResultsLabel.setText(tr("Fewer Results"))
     self.filterHardnessHLayoutSub2.addWidget(self.fewerResultsLabel)
     self.filterHardnessVLayout.addLayout(self.filterHardnessHLayoutSub2)
     self.filterHardnessHLayout.addLayout(self.filterHardnessVLayout)
Exemple #18
0
    def setupUi(self, YaP):
        YaP.setGeometry(300, 300, 270, 270)
        YaP.setWindowTitle('YaP')
        YaP.show()
        self.gridLayout_3 = QGridLayout(YaP)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.graphicsView = QWidget(YaP)
        self.graphicsView.setObjectName("graphicsView")
        self.graphicsView.setGeometry(0, 0, 270, 270)
        self.graphicsView.setStyleSheet("QWidget { background-color: blue}")
        self.gridLayout_3.addWidget(self.graphicsView, 1, 0, 1, 6)

        self.btn_save = QPushButton(YaP)
        sizePolicy = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.btn_save.sizePolicy().hasHeightForWidth())
        self.btn_save.setSizePolicy(sizePolicy)
        self.btn_save.setMaximumSize(QSize(16777215, 16777215))
        self.btn_save.setObjectName("btn_save")
        self.gridLayout_3.addWidget(self.btn_save, 2, 3, 1, 1)
    def refresh(self):
        libfiles = []
        for filename in os.listdir(self.libpath):
            if filename.endswith('jpeg') or filename.endswith('.jpg'):
                libfiles.append(os.path.join(self.libpath, filename))
        Log.i('files in library:{}'.format(libfiles))

        self.libraryWidgets = []

        sp = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sp.setHorizontalStretch(0)
        sp.setVerticalStretch(0)

        i = -1  # init i in case of libfiles is []
        for i, filepath in enumerate(libfiles):
            col = i % self.columnSize
            row = i // self.columnSize
            widget = GridWidget(self.scrollAreaWidgetContents)
            sp.setHeightForWidth(widget.sizePolicy().hasHeightForWidth())
            widget.setSizePolicy(sp)
            widget.setContent(filepath, (250, 250))
            self.gridLayout.addWidget(
                widget, row, col, Qt.AlignHCenter | Qt.AlignVCenter
            )
            self.libraryWidgets.append(widget)
        while i < 11:
            i += 1
            col = i % self.columnSize
            row = i // self.columnSize
            widget = GridWidget(self.scrollAreaWidgetContents)
            sp.setHeightForWidth(widget.sizePolicy().hasHeightForWidth())
            widget.setSizePolicy(sp)
            widget.setContent('', None)
            self.gridLayout.addWidget(
                widget, row, col, Qt.AlignHCenter | Qt.AlignVCenter
            )
            self.libraryWidgets.append(widget)
Exemple #20
0
 def _setupUi(self):
     self.setWindowTitle(tr("About {}").format(QCoreApplication.instance().applicationName()))
     self.resize(400, 190)
     sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
     self.setSizePolicy(sizePolicy)
     self.horizontalLayout = QHBoxLayout(self)
     self.logoLabel = QLabel(self)
     self.logoLabel.setPixmap(QPixmap(':/%s_big' % self.app.LOGO_NAME))
     self.horizontalLayout.addWidget(self.logoLabel)
     self.verticalLayout = QVBoxLayout()
     self.nameLabel = QLabel(self)
     font = QFont()
     font.setWeight(75)
     font.setBold(True)
     self.nameLabel.setFont(font)
     self.nameLabel.setText(QCoreApplication.instance().applicationName())
     self.verticalLayout.addWidget(self.nameLabel)
     self.versionLabel = QLabel(self)
     self.versionLabel.setText(tr("Version {}").format(QCoreApplication.instance().applicationVersion()))
     self.verticalLayout.addWidget(self.versionLabel)
     self.label_3 = QLabel(self)
     self.verticalLayout.addWidget(self.label_3)
     self.label_3.setText(tr("Licensed under GPLv3"))
     self.label = QLabel(self)
     font = QFont()
     font.setWeight(75)
     font.setBold(True)
     self.label.setFont(font)
     self.verticalLayout.addWidget(self.label)
     self.buttonBox = QDialogButtonBox(self)
     self.buttonBox.setOrientation(Qt.Horizontal)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)
     self.verticalLayout.addWidget(self.buttonBox)
     self.horizontalLayout.addLayout(self.verticalLayout)
Exemple #21
0
 def _setupUi(self):
     self.setWindowTitle(tr("Details"))
     self.resize(502, 295)
     self.setMinimumSize(QSize(250, 250))
     self.verticalLayout = QVBoxLayout(self)
     self.verticalLayout.setSpacing(0)
     self.verticalLayout.setContentsMargins(0, 0, 0, 0)
     self.horizontalLayout = QHBoxLayout()
     self.horizontalLayout.setSpacing(4)
     self.selectedImage = QLabel(self)
     sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.selectedImage.sizePolicy().hasHeightForWidth())
     self.selectedImage.setSizePolicy(sizePolicy)
     self.selectedImage.setScaledContents(False)
     self.selectedImage.setAlignment(Qt.AlignCenter)
     self.horizontalLayout.addWidget(self.selectedImage)
     self.referenceImage = QLabel(self)
     sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.referenceImage.sizePolicy().hasHeightForWidth())
     self.referenceImage.setSizePolicy(sizePolicy)
     self.referenceImage.setAlignment(Qt.AlignCenter)
     self.horizontalLayout.addWidget(self.referenceImage)
     self.verticalLayout.addLayout(self.horizontalLayout)
     self.tableView = DetailsTable(self)
     sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.tableView.sizePolicy().hasHeightForWidth())
     self.tableView.setSizePolicy(sizePolicy)
     self.tableView.setMinimumSize(QSize(0, 188))
     self.tableView.setMaximumSize(QSize(16777215, 190))
     self.tableView.setAlternatingRowColors(True)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setShowGrid(False)
     self.verticalLayout.addWidget(self.tableView)
Exemple #22
0
    def __init__(self, meminfo, parent=None):
        super(HexViewWidget, self).__init__()
        self.setupUi(self)
        self._meminfo = meminfo
        self._model = HexTableModel(self._meminfo)

        self._origins = []

        # ripped from pyuic5 ui/hexview.ui
        #   at commit 6c9edffd32706097d7eba8814d306ea1d997b25a
        # so we can add our custom HexTableView instance
        self.view = HexTableView(self)
        sizePolicy = QSizePolicy(
            QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.view.sizePolicy().hasHeightForWidth())
        self.view.setSizePolicy(sizePolicy)
        self.view.setMinimumSize(QSize(660, 0))
        self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.view.setSelectionMode(QAbstractItemView.NoSelection)
        self.view.setShowGrid(False)
        self.view.setWordWrap(False)
        self.view.setObjectName("view")
        self.view.verticalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)
        self.mainLayout.insertWidget(0, self.view)
        # end rip

        # TODO: provide a HexViewWidget.setModel method, and don't build it
        # ourselves
        self.view.setModel(self._model)
        self.hheader = self.view.horizontalHeader()
        self.hheader.setSectionResizeMode(QHeaderView.ResizeToContents)
        # separator column
        self.hheader.setSectionResizeMode(0x10, QHeaderView.Interactive)
        self.view.setColumnWidth(0x10, 5)

        self._hsm = HexItemSelectionModel(self._model, self.view)
        self.view.setSelectionModel(self._hsm)

        self.view.setContextMenuPolicy(Qt.CustomContextMenu)
        self.view.customContextMenuRequested.connect(
            self._handle_context_menu_requested)

        self._hsm.selectionRangeChanged.connect(
            self._handle_selection_range_changed)

        self.originsChanged.connect(self._handle_origins_changed)

        self.view.moveKeyPressed.connect(self._hsm.handle_move_key)
        self.view.selectKeyPressed.connect(self._hsm.handle_select_key)

        f = QFont("Monospace")
        f = QFontDatabase.systemFont(QFontDatabase.FixedFont)

        self.view.setFont(f)
        self.statusLabel.setFont(f)

        self.view.setItemDelegate(HexItemDelegate(self._model, self))

        self.statusLabel.setText("")
    def setupUi(self):
        self.setObjectName("MainWindow")
        self.setFixedSize(1040, 915)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        icon = QIcon()
        icon.addPixmap(QPixmap('./resource/weather-thunder.png'),QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.centralwidget = QWidget(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
        self.centralwidget.setSizePolicy(sizePolicy)
        self.centralwidget.setObjectName("centralwidget")
        self.layoutWidget = QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QRect(32, 10, 979, 851))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout_5 =QVBoxLayout(self.layoutWidget)
        self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.datetime_label = QLabel(self.layoutWidget)
        self.datetime_label.setObjectName("datetime_label")
        self.horizontalLayout.addWidget(self.datetime_label)
        self.datetime = QDateEdit(self.layoutWidget)
        self.datetime.setDateTime(QDateTime(QDate(self.lastyear, 1, 1), QTime(0, 0, 0)))
        self.datetime.setObjectName("datetime")
        self.horizontalLayout.addWidget(self.datetime)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.target_area_label = QLabel(self.layoutWidget)
        self.target_area_label.setObjectName("target_area_label")
        self.horizontalLayout.addWidget(self.target_area_label)
        self.target_area = QComboBox(self.layoutWidget)
        self.target_area.setObjectName("target_area")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.horizontalLayout.addWidget(self.target_area)
        spacerItem2 = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem2)
        self.verticalLayout_5.addLayout(self.horizontalLayout)
        self.tabWidget = QTabWidget(self.layoutWidget)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
        self.tabWidget.setSizePolicy(sizePolicy)
        self.tabWidget.setObjectName("tabWidget")
        self.density_tab = QWidget()
        self.density_tab.setObjectName("density_tab")
        self.verticalLayout_3 =QVBoxLayout(self.density_tab)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.verticalLayout_2 =QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.density_cell_label = QLabel(self.density_tab)
        self.density_cell_label.setObjectName("density_cell_label")
        self.horizontalLayout_2.addWidget(self.density_cell_label)
        self.density_cell = QSpinBox(self.density_tab)
        self.density_cell.setProperty("value", 10)
        self.density_cell.setObjectName("density_cell")
        self.horizontalLayout_2.addWidget(self.density_cell)
        spacerItem3 = QSpacerItem(40, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        self.density_class_label = QLabel(self.density_tab)
        self.density_class_label.setObjectName("density_class_label")
        self.horizontalLayout_2.addWidget(self.density_class_label)
        self.density_class = QSpinBox(self.density_tab)
        self.density_class.setProperty("value", 10)
        self.density_class.setObjectName("density_class")
        self.horizontalLayout_2.addWidget(self.density_class)
        spacerItem4 = QSpacerItem(478, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.density_mxd = QPushButton(self.density_tab)
        self.density_mxd.setObjectName("density_mxd")
        self.horizontalLayout_2.addWidget(self.density_mxd)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.density_view = QGraphicsView(self.density_tab)
        self.density_view.setObjectName("density_view")
        self.verticalLayout_2.addWidget(self.density_view)
        self.verticalLayout_3.addLayout(self.verticalLayout_2)
        self.tabWidget.addTab(self.density_tab, "")
        self.day_tab = QWidget()
        self.day_tab.setObjectName("day_tab")
        self.verticalLayout_4 =QVBoxLayout(self.day_tab)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.verticalLayout =QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_3 =QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.day_cell_label = QLabel(self.day_tab)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.day_cell_label.sizePolicy().hasHeightForWidth())
        self.day_cell_label.setSizePolicy(sizePolicy)
        self.day_cell_label.setObjectName("day_cell_label")
        self.horizontalLayout_3.addWidget(self.day_cell_label)
        self.day_cell = QSpinBox(self.day_tab)
        self.day_cell.setProperty("value", 15)
        self.day_cell.setObjectName("day_cell")
        self.horizontalLayout_3.addWidget(self.day_cell)
        spacerItem5 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem5)
        self.day_class_label = QLabel(self.day_tab)
        self.day_class_label.setObjectName("day_class_label")
        self.horizontalLayout_3.addWidget(self.day_class_label)
        self.day_class = QSpinBox(self.day_tab)
        self.day_class.setProperty("value", 10)
        self.day_class.setObjectName("day_class")
        self.horizontalLayout_3.addWidget(self.day_class)
        spacerItem6 = QSpacerItem(478, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem6)
        self.day_mxd = QPushButton(self.day_tab)
        self.day_mxd.setObjectName("day_mxd")
        self.horizontalLayout_3.addWidget(self.day_mxd)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.day_view = QGraphicsView(self.day_tab)
        self.day_view.setObjectName("day_view")
        self.verticalLayout.addWidget(self.day_view)
        self.verticalLayout_4.addLayout(self.verticalLayout)
        self.tabWidget.addTab(self.day_tab, "")
        self.verticalLayout_5.addWidget(self.tabWidget)
        self.horizontalLayout_4 =QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.progressBar = QProgressBar(self.layoutWidget)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth())
        self.progressBar.setSizePolicy(sizePolicy)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName("progressBar")
        self.horizontalLayout_4.addWidget(self.progressBar)
        self.execute_button = QPushButton(self.layoutWidget)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.execute_button.sizePolicy().hasHeightForWidth())
        self.execute_button.setSizePolicy(sizePolicy)
        self.execute_button.setObjectName("execute_button")
        self.horizontalLayout_4.addWidget(self.execute_button)
        self.verticalLayout_5.addLayout(self.horizontalLayout_4)
        self.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 1040, 26))
        self.menubar.setObjectName("menubar")
        self.file_menu = QMenu(self.menubar)
        self.file_menu.setObjectName("file_menu")
        self.help_menu = QMenu(self.menubar)
        self.help_menu.setObjectName("help_menu")
        self.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)
        self.action_add_data = QAction(self)
        self.action_add_data.setObjectName("action_add_data")
        self.action_help = QAction(self)
        self.action_help.setObjectName("action_help")
        self.action_about = QAction(self)
        self.action_about.setObjectName("action_about")
        self.action_save_pic = QAction(self)
        self.action_save_pic.setObjectName("action_save_pic")
        self.file_menu.addAction(self.action_add_data)
        self.file_menu.addAction(self.action_save_pic)
        self.help_menu.addAction(self.action_help)
        self.help_menu.addAction(self.action_about)
        self.menubar.addAction(self.file_menu.menuAction())
        self.menubar.addAction(self.help_menu.menuAction())

        self.retranslateUi()
        self.tabWidget.setCurrentIndex(0)
        QMetaObject.connectSlotsByName(self)
        self.center()
        self.show()

        self.target_area.activated[str].connect(self.updateTargetArea)
        self.datetime.dateChanged.connect(self.updateDatetime)
        self.density_cell.valueChanged.connect(self.updateDensityCell)
        self.density_class.valueChanged.connect(self.updateDensityClass)
        self.day_cell.valueChanged.connect(self.updateDayCell)
        self.day_class.valueChanged.connect(self.updateDayClass)

        self.action_add_data.triggered.connect(self.addData)
        self.action_save_pic.triggered.connect(self.savePic)
        self.action_about.triggered.connect(self.showAbout)
        self.action_help.triggered.connect(self.showHelp)
        self.execute_button.clicked.connect(self.execute)
        self.density_mxd.clicked.connect(self.openMxdDensity)
        self.day_mxd.clicked.connect(self.openMxdDay)


        self.density_mxd.setDisabled(True)
        self.day_mxd.setDisabled(True)
        self.action_save_pic.setDisabled(True)
    def __init__(self, ProfileTab):
        super().__init__()

        ProfileTab.setObjectName("ProfileTab")

        # Create scrollArea widget inside centralwidget
        self.scrollArea = QScrollArea(ProfileTab)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.scrollArea.sizePolicy().hasHeightForWidth())

        # Set size policy for scrollArea widget
        self.scrollArea.setSizePolicy(sizePolicy)
        self.scrollArea.setMinimumSize(QSize(767, 620))
        self.scrollArea.setMaximumSize(QSize(767, 620))
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scrollArea.setWidgetResizable(False)
        self.scrollArea.setObjectName("scrollArea")

        # Create scrollAreaWidgetContents widget
        self.scrollAreaWidgetContents = QWidget()
        self.scrollAreaWidgetContents.setGeometry(QRect(0, -176, 771, 1380))

        # Create size policy for scrollAreaWidgetContents
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.scrollAreaWidgetContents.sizePolicy().hasHeightForWidth())

        # Set scrollAreaWidgetContents size policy
        self.scrollAreaWidgetContents.setSizePolicy(sizePolicy)
        self.scrollAreaWidgetContents.setMinimumSize(QSize(771, 1380))
        self.scrollAreaWidgetContents.setMaximumSize(QSize(771, 1380))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")

        # Create verticalLayout_2 for scrollAreaWidgetContents
        self.verticalLayout_2 = QVBoxLayout(self.scrollAreaWidgetContents)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setSpacing(1)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        # Create widget1 inside scrollAreaWidgetContents
        self.widget1 = QWidget(self.scrollAreaWidgetContents)

        # Create size policy for widget1
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widget1.sizePolicy().hasHeightForWidth())

        # Set size policy for widget1
        self.widget1.setSizePolicy(sizePolicy)
        self.widget1.setMaximumSize(QSize(753, 40))
        self.widget1.setAutoFillBackground(False)
        self.widget1.setStyleSheet("border-color: rgb(0, 0, 255);\n"
                                   "background-color: rgb(255, 255, 255);")
        self.widget1.setObjectName("widget1")

        # Create horizontalLayout_3 for widget1
        self.horizontalLayout_3 = QHBoxLayout(self.widget1)
        self.horizontalLayout_3.setContentsMargins(25, 8, 10, 8)
        self.horizontalLayout_3.setSpacing(0)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")

        # Create profileHeading inside widget1
        self.profileHeading = QLabel(self.widget1)
        self.profileHeading.setMinimumSize(QSize(0, 0))
        self.profileHeading.setMaximumSize(QSize(305, 40))
        self.profileHeading.setLayoutDirection(Qt.LeftToRight)
        self.profileHeading.setStyleSheet(
            "font: 63 20pt \"Yu Gothic UI Semibold\";")
        self.profileHeading.setScaledContents(False)
        self.profileHeading.setIndent(0)
        self.profileHeading.setObjectName("profileHeading")

        # Add formTitle inside widget1 with layout horizontalLayout_3
        self.horizontalLayout_3.addWidget(self.profileHeading)

        # Add widget1 inside scrollAreaWidgetContents with layout verticalLayout_2
        self.verticalLayout_2.addWidget(self.widget1)

        # Create widgets2 inside scrollAreaWidgetContents
        self.widget2 = QWidget(self.scrollAreaWidgetContents)
        self.widget2.setMaximumSize(QSize(753, 197))
        self.widget2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.widget2.setObjectName("widget2")

        # Create horizontalLayout_2 for widget2
        self.horizontalLayout_2 = QHBoxLayout(self.widget2)
        self.horizontalLayout_2.setContentsMargins(10, 10, 10, 10)
        self.horizontalLayout_2.setSpacing(10)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")

        # Create logoWidget inside widget2
        self.logoWidget = QWidget(self.widget2)
        self.logoWidget.setMaximumSize(QSize(192, 192))
        self.logoWidget.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                      "gridline-color: rgb(0, 0, 0);\n"
                                      "border-color: rgb(0, 0, 0);")
        self.logoWidget.setObjectName("logoWidget")

        # Create logoImage inside logoWidget
        self.logoImage = QLabel(self.logoWidget)
        self.logoImage.setGeometry(QRect(10, 10, 171, 161))
        self.logoImage.setText("")
        self.logoImage.setPixmap(QPixmap("../../Downloads/OFWTSMPC (1).png"))
        self.logoImage.setScaledContents(True)
        self.logoImage.setObjectName("logoImage")

        # Add logo widget to widget2 with layout horizontalLayout_2
        self.horizontalLayout_2.addWidget(self.logoWidget)

        # Create headingWidget inside widget2
        self.headingWidget = QWidget(self.widget2)
        self.headingWidget.setObjectName("headingWidget")

        # Create headingLabel inside headingWidget
        self.headingLabel = QLabel(self.headingWidget)
        self.headingLabel.setGeometry(QRect(10, 10, 311, 161))
        font = QFont()
        font.setBold(True)
        font.setWeight(75)
        self.headingLabel.setFont(font)
        self.headingLabel.setObjectName("headingLabel")

        # Add headingWidget inside widget2 with layout horizontalLayout2
        self.horizontalLayout_2.addWidget(self.headingWidget)

        # Create uploadImgWidget inside widget2
        self.uploadImgWidget = QWidget(self.widget2)
        self.uploadImgWidget.setMaximumSize(QSize(192, 192))
        self.uploadImgWidget.setObjectName("uploadImgWidget")

        # Create imgDefault inside uploadImgWidget
        self.imgDefault = QLabel(self.uploadImgWidget)
        self.imgDefault.setGeometry(QRect(0, 0, 192, 192))
        self.imgDefault.setPixmap(QPixmap("img/default_avatar.png"))
        self.imgDefault.setScaledContents(True)
        self.imgDefault.setObjectName("imgDefault")

        # Add uploadImgWidget inside widget2 with layout horizontalLayout_2
        self.horizontalLayout_2.addWidget(self.uploadImgWidget)

        # Add widget2 inside scrollAreaWidgetContents with layout verticalLayout_2
        self.verticalLayout_2.addWidget(self.widget2)

        # Create widget3 inside scrollAreWidgetContents
        self.widget3 = QWidget(self.scrollAreaWidgetContents)

        # Create size policy for widget3
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widget3.sizePolicy().hasHeightForWidth())

        # Set size policy for widget3
        self.widget3.setSizePolicy(sizePolicy)
        self.widget3.setMinimumSize(QSize(753, 1143))
        self.widget3.setMaximumSize(QSize(753, 1143))
        font = QFont()
        font.setFamily("MS Shell Dlg 2")
        font.setPointSize(8)
        self.widget3.setFont(font)
        self.widget3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.widget3.setObjectName("widget3")

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

        self.dateRegistered = QLabel(self.widget3)
        self.dateRegistered.setGeometry(QRect(550, 7, 110, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.dateRegistered.setFont(font)
        self.dateRegistered.setObjectName("dateRegistered")

        self.date_registered = QLabel(self.widget3)
        self.date_registered.setGeometry(QRect(660, 8, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.date_registered.setFont(font)

        self.date_registered.setObjectName("date_registered")

        self.ofwName = QLabel(self.widget3)
        self.ofwName.setGeometry(QRect(48, 42, 79, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.ofwName.setFont(font)
        self.ofwName.setObjectName("ofwName")

        self.ofw_name = QLabel(self.widget3)
        self.ofw_name.setGeometry(QRect(130, 41, 64, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.ofw_name.setFont(font)
        self.ofw_name.setObjectName("ofw_name")

        self.ofwAddress = QLabel(self.widget3)
        self.ofwAddress.setGeometry(QRect(66, 67, 60, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.ofwAddress.setFont(font)
        self.ofwAddress.setObjectName("ofwAddress")

        self.ofw_address = QLabel(self.widget3)
        self.ofw_address.setGeometry(QRect(130, 66, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.ofw_address.setFont(font)
        self.ofw_address.setObjectName("ofw_address")

        self.name = QLabel(self.widget3)
        self.name.setGeometry(QRect(82, 92, 45, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.name.setFont(font)
        self.name.setObjectName("name")

        self.name_ = QLabel(self.widget3)
        self.name_.setGeometry(QRect(130, 91, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.name_.setFont(font)
        self.name_.setObjectName("name_")

        self.address = QLabel(self.widget3)
        self.address.setGeometry(QRect(67, 117, 60, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.address.setFont(font)
        self.address.setObjectName("address")

        self.address_ = QLabel(self.widget3)
        self.address_.setGeometry(QRect(130, 116, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.address_.setFont(font)
        self.address_.setObjectName("address_")

        self.pob = QLabel(self.widget3)
        self.pob.setGeometry(QRect(36, 142, 92, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.pob.setFont(font)
        self.pob.setObjectName("pob")

        self.pob_ = QLabel(self.widget3)
        self.pob_.setGeometry(QRect(130, 141, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.pob_.setFont(font)
        self.pob_.setObjectName("pob_")

        self.pAddress = QLabel(self.widget3)
        self.pAddress.setGeometry(QRect(1, 167, 129, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.pAddress.setFont(font)
        self.pAddress.setObjectName("pAddress")

        self.p_address = QLabel(self.widget3)
        self.p_address.setGeometry(QRect(130, 166, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.p_address.setFont(font)
        self.p_address.setObjectName("p_address")

        self.dob = QLabel(self.widget3)
        self.dob.setGeometry(QRect(43, 192, 86, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.dob.setFont(font)
        self.dob.setObjectName("dob")

        self.dob_ = QLabel(self.widget3)
        self.dob_.setGeometry(QRect(130, 191, 64, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.dob_.setFont(font)
        self.dob_.setObjectName("dob_")

        self.age = QLabel(self.widget3)
        self.age.setGeometry(QRect(95, 214, 33, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.age.setFont(font)
        self.age.setObjectName("age")

        self.age_ = QLabel(self.widget3)
        self.age_.setGeometry(QRect(130, 213, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.age_.setFont(font)
        self.age_.setObjectName("age_")

        self.sex = QLabel(self.widget3)
        self.sex.setGeometry(QRect(99, 239, 29, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.sex.setFont(font)
        self.sex.setObjectName("sex")

        self.sex_ = QLabel(self.widget3)
        self.sex_.setGeometry(QRect(130, 239, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.sex_.setFont(font)
        self.sex_.setObjectName("sex_")

        self.religion = QLabel(self.widget3)
        self.religion.setGeometry(QRect(68, 261, 60, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.religion.setFont(font)
        self.religion.setObjectName("religion")

        self.religion_ = QLabel(self.widget3)
        self.religion_.setGeometry(QRect(130, 260, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.religion_.setFont(font)
        self.religion_.setObjectName("religion_")

        self.contactNo = QLabel(self.widget3)
        self.contactNo.setGeometry(QRect(50, 286, 80, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.contactNo.setFont(font)
        self.contactNo.setObjectName("contactNo")

        self.contact_no = QLabel(self.widget3)
        self.contact_no.setGeometry(QRect(130, 286, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.contact_no.setFont(font)
        self.contact_no.setObjectName("contact_no")

        self.email = QLabel(self.widget3)
        self.email.setGeometry(QRect(87, 311, 43, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.email.setFont(font)
        self.email.setObjectName("email")

        self.email_ = QLabel(self.widget3)
        self.email_.setGeometry(QRect(130, 310, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.email_.setFont(font)
        self.email_.setObjectName("email_")

        self.tinNo = QLabel(self.widget3)
        self.tinNo.setGeometry(QRect(77, 336, 53, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.tinNo.setFont(font)
        self.tinNo.setObjectName("tinNo")

        self.tin_no = QLabel(self.widget3)
        self.tin_no.setGeometry(QRect(130, 336, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.tin_no.setFont(font)
        self.tin_no.setObjectName("tin_no")

        self.citizenship = QLabel(self.widget3)
        self.citizenship.setGeometry(QRect(52, 358, 78, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.citizenship.setFont(font)
        self.citizenship.setObjectName("citizenship")

        self.citizenship_ = QLabel(self.widget3)
        self.citizenship_.setGeometry(QRect(130, 358, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.citizenship_.setFont(font)
        self.citizenship_.setObjectName("citizenship_")

        self.status = QLabel(self.widget3)
        self.status.setGeometry(QRect(50, 383, 78, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.status.setFont(font)
        self.status.setObjectName("status")

        self.status_ = QLabel(self.widget3)
        self.status_.setGeometry(QRect(130, 383, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.status_.setFont(font)
        self.status_.setObjectName("status_")

        self.sssNo = QLabel(self.widget3)
        self.sssNo.setGeometry(QRect(73, 408, 54, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.sssNo.setFont(font)
        self.sssNo.setObjectName("sssNo")

        self.sss_no = QLabel(self.widget3)
        self.sss_no.setGeometry(QRect(130, 408, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.sss_no.setFont(font)
        self.sss_no.setObjectName("sss_no")

        self.hwName = QLabel(self.widget3)
        self.hwName.setGeometry(QRect(10, 433, 142, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hwName.setFont(font)
        self.hwName.setObjectName("hwName")

        self.hw_name = QLabel(self.widget3)
        self.hw_name.setGeometry(QRect(154, 434, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hw_name.setFont(font)
        self.hw_name.setObjectName("hw_name")

        self.hwPob = QLabel(self.widget3)
        self.hwPob.setGeometry(QRect(59, 458, 92, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hwPob.setFont(font)
        self.hwPob.setObjectName("hwPob")

        self.hw_pob = QLabel(self.widget3)
        self.hw_pob.setGeometry(QRect(154, 459, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hw_pob.setFont(font)
        self.hw_pob.setObjectName("hw_pob")

        self.hwDob = QLabel(self.widget3)
        self.hwDob.setGeometry(QRect(64, 483, 86, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hwDob.setFont(font)
        self.hwDob.setObjectName("hwDob")

        self.hw_dob = QLabel(self.widget3)
        self.hw_dob.setGeometry(QRect(154, 484, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hw_dob.setFont(font)
        self.hw_dob.setObjectName("hw_dob")

        self.hwAge = QLabel(self.widget3)
        self.hwAge.setGeometry(QRect(116, 505, 34, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hwAge.setFont(font)
        self.hwAge.setObjectName("hwAge")

        self.hw_age = QLabel(self.widget3)
        self.hw_age.setGeometry(QRect(154, 506, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.hw_age.setFont(font)
        self.hw_age.setObjectName("hw_age")

        self.occupation = QLabel(self.widget3)
        self.occupation.setGeometry(QRect(65, 527, 84, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.occupation.setFont(font)
        self.occupation.setObjectName("occupation")

        self.occupation_ = QLabel(self.widget3)
        self.occupation_.setGeometry(QRect(154, 527, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.occupation_.setFont(font)
        self.occupation_.setObjectName("occupation_")

        self.children = QLabel(self.widget3)
        self.children.setGeometry(QRect(340, 558, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.children.setFont(font)
        self.children.setObjectName("children")

        self.creatingTables()

        self.employerInfo = QLabel(self.widget3)
        self.employerInfo.setGeometry(QRect(2, 750, 145, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.employerInfo.setFont(font)
        self.employerInfo.setObjectName("employerInfo")

        self.empName = QLabel(self.widget3)
        self.empName.setGeometry(QRect(73, 770, 47, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.empName.setFont(font)
        self.empName.setObjectName("empName")

        self.emp_name = QLabel(self.widget3)
        self.emp_name.setGeometry(QRect(120, 770, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.emp_name.setFont(font)
        self.emp_name.setObjectName("emp_name")

        self.position = QLabel(self.widget3)
        self.position.setGeometry(QRect(63, 796, 56, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.position.setFont(font)
        self.position.setObjectName("position")

        self.position_ = QLabel(self.widget3)
        self.position_.setGeometry(QRect(120, 795, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.position_.setFont(font)
        self.position_.setObjectName("position_")

        self.empAddress = QLabel(self.widget3)
        self.empAddress.setGeometry(QRect(59, 821, 60, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.empAddress.setFont(font)
        self.empAddress.setObjectName("empAddress")

        self.emp_address = QLabel(self.widget3)
        self.emp_address.setGeometry(QRect(120, 820, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.emp_address.setFont(font)
        self.emp_address.setObjectName("emp_address")

        self.empDate = QLabel(self.widget3)
        self.empDate.setGeometry(QRect(15, 846, 106, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.empDate.setFont(font)
        self.empDate.setObjectName("empDate")

        self.emp_date = QLabel(self.widget3)
        self.emp_date.setGeometry(QRect(120, 846, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.emp_date.setFont(font)
        self.emp_date.setObjectName("emp_date")

        self.empContactNo = QLabel(self.widget3)
        self.empContactNo.setGeometry(QRect(36, 871, 84, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.empContactNo.setFont(font)
        self.empContactNo.setObjectName("empContactNo")

        self.emp_cn = QLabel(self.widget3)
        self.emp_cn.setGeometry(QRect(120, 871, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.emp_cn.setFont(font)
        self.emp_cn.setObjectName("emp_cn")

        self.empEmail = QLabel(self.widget3)
        self.empEmail.setGeometry(QRect(77, 896, 41, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.empEmail.setFont(font)
        self.empEmail.setObjectName("empEmail")

        self.emp_email = QLabel(self.widget3)
        self.emp_email.setGeometry(QRect(120, 895, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.emp_email.setFont(font)
        self.emp_email.setObjectName("emp_email")

        self.contactPerson = QLabel(self.widget3)
        self.contactPerson.setGeometry(QRect(2, 936, 262, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.contactPerson.setFont(font)
        self.contactPerson.setObjectName("contactPerson")

        self.cpName = QLabel(self.widget3)
        self.cpName.setGeometry(QRect(43, 961, 47, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cpName.setFont(font)
        self.cpName.setObjectName("cpName")

        self.cp_name = QLabel(self.widget3)
        self.cp_name.setGeometry(QRect(90, 961, 64, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cp_name.setFont(font)
        self.cp_name.setObjectName("cp_name")

        self.cpAddress = QLabel(self.widget3)
        self.cpAddress.setGeometry(QRect(29, 986, 60, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cpAddress.setFont(font)
        self.cpAddress.setObjectName("cpAddress")

        self.cp_address = QLabel(self.widget3)
        self.cp_address.setGeometry(QRect(90, 985, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cp_address.setFont(font)
        self.cp_address.setObjectName("cp_address")

        self.cpContactNo = QLabel(self.widget3)
        self.cpContactNo.setGeometry(QRect(10, 1011, 80, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cpContactNo.setFont(font)
        self.cpContactNo.setObjectName("cpContactNo")

        self.cp_cn = QLabel(self.widget3)
        self.cp_cn.setGeometry(QRect(90, 1011, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.cp_cn.setFont(font)
        self.cp_cn.setObjectName("cp_cn")

        self.opDrName = QLabel(self.widget3)
        self.opDrName.setGeometry(QRect(10, 1041, 168, 16))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.opDrName.setFont(font)
        self.opDrName.setObjectName("opDrName")

        self.opdr_name = QLabel(self.widget3)
        self.opdr_name.setGeometry(QRect(180, 1041, 63, 13))
        font = QFont()
        font.setFamily("Century Gothic")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.opdr_name.setFont(font)
        self.opdr_name.setObjectName("opdr_name")

        # Create showBtn inside widget3
        self.showBtn = QPushButton(self.widget3)
        self.showBtn.setGeometry(QRect(380, 1060, 41, 23))
        self.showBtn.setObjectName("showBtn")
        self.showBtn.setText("Show")

        # Create ageInput inside widget3
        self.inputId = QLineEdit(self.widget3)
        self.inputId.setGeometry(QRect(380, 1100, 21, 20))
        font = QFont()
        font.setFamily("Times New Roman")
        font.setPointSize(11)
        self.inputId.setFont(font)
        self.inputId.setText("")
        self.inputId.setObjectName("ageInput")

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

        self.verticalLayout_2.addWidget(self.widget3)

        # Set scrollArea widget to scrollAreaWidgetContents
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.retranslateUi()
        QMetaObject.connectSlotsByName(ProfileTab)
Exemple #25
0
    def initUI(self, taxyear):
        self.setObjectName("MainWindow")
        self.setEnabled(True)
        self.resize(400, 800)

        self.centralwidget = QWidget()
        self.verticalLayout_3 = QVBoxLayout(self.centralwidget)
        self.splitter = QSplitter(self.centralwidget)

        # --------------------- TOP MENU -------------------------

        self.initMenu()

        # ------------- Province ----------------
        self.ProvinceLabel = QLabel(self.splitter)

        self.provinceBox = QComboBox(self.splitter)

        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

        self.provinceBox.addItem("Alberta")
        self.provinceBox.setItemText(0, "AB")

        self.provinceBox.addItem("British Columbia")
        self.provinceBox.setItemText(1, "BC")

        self.provinceBox.addItem("Manitoba")
        self.provinceBox.setItemText(2, "MB")

        self.provinceBox.addItem("New Brunswick")
        self.provinceBox.setItemText(3, "NB")

        self.provinceBox.addItem("Newfoundland and Labrador")
        self.provinceBox.setItemText(4, "NL")

        self.provinceBox.addItem("Nova Scotia")
        self.provinceBox.setItemText(5, "NS")

        self.provinceBox.addItem("Nunavut")
        self.provinceBox.setItemText(6, "BC")

        self.provinceBox.addItem("Ontario")
        self.provinceBox.setItemText(7, "ON")

        self.provinceBox.addItem("Prince Edward Island")
        self.provinceBox.setItemText(8, "PE")

        self.provinceBox.addItem("Quebec")
        self.provinceBox.setItemText(9, "QC")

        self.provinceBox.addItem("Saskatchewan")
        self.provinceBox.setItemText(10, "SK")

        self.taxYearLabel = QLabel(self.splitter)

        self.taxYearBox = QSpinBox(self.splitter)
        self.taxYearBox.setMinimum(1990)
        self.taxYearBox.setMaximum(2050)
        self.taxYearBox.setValue(2018)

        self.verticalLayout_3.addWidget(self.splitter)
        self.tabWidget = QTabWidget(self.centralwidget)
        self.ProvincialTab = QWidget()
        self.verticalLayout = QVBoxLayout(self.ProvincialTab)
        self.provLabel = QLabel(self.ProvincialTab)
        self.verticalLayout.addWidget(self.provLabel)

        # ---------- PROVINCIAL TABLE ---------------
        self.provTable = QTableWidget(self.ProvincialTab)
        self.provTable.setColumnCount(3)
        self.provTable.setRowCount(6)

        font = QtGui.QFont()
        font.setPointSize(9)

        item = QTableWidgetItem()
        self.provTable.setHorizontalHeaderItem(0, item)
        self.provTable.horizontalHeaderItem(0).setText("Bracket From")
        self.provTable.horizontalHeaderItem(0).setFont(font)

        item = QTableWidgetItem()
        self.provTable.setHorizontalHeaderItem(1, item)
        self.provTable.horizontalHeaderItem(1).setText("Bracket To")
        self.provTable.horizontalHeaderItem(1).setFont(font)

        item = QTableWidgetItem()
        self.provTable.setHorizontalHeaderItem(2, item)
        self.provTable.horizontalHeaderItem(2).setText("tax Rate")
        self.provTable.horizontalHeaderItem(2).setFont(font)

        self.provTable.horizontalHeader().setDefaultSectionSize(110)
        self.provTable.horizontalHeader().setStretchLastSection(True)
        self.provTable.verticalHeader().setVisible(False)
        self.verticalLayout.addWidget(self.provTable)
        self.provPerLabel = QLabel(self.ProvincialTab)

        self.verticalLayout.addWidget(self.provPerLabel)

        # ----------- PROVINCE PERSONAL -------------------

        self.provPerTable = QTableWidget(self.ProvincialTab)
        self.provPerTable.setMaximumSize(QtCore.QSize(16777215, 60))
        self.provPerTable.setRowCount(1)
        self.provPerTable.setColumnCount(2)
        self.provPerTable.setObjectName("provPerTable")
        item = QTableWidgetItem()
        self.provPerTable.setVerticalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.provPerTable.setHorizontalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.provPerTable.setHorizontalHeaderItem(1, item)
        self.provPerTable.horizontalHeader().setDefaultSectionSize(180)
        self.provPerTable.horizontalHeader().setStretchLastSection(True)
        self.provPerTable.verticalHeader().setVisible(False)
        self.provPerTable.verticalHeader().setStretchLastSection(True)
        self.verticalLayout.addWidget(self.provPerTable)

        self.tabWidget.addTab(self.ProvincialTab, "")
        self.FederalTab = QWidget()
        self.FederalTab.setObjectName("FederalTab")
        self.verticalLayout_2 = QVBoxLayout(self.FederalTab)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.fedLabel = QLabel(self.FederalTab)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.fedLabel.sizePolicy().hasHeightForWidth())
        self.fedLabel.setSizePolicy(sizePolicy)
        self.fedLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fedLabel.setObjectName("fedLabel")
        self.verticalLayout_2.addWidget(self.fedLabel)

        # ----------- FEDERAL TABLE -----------------

        self.fedTable = QTableWidget(self.FederalTab)
        self.fedTable.setColumnCount(3)
        self.fedTable.setRowCount(5)

        font = QtGui.QFont()
        font.setPointSize(9)

        item = QTableWidgetItem()
        self.fedTable.setHorizontalHeaderItem(0, item)
        self.fedTable.horizontalHeaderItem(0).setText("Bracket From")
        self.fedTable.horizontalHeaderItem(0).setFont(font)

        item = QTableWidgetItem()
        self.fedTable.setHorizontalHeaderItem(1, item)
        self.fedTable.horizontalHeaderItem(1).setText("Bracket To")
        self.fedTable.horizontalHeaderItem(1).setFont(font)

        item = QTableWidgetItem()
        self.fedTable.setHorizontalHeaderItem(2, item)
        self.fedTable.horizontalHeaderItem(2).setText("tax Rate")
        self.fedTable.horizontalHeaderItem(2).setFont(font)

        self.fedTable.horizontalHeader().setDefaultSectionSize(100)
        self.fedTable.horizontalHeader().setStretchLastSection(True)
        self.fedTable.verticalHeader().setVisible(False)
        self.verticalLayout_2.addWidget(self.fedTable)

        self.fedPerLabel = QLabel(self.FederalTab)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.fedPerLabel.sizePolicy().hasHeightForWidth())
        self.fedPerLabel.setSizePolicy(sizePolicy)
        self.fedPerLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fedPerLabel.setObjectName("fedPerLabel")
        self.verticalLayout_2.addWidget(self.fedPerLabel)

        # ----------- FEDERAL PERSONAL TABLE -----------------

        self.fedPerTable = QTableWidget(self.FederalTab)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.fedPerTable.sizePolicy().hasHeightForWidth())
        self.fedPerTable.setSizePolicy(sizePolicy)
        self.fedPerTable.setMaximumSize(QtCore.QSize(16777215, 60))
        self.fedPerTable.setRowCount(1)
        self.fedPerTable.setColumnCount(2)
        self.fedPerTable.setObjectName("fedPerTable")
        item = QTableWidgetItem()
        self.fedPerTable.setVerticalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.fedPerTable.setHorizontalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.fedPerTable.setHorizontalHeaderItem(1, item)
        self.fedPerTable.horizontalHeader().setDefaultSectionSize(180)
        self.fedPerTable.horizontalHeader().setStretchLastSection(True)
        self.fedPerTable.verticalHeader().setVisible(False)
        self.fedPerTable.verticalHeader().setStretchLastSection(True)
        self.verticalLayout_2.addWidget(self.fedPerTable)
        self.tabWidget.addTab(self.FederalTab, "")
        self.verticalLayout_3.addWidget(self.tabWidget)

        self.eiLabel = QLabel(self.centralwidget)
        self.eiLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.eiLabel.setObjectName("eiLabel")
        self.verticalLayout_3.addWidget(self.eiLabel)
        self.eiTable = QTableWidget(self.centralwidget)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.eiTable.sizePolicy().hasHeightForWidth())
        self.eiTable.setSizePolicy(sizePolicy)
        self.eiTable.setMaximumSize(QtCore.QSize(16777215, 60))
        self.eiTable.setObjectName("eiTable")
        self.eiTable.setColumnCount(2)
        self.eiTable.setRowCount(1)
        item = QTableWidgetItem()
        self.eiTable.setVerticalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.eiTable.setHorizontalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.eiTable.setHorizontalHeaderItem(1, item)
        self.eiTable.horizontalHeader().setDefaultSectionSize(180)
        self.eiTable.horizontalHeader().setStretchLastSection(True)
        self.eiTable.verticalHeader().setVisible(False)
        self.eiTable.verticalHeader().setStretchLastSection(True)
        self.verticalLayout_3.addWidget(self.eiTable)

        self.cppLabel = QLabel(self.centralwidget)
        self.cppLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.cppLabel.setObjectName("cppLabel")
        self.cppLabel.setText("Canada Pension Plan")

        self.verticalLayout_3.addWidget(self.cppLabel)
        self.cppTable = QTableWidget(self.centralwidget)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.cppTable.sizePolicy().hasHeightForWidth())
        self.cppTable.setSizePolicy(sizePolicy)
        self.cppTable.setMaximumSize(QtCore.QSize(16777215, 60))
        self.cppTable.setObjectName("cppTable")
        self.cppTable.setColumnCount(3)
        self.cppTable.setRowCount(1)
        item = QTableWidgetItem()
        self.cppTable.setVerticalHeaderItem(0, item)
        item = QTableWidgetItem()
        self.cppTable.setHorizontalHeaderItem(0, item)
        item = QTableWidgetItem()

        self.cppTable.setHorizontalHeaderItem(1, item)
        item = QTableWidgetItem()
        self.cppTable.setHorizontalHeaderItem(2, item)
        self.cppTable.horizontalHeader().setDefaultSectionSize(120)
        self.cppTable.horizontalHeader().setStretchLastSection(True)
        self.cppTable.verticalHeader().setVisible(False)
        self.cppTable.verticalHeader().setStretchLastSection(True)
        self.verticalLayout_3.addWidget(self.cppTable)
        self.setCentralWidget(self.centralwidget)

        item = self.cppTable.horizontalHeaderItem(0)
        item.setText("max contrib")
        item = self.cppTable.horizontalHeaderItem(1)
        item.setText("tax")
        item = self.cppTable.horizontalHeaderItem(2)
        item.setText("excempt")

        self.retranslateUi()
        self.tabWidget.setCurrentIndex(0)
        # QtCore.QMetaObject.connectSlotsByName()
        self.setWindowTitle("Editing {}".format(taxyear))
        self.fillData(taxyear)
    def __init__(self, parent=None):
        super().__init__()
        self.setStyleSheet("background-color: rgb(255, 255, 255);")
        # 定义网格布局
        self.widgetDefenseGridLayout = QGridLayout(self)
        self.widgetDefenseGridLayout.setContentsMargins(15, 14, 15, 10)
        self.widgetDefenseGridLayout.setHorizontalSpacing(10)
        self.widgetDefenseGridLayout.setVerticalSpacing(0)
        self.widgetDefenseGridLayout.setObjectName("widgetDefenseGridLayout")

        # 添加一个Label显示处理前的图像
        self.labelSourceImage = QClickLabel(self)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.labelSourceImage.sizePolicy().hasHeightForWidth())
        self.labelSourceImage.setSizePolicy(sizePolicy)
        self.labelSourceImage.setMinimumSize(QSize(200, 200))
        self.labelSourceImage.setCursor(QCursor(Qt.PointingHandCursor))
        self.labelSourceImage.clicked(self.__labelSourceImageClick)

        # 添加一个标签显示"视频源:"
        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setSpacing(6)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.labelTitle1 = QLabel(self)
        self.labelTitle1.setMinimumSize(QSize(0, 30))
        self.labelTitle1.setMaximumSize(QSize(16777215, 30))
        self.labelTitle1.setStyleSheet("font: 75 13pt \'微软雅黑\';")
        self.labelTitle1.setObjectName("labelTitle1")
        self.labelTitle1.setText("视频源:")
        self.horizontalLayout_3.addWidget(self.labelTitle1)
        self.pushButton = QPushButton(self)
        self.pushButton.setEnabled(True)
        self.pushButton.setMinimumSize(QSize(80, 26))
        self.pushButton.setMaximumSize(QSize(80, 16777215))
        self.pushButton.setStyleSheet("QPushButton{background-color: rgb(222, 222, 222);border:1px solid rgb(191, 191, 191);}QPushButton:hover{background-color: rgba(200, 200, 200, 255);}QPushButton:pressed{background-color: rgb(222, 222, 222);}")
        self.pushButton.setObjectName("pushButton")
        self.pushButton.setCursor(QCursor(Qt.PointingHandCursor))
        self.pushButton.setText("噪声攻击")
        self.pushButton.clicked.connect(self.__pushButtonClick)
        self.horizontalLayout_3.addWidget(self.pushButton)
        self.widgetDefenseGridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)

        # 添加一个Label显示处理后的图像
        self.labelHandleImage = QClickLabel(self)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.labelHandleImage.sizePolicy().hasHeightForWidth())
        self.labelHandleImage.setSizePolicy(sizePolicy)
        self.labelHandleImage.setMinimumSize(QSize(200, 200))
        self.labelHandleImage.setCursor(QCursor(Qt.PointingHandCursor))
        self.labelHandleImage.clicked(self.__labelSourceImageClick)
        self.widgetDefenseGridLayout.addWidget(self.labelHandleImage, 5, 1, 1, 1)

        # 添加一个标签显示"处理后:"
        self.widgetDefenseGridLayout.addWidget(self.labelSourceImage, 5, 0, 1, 1)
        self.labelTitle2 = QLabel(self)
        self.labelTitle2.setMaximumSize(QSize(16777215, 30))
        self.labelTitle2.setStyleSheet("font: 75 13pt \'微软雅黑\';")
        self.labelTitle2.setObjectName("labelTitle2")
        self.widgetDefenseGridLayout.addWidget(self.labelTitle2, 2, 1, 1, 1)
        spacerItem2 = QSpacerItem(20, 15, QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.widgetDefenseGridLayout.addItem(spacerItem2, 6, 0, 1, 2)
        self.labelTitle2.setText("算法处理:")

        # 添加调试窗口
        self.textBrowserDebug = QTextBrowser(self)
        self.textBrowserDebug.setMinimumSize(QSize(420, 100))
        self.textBrowserDebug.setMaximumSize(QSize(16777215, 120))
        self.textBrowserDebug.setStyleSheet("QScrollBar:vertical{width:10px;background:rgb(230,235,230);}QScrollBar::handle:vertical{background:rgb(200,200,200);}QTextBrowser{padding: 5px; border:1px solid #e6e6e6;color: rgb(77, 77, 77);}")
        self.textBrowserDebug.setObjectName("textBrowserDebug")
        self.textBrowserDebug.setHtml("")
        self.widgetDefenseGridLayout.addWidget(self.textBrowserDebug, 7, 0, 1, 2)

        # 定义一个读取图像的线程
        self.threadPlay = Thread(self)
        self.threadPlay.console.connect(self.console)
        self.threadPlay.setSourceImage.connect(self.setSourceImage)
        self.threadPlay.setHandleImage.connect(self.setHandleImage)
 def setup_ui(self):
     """
     setup window ui
     """
     self.setObjectName("about_box")
     self.resize(600, 345)
     size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
     self.setSizePolicy(size_policy)
     self.setMinimumSize(QSize(600, 345))
     self.setMaximumSize(QSize(600, 345))
     icon = QIcon()
     icon.addPixmap(QPixmap("icon.png"), QIcon.Normal, QIcon.Off)
     self.setWindowIcon(icon)
     self.label_header.setGeometry(QRect(0, 0, 571, 41))
     size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.label_header.sizePolicy().hasHeightForWidth())
     self.label_header.setSizePolicy(size_policy)
     font = QFont()
     font.setPointSize(14)
     self.label_header.setFont(font)
     self.label_header.setIndent(10)
     self.label_header.setObjectName("label_header")
     self.tabs.setGeometry(QRect(10, 40, 580, 250))
     self.tabs.setObjectName("tabs")
     self.tab_about.setObjectName("tab_about")
     self.about_text.setGeometry(QRect(0, 0, 580, 220))
     size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.about_text.sizePolicy().hasHeightForWidth())
     self.about_text.setSizePolicy(size_policy)
     self.about_text.setAcceptDrops(False)
     self.about_text.setReadOnly(True)
     self.about_text.setOpenExternalLinks(True)
     self.about_text.setObjectName("about_text")
     self.tabs.addTab(self.tab_about, "")
     self.tab_sources.setObjectName("tab_sources")
     self.sources_text.setGeometry(QRect(0, 0, 580, 220))
     size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.sources_text.sizePolicy().hasHeightForWidth())
     self.sources_text.setSizePolicy(size_policy)
     self.sources_text.setAcceptDrops(False)
     self.sources_text.setReadOnly(True)
     self.sources_text.setOpenExternalLinks(True)
     self.sources_text.setObjectName("sources_text")
     self.tabs.addTab(self.tab_sources, "")
     self.tab_authors.setObjectName("tab_authors")
     self.authors_text.setGeometry(QRect(0, 0, 580, 220))
     size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.authors_text.sizePolicy().hasHeightForWidth())
     self.authors_text.setSizePolicy(size_policy)
     self.authors_text.setAcceptDrops(False)
     self.authors_text.setReadOnly(True)
     self.authors_text.setOpenExternalLinks(True)
     self.authors_text.setObjectName("authors_text")
     self.tabs.addTab(self.tab_authors, "")
     self.tab_thanks.setObjectName("tab_thanks")
     self.thanks_text.setGeometry(QRect(0, 0, 580, 220))
     size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.thanks_text.sizePolicy().hasHeightForWidth())
     self.thanks_text.setSizePolicy(size_policy)
     self.thanks_text.setAcceptDrops(False)
     self.thanks_text.setReadOnly(True)
     self.thanks_text.setOpenExternalLinks(True)
     self.thanks_text.setObjectName("thanks_text")
     self.tabs.addTab(self.tab_thanks, "")
     self.button_box.setGeometry(QRect(490, 300, 104, 37))
     self.button_box.setOrientation(Qt.Horizontal)
     self.button_box.setStandardButtons(QDialogButtonBox.Cancel)
     cancel_button = self.button_box.button(QDialogButtonBox.Cancel)
     cancel_button.setText(self._translate("About Box", "Cancel"))
     self.button_box.setObjectName("button_box")
     self.button_box.rejected.connect(self.reject)
     self.button_box.accepted.connect(self.accept)
     adjust_layout_direction(self, self.lang)
     self.retranslate_ui()
     self.tabs.setCurrentIndex(0)
     QMetaObject.connectSlotsByName(self)
Exemple #28
0
    def __init__(self):
        super().__init__()
#window
        self.resize(475, 465)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QtCore.QSize(475, 465))
        self.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.setWindowIcon(QIcon('icon'))

        self.widget = QWidget(self)
        self.widget.setGeometry(QtCore.QRect(9, 9, 454, 442))

        self.verticalLayout = QVBoxLayout(self)
 
        self.addlink_verticalLayout = QVBoxLayout()
        self.addlink_verticalLayout.setContentsMargins(0, 0, 0, 0)

        self.link_frame = QFrame(self)
        self.link_frame.setFrameShape(QFrame.StyledPanel)
        self.link_frame.setFrameShadow(QFrame.Raised)

        self.horizontalLayout_2 = QHBoxLayout(self.link_frame)

        self.link_horizontalLayout = QHBoxLayout()
#link
        self.link_label = QLabel(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_label)

        self.link_lineEdit = QLineEdit(self.link_frame)
        self.link_horizontalLayout.addWidget(self.link_lineEdit)
        self.horizontalLayout_2.addLayout(self.link_horizontalLayout)
        self.addlink_verticalLayout.addWidget(self.link_frame)

#proxy
        self.proxy_verticalLayout = QVBoxLayout()

        self.proxy_checkBox = QCheckBox(self.widget)
        self.proxy_verticalLayout.addWidget(self.proxy_checkBox)

        self.proxy_frame = QFrame(self.widget)
        self.proxy_frame.setFrameShape(QFrame.StyledPanel)
        self.proxy_frame.setFrameShadow(QFrame.Raised)

        self.gridLayout = QGridLayout(self.proxy_frame)

        self.ip_lineEdit = QLineEdit(self.proxy_frame)
        self.ip_lineEdit.setInputMethodHints(QtCore.Qt.ImhNone)
        self.gridLayout.addWidget(self.ip_lineEdit, 0, 1, 1, 1)

        self.proxy_pass_label = QLabel(self.proxy_frame)
        self.gridLayout.addWidget(self.proxy_pass_label, 2, 2, 1, 1)

        self.proxy_pass_lineEdit = QLineEdit(self.proxy_frame)
        self.proxy_pass_lineEdit.setEchoMode(QLineEdit.Password)
        self.gridLayout.addWidget(self.proxy_pass_lineEdit, 2, 3, 1, 1)

        self.ip_label = QLabel(self.proxy_frame)
        self.gridLayout.addWidget(self.ip_label, 0, 0, 1, 1)

        self.proxy_user_lineEdit = QLineEdit(self.proxy_frame)
        self.gridLayout.addWidget(self.proxy_user_lineEdit, 0, 3, 1, 1)

        self.proxy_user_label = QLabel(self.proxy_frame)
        self.gridLayout.addWidget(self.proxy_user_label, 0, 2, 1, 1)

        self.port_label = QLabel(self.proxy_frame)
        self.gridLayout.addWidget(self.port_label, 2, 0, 1, 1)

        self.port_spinBox = QSpinBox(self.proxy_frame)
        self.port_spinBox.setMaximum(9999)
        self.port_spinBox.setSingleStep(1)
        self.gridLayout.addWidget(self.port_spinBox, 2, 1, 1, 1)
        self.proxy_verticalLayout.addWidget(self.proxy_frame)
        self.addlink_verticalLayout.addLayout(self.proxy_verticalLayout)
#download UserName & Password
        self.download_horizontalLayout = QHBoxLayout()
        self.download_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        self.download_verticalLayout = QVBoxLayout()
        self.download_checkBox = QCheckBox(self.widget)
        self.download_verticalLayout.addWidget(self.download_checkBox)

        self.download_frame = QFrame(self.widget)
        self.download_frame.setFrameShape(QFrame.StyledPanel)
        self.download_frame.setFrameShadow(QFrame.Raised)

        self.gridLayout_2 = QGridLayout(self.download_frame)

        self.download_user_lineEdit = QLineEdit(self.download_frame)
        self.gridLayout_2.addWidget(self.download_user_lineEdit, 0, 1, 1, 1)

        self.download_user_label = QLabel(self.download_frame)
        self.gridLayout_2.addWidget(self.download_user_label, 0, 0, 1, 1)

        self.download_pass_label = QLabel(self.download_frame)
        self.gridLayout_2.addWidget(self.download_pass_label, 1, 0, 1, 1)

        self.download_pass_lineEdit = QLineEdit(self.download_frame)
        self.download_pass_lineEdit.setEchoMode(QLineEdit.Password)
        self.gridLayout_2.addWidget(self.download_pass_lineEdit, 1, 1, 1, 1)
        self.download_verticalLayout.addWidget(self.download_frame)
        self.download_horizontalLayout.addLayout(self.download_verticalLayout)
#select folder
        self.folder_frame = QFrame(self.widget)
        self.folder_frame.setFrameShape(QFrame.StyledPanel)
        self.folder_frame.setFrameShadow(QFrame.Raised)

        self.gridLayout_3 = QGridLayout(self.folder_frame)

        self.download_folder_lineEdit = QLineEdit(self.folder_frame)
        self.gridLayout_3.addWidget(self.download_folder_lineEdit, 2, 0, 1, 1)

        self.folder_pushButton = QPushButton(self.folder_frame)
        self.gridLayout_3.addWidget(self.folder_pushButton, 3, 0, 1, 1)
        self.folder_pushButton.setIcon(QIcon(icons + 'folder'))

        self.folder_label = QLabel(self.folder_frame)
        self.folder_label.setAlignment(QtCore.Qt.AlignCenter)
        self.gridLayout_3.addWidget(self.folder_label, 1, 0, 1, 1)
        self.download_horizontalLayout.addWidget(self.folder_frame)
        self.addlink_verticalLayout.addLayout(self.download_horizontalLayout)
#start time
        self.time_limit_horizontalLayout = QHBoxLayout()
        self.time_limit_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        self.start_verticalLayout = QVBoxLayout()
        self.start_checkBox = QCheckBox(self.widget)
        self.start_verticalLayout.addWidget(self.start_checkBox)

        self.start_frame = QFrame(self.widget)
        self.start_frame.setFrameShape(QFrame.StyledPanel)
        self.start_frame.setFrameShadow(QFrame.Raised)

        self.horizontalLayout_5 = QHBoxLayout(self.start_frame)
        self.start_hour_spinBox = QSpinBox(self.start_frame)
        self.start_hour_spinBox.setMaximum(23)
        self.horizontalLayout_5.addWidget(self.start_hour_spinBox)

        self.start_label = QLabel(self.start_frame)
        self.horizontalLayout_5.addWidget(self.start_label)

        self.start_minute_spinBox = QSpinBox(self.start_frame)
        self.start_minute_spinBox.setMaximum(59)
        self.horizontalLayout_5.addWidget(self.start_minute_spinBox)
        self.start_verticalLayout.addWidget(self.start_frame)
        self.time_limit_horizontalLayout.addLayout(self.start_verticalLayout)
#end time
        self.end_verticalLayout = QVBoxLayout()

        self.end_checkBox = QCheckBox(self.widget)
        self.end_verticalLayout.addWidget(self.end_checkBox)

        self.end_frame = QFrame(self.widget)
        self.end_frame.setFrameShape(QFrame.StyledPanel)
        self.end_frame.setFrameShadow(QFrame.Raised)

        self.horizontalLayout_6 = QHBoxLayout(self.end_frame)

        self.end_hour_spinBox = QSpinBox(self.end_frame)
        self.end_hour_spinBox.setMaximum(23)
        self.horizontalLayout_6.addWidget(self.end_hour_spinBox)

        self.end_label = QLabel(self.end_frame)
        self.horizontalLayout_6.addWidget(self.end_label)

        self.end_minute_spinBox = QSpinBox(self.end_frame)
        self.end_minute_spinBox.setMaximum(59)
        self.horizontalLayout_6.addWidget(self.end_minute_spinBox)
        self.end_verticalLayout.addWidget(self.end_frame)
        self.time_limit_horizontalLayout.addLayout(self.end_verticalLayout)
#limit Speed
        self.limit_verticalLayout = QVBoxLayout()

        self.limit_checkBox = QCheckBox(self.widget)
        self.limit_verticalLayout.addWidget(self.limit_checkBox)

        self.limit_frame = QFrame(self.widget)
        self.limit_frame.setFrameShape(QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QFrame.Raised)

        self.horizontalLayout_4 = QHBoxLayout(self.limit_frame)

        self.limit_spinBox = QSpinBox(self.limit_frame)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        self.horizontalLayout_4.addWidget(self.limit_spinBox)

        self.limit_comboBox = QComboBox(self.limit_frame)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        self.horizontalLayout_4.addWidget(self.limit_comboBox)
        self.limit_verticalLayout.addWidget(self.limit_frame)
        self.time_limit_horizontalLayout.addLayout(self.limit_verticalLayout)
        self.addlink_verticalLayout.addLayout(self.time_limit_horizontalLayout)
#number of connections
        self.connections_horizontalLayout = QHBoxLayout()
        self.connections_horizontalLayout.setContentsMargins(-1, 10, -1, -1)

        self.connections_frame = QFrame(self.widget)
        self.connections_frame.setFrameShape(QFrame.StyledPanel)
        self.connections_frame.setFrameShadow(QFrame.Raised)

        self.horizontalLayout_3 = QHBoxLayout(self.connections_frame)
        self.connections_label = QLabel(self.connections_frame)
        self.horizontalLayout_3.addWidget(self.connections_label)

        self.connections_spinBox = QSpinBox(self.connections_frame)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        self.connections_spinBox.setProperty("value", 16)
        self.horizontalLayout_3.addWidget(self.connections_spinBox)
        self.connections_horizontalLayout.addWidget(self.connections_frame)

        self.buttons_horizontalLayout = QHBoxLayout()
#ok cancel buttons
        self.cancel_pushButton = QPushButton(self.widget)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))

        self.ok_pushButton = QPushButton(self.widget)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
        self.buttons_horizontalLayout.addWidget(self.ok_pushButton)
        self.buttons_horizontalLayout.addWidget(self.cancel_pushButton)
        self.connections_horizontalLayout.addLayout(self.buttons_horizontalLayout)
        self.addlink_verticalLayout.addLayout(self.connections_horizontalLayout)

        self.verticalLayout.addLayout(self.addlink_verticalLayout)

    
        self.proxy_checkBox.raise_()
        self.download_checkBox.raise_()
        self.folder_frame.raise_()
        self.download_frame.raise_()
        self.limit_checkBox.raise_()
        self.connections_frame.raise_()
        self.limit_frame.raise_()
        self.cancel_pushButton.raise_()
        self.ok_pushButton.raise_()
        self.link_frame.raise_()
        self.proxy_frame.raise_()
        self.start_checkBox.raise_()
        self.end_checkBox.raise_()
        self.start_frame.raise_()
        self.end_frame.raise_()

#labels
        self.setWindowTitle( "Enter Your Link")
        self.link_label.setText( "Download Link : ")
        self.proxy_checkBox.setText( "Proxy")
        self.proxy_pass_label.setText( "Proxy PassWord : "******"IP  :")
        self.proxy_user_label.setText( "Proxy UserName : "******"Port:")
        self.download_checkBox.setText( "Download UserName and PassWord")
        self.download_user_label.setText( "Download UserName : "******"Download PassWord : "******"Change Download Folder")
        self.folder_label.setText( "Download Folder : ")
        self.start_checkBox.setText( "Start Time")
        self.start_label.setText( ":")
        self.end_checkBox.setText( "End Time")
        self.end_label.setText( ":")
        self.limit_checkBox.setText( "Limit Speed")
        self.limit_comboBox.setItemText(0,  "KB/S")
        self.limit_comboBox.setItemText(1,  "MB/S")
        self.connections_label.setText( "Number Of Connections :")
        self.cancel_pushButton.setText( "Cancel")
        self.ok_pushButton.setText( "OK")
Exemple #29
0
    def setupUi(self):
        self.win.setWindowTitle(f"Tassomai Automation v{__version__}")
        self.win.setWindowIcon(QIcon(path('images', 'logo.png')))
        self.win.resize(665, 580)

        self.centralwidget = QWidget(self.win)

        self.formLayout = QFormLayout(self.centralwidget)
        self.formLayout.setContentsMargins(5, 0, 5, -1)

        self.topFrame = QFrame(self.centralwidget)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.topFrame.sizePolicy().hasHeightForWidth())
        self.topFrame.setSizePolicy(sizePolicy)
        self.topFrame.setAutoFillBackground(True)
        self.topFrame.setFrameShape(QFrame.StyledPanel)
        self.topFrame.setFrameShadow(QFrame.Raised)

        self.gridLayout = QGridLayout(self.topFrame)

        self.tassomaiImage = QLabel(self.topFrame)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.tassomaiImage.sizePolicy().hasHeightForWidth())
        self.tassomaiImage.setSizePolicy(sizePolicy)
        self.tassomaiImage.setPixmap(QPixmap(path('images', 'banner.png')))
        self.gridLayout.addWidget(self.tassomaiImage, 0, 0, 1, 1)

        self.formLayout.setWidget(0, QFormLayout.SpanningRole, self.topFrame)

        self.tab = QTabWidget(self.centralwidget)

        self.main_tab = QWidget()
        self.automation_tab = QWidget()

        self.gridLayout_4 = QGridLayout(self.main_tab)
        self.gridLayout_4.setContentsMargins(0, 0, 0, 0)

        self.main_frame = QFrame(self.main_tab)
        self.main_frame.setAutoFillBackground(True)
        self.main_frame.setFrameShape(QFrame.StyledPanel)
        self.main_frame.setFrameShadow(QFrame.Raised)
        self.gridLayout_2 = QGridLayout(self.main_frame)
        self.gridLayout_2.setContentsMargins(5, 6, 2, -1)
        self.gridLayout_2.setVerticalSpacing(10)

        self.gridLayout_5 = QGridLayout(self.automation_tab)
        self.gridLayout_5.setContentsMargins(0, 0, 0, 0)

        self.automation_frame = QFrame(self.automation_tab)
        self.automation_frame.setAutoFillBackground(True)
        self.automation_frame.setFrameShape(QFrame.StyledPanel)
        self.automation_frame.setFrameShadow(QFrame.Raised)

        self.delayLayout = QHBoxLayout()
        self.delayLayout.setContentsMargins(0, 0, 0, 0)
        self.delayLayout.setSpacing(3)

        self.delay = QCheckBox(self.main_frame)
        font = QFont()
        font.setPointSize(10)
        self.delay.setFont(font)

        self.delayLayout.addWidget(self.delay)

        self.amountOfDelay = QDoubleSpinBox(self.main_frame)
        self.amountOfDelay.setMinimumWidth(70)
        self.amountOfDelay.setMaximum(25.00)

        self.delayLayout.addWidget(self.amountOfDelay)

        self.label03 = QLabel(self.main_frame)
        self.label03.setSizePolicy(sizePolicy)
        self.label03.setFont(font)

        self.delayLayout.addWidget(self.label03)

        self.amountOfDelay2 = QDoubleSpinBox(self.main_frame)
        self.amountOfDelay2.setMinimumWidth(70)
        self.amountOfDelay2.setMaximum(25.00)

        self.delayLayout.addWidget(self.amountOfDelay2)

        self.label3 = QLabel(self.main_frame)
        self.label3.setSizePolicy(sizePolicy)
        self.label3.setFont(font)

        self.delayLayout.addWidget(self.label3)

        self.whenDelay = QComboBox(self.main_frame)
        self.whenDelay.addItem("question")
        self.whenDelay.addItem("quiz")
        self.whenDelay.setMaximumWidth(100)

        self.delayLayout.addWidget(self.whenDelay)

        self.verticalSpacer1 = QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.delayLayout.addItem(self.verticalSpacer1)

        self.gridLayout_2.addLayout(self.delayLayout, 2, 0, 1, 1)

        self.randomnessLayout = QHBoxLayout()
        self.randomnessLayout.setContentsMargins(0, 0, 0, 0)
        self.randomnessLayout.setSpacing(3)

        self.randomness = QCheckBox(self.main_frame)
        self.randomness.setFont(font)
        self.randomness.setMaximumWidth(338)

        self.randomnessLayout.addWidget(self.randomness)

        self.randomnessAmount = QSpinBox(self.main_frame)
        self.randomnessAmount.setMinimumWidth(70)
        self.randomnessAmount.setMaximum(600)

        self.randomnessLayout.addWidget(self.randomnessAmount)

        self.label4 = QLabel(self.main_frame)
        self.label4.setSizePolicy(sizePolicy)
        self.label4.setFont(font)

        self.randomnessLayout.addWidget(self.label4)

        self.gridLayout_2.addLayout(self.randomnessLayout, 3, 0, 1, 1)

        self.dailyGoal = QCheckBox(self.main_frame)
        font = QFont()
        font.setPointSize(10)
        self.dailyGoal.setFont(font)
        self.gridLayout_2.addWidget(self.dailyGoal, 4, 0, 1, 1)

        self.bonusGoal = QCheckBox(self.main_frame)
        self.bonusGoal.setFont(font)
        self.gridLayout_2.addWidget(self.bonusGoal, 5, 0, 1, 1)

        self.horizontalLayout = QHBoxLayout()

        self.label1 = QLabel(self.main_frame)
        sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label1.sizePolicy().hasHeightForWidth())
        self.label1.setSizePolicy(sizePolicy)
        font = QFont()
        font.setPointSize(10)
        self.label1.setFont(font)
        self.horizontalLayout.addWidget(self.label1)

        self.maxQuizes = QSpinBox(self.main_frame)
        self.maxQuizes.setMinimum(1)
        self.maxQuizes.setMaximum(1000000)
        self.maxQuizes.setProperty("value", 1000)
        self.horizontalLayout.addWidget(self.maxQuizes)

        self.label2 = QLabel(self.main_frame)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label2.sizePolicy().hasHeightForWidth())
        self.label2.setSizePolicy(sizePolicy)
        font = QFont()
        font.setPointSize(10)
        self.label2.setFont(font)
        self.horizontalLayout.addWidget(self.label2)
        self.gridLayout_2.addLayout(self.horizontalLayout, 1, 0, 1, 1)

        self.userBox = QGroupBox(self.main_frame)
        font = QFont()
        font.setPointSize(9)
        font.setBold(False)
        font.setWeight(50)
        self.userBox.setFont(font)
        self.gridLayout_3 = QGridLayout(self.userBox)

        self.emailTassomaiLabel = QLabel(self.userBox)
        self.gridLayout_3.addWidget(self.emailTassomaiLabel, 0, 0, 1, 1)
        self.emailTassomai = QLineEdit(self.userBox)
        self.gridLayout_3.addWidget(self.emailTassomai, 0, 1, 1, 1)

        self.passwordTassomaiLabel = QLabel(self.userBox)
        self.gridLayout_3.addWidget(self.passwordTassomaiLabel, 1, 0, 1, 1)
        self.passwordTassomai = QLineEdit(self.userBox)
        self.passwordTassomai.setEchoMode(QLineEdit.Password)
        self.gridLayout_3.addWidget(self.passwordTassomai, 1, 1, 1, 1)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout_3.addItem(self.verticalSpacer, 2, 0, 1, 1)

        self.gridLayout_4.addWidget(self.main_frame, 0, 0, 1, 1)
        self.gridLayout_5.addWidget(self.automation_frame, 0, 0, 1, 1)

        self.tab.addTab(self.main_tab, "")
        self.tab.addTab(self.automation_tab, "")

        self.formLayout.setWidget(1, QFormLayout.SpanningRole, self.tab)

        self.gridLayout_2.addWidget(self.userBox, 0, 0, 1, 1)

        self.buttonsLayout = QHBoxLayout()

        self.bottom_frame = QFrame(self.centralwidget)
        self.bottom_frame.setFrameShape(QFrame.StyledPanel)
        self.bottom_frame.setFrameShadow(QFrame.Raised)

        self.gridLayout_7 = QGridLayout(self.bottom_frame)
        self.gridLayout_7.setContentsMargins(0, 0, 0, 0)


        self.startButton = QPushButton(self.bottom_frame)
        self.buttonsLayout.addWidget(self.startButton)

        self.stopButton = QPushButton(self.bottom_frame)
        self.buttonsLayout.addWidget(self.stopButton)

        self.gridLayout_7.addLayout(self.buttonsLayout, 0, 0, 1, 1)

        self.output = QTextEdit(self.bottom_frame)
        self.gridLayout_7.addWidget(self.output, 1, 0, 1, 1)

        self.formLayout.setWidget(2, QFormLayout.SpanningRole, self.bottom_frame)

        self.win.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(self.win)
        self.menubar.setGeometry(QRect(0, 0, 665, 21))

        self.tools_menu = QMenu(self.menubar)

        self.uninstall_option = QAction()

        self.tools_menu.addAction(self.uninstall_option)

        self.menubar.addAction(self.tools_menu.menuAction())

        self.win.setMenuBar(self.menubar)

        self.createTable()
        self.retranslateUi()

        self.tab.setCurrentIndex(0)
        self.tab.currentChanged['int'].connect(lambda k: self.bottom_frame.hide() if k != 0 else self.bottom_frame.show())

        QMetaObject.connectSlotsByName(self.win)
Exemple #30
0
    def setup(self):
        self.resize(450, 120)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_project_name = QLabel(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_project_name.sizePolicy().hasHeightForWidth())
        self.label_project_name.setSizePolicy(sizePolicy)
        self.label_project_name.setMinimumSize(QSize(80, 24))
        self.label_project_name.setMaximumSize(QSize(80, 24))
        self.label_project_name.setObjectName("label_project_name")
        self.horizontalLayout.addWidget(self.label_project_name)
        self.lineEdit_project_name = QLineEdit(self)
        self.lineEdit_project_name.setObjectName("lineEdit_project_name")
        self.horizontalLayout.addWidget(self.lineEdit_project_name)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_location = QLabel(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_location.sizePolicy().hasHeightForWidth())
        self.label_location.setSizePolicy(sizePolicy)
        self.label_location.setMinimumSize(QSize(80, 24))
        self.label_location.setMaximumSize(QSize(80, 24))
        self.label_location.setObjectName("label_location")
        self.horizontalLayout_2.addWidget(self.label_location)
        self.lineEdit_location = QLineEdit(self)
        self.lineEdit_location.setObjectName("lineEdit_location")
        self.lineEdit_location.setReadOnly(True)
        self.lineEdit_location.setText(os.getcwd())
        self.horizontalLayout_2.addWidget(self.lineEdit_location)
        self.toolbutton_open = QToolButton(self)
        self.toolbutton_open.setMinimumSize(QSize(24, 24))
        self.toolbutton_open.setMaximumSize(QSize(24, 24))
        self.toolbutton_open.setObjectName("toolbutton_open")
        self.horizontalLayout_2.addWidget(self.toolbutton_open)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi()

        #        给项目路径和项目赋初值
        self.project_dir = self.lineEdit_location.text()
        self.project_name = self.lineEdit_project_name.text()
        #        信号与槽进行连接
        self.buttonBox.accepted.connect(self.slot_accept)
        self.buttonBox.rejected.connect(self.reject)
        self.toolbutton_open.clicked.connect(self.slot_open)
        self.lineEdit_project_name.textChanged.connect(self.slot_set_dir)
        QMetaObject.connectSlotsByName(self)
Exemple #31
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        super(PreviewerHTML, self).__init__(parent)
        
        self.__layout = QVBoxLayout(self)
        
        self.titleLabel = QLabel(self)
        self.titleLabel.setWordWrap(True)
        self.titleLabel.setTextInteractionFlags(Qt.NoTextInteraction)
        self.__layout.addWidget(self.titleLabel)
        
        try:
            from PyQt5.QtWebEngineWidgets import QWebEngineView
            self.previewView = QWebEngineView(self)
            self.__usesWebKit = False
        except ImportError:
            from PyQt5.QtWebKitWidgets import QWebPage, QWebView
            self.previewView = QWebView(self)
            self.previewView.page().setLinkDelegationPolicy(
                QWebPage.DelegateAllLinks)
            self.__usesWebKit = True
        
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.previewView.sizePolicy().hasHeightForWidth())
        self.previewView.setSizePolicy(sizePolicy)
        self.previewView.setContextMenuPolicy(Qt.NoContextMenu)
        self.previewView.setUrl(QUrl("about:blank"))
        self.__layout.addWidget(self.previewView)
        
        self.jsCheckBox = QCheckBox(self.tr("Enable JavaScript"), self)
        self.jsCheckBox.setToolTip(self.tr(
            "Select to enable JavaScript for HTML previews"))
        self.__layout.addWidget(self.jsCheckBox)
        
        self.ssiCheckBox = QCheckBox(self.tr("Enable Server Side Includes"),
                                     self)
        self.ssiCheckBox.setToolTip(self.tr(
            "Select to enable support for Server Side Includes"))
        self.__layout.addWidget(self.ssiCheckBox)
        
        self.jsCheckBox.clicked[bool].connect(self.on_jsCheckBox_clicked)
        self.ssiCheckBox.clicked[bool].connect(self.on_ssiCheckBox_clicked)
        self.previewView.titleChanged.connect(self.on_previewView_titleChanged)
        if self.__usesWebKit:
            self.previewView.linkClicked.connect(
                self.on_previewView_linkClicked)
        
        self.jsCheckBox.setChecked(
            Preferences.getUI("ShowFilePreviewJS"))
        self.ssiCheckBox.setChecked(
            Preferences.getUI("ShowFilePreviewSSI"))
        
        self.__scrollBarPositions = {}
        self.__vScrollBarAtEnd = {}
        self.__hScrollBarAtEnd = {}
        
        self.__processingThread = PreviewProcessingThread()
        self.__processingThread.htmlReady.connect(self.__setHtml)

        self.__previewedPath = None
        self.__previewedEditor = None
class DroneGUI(QDialog):
    global l, w

    def __init__(self, parent=None):
        super(DroneGUI, self).__init__(parent)

        # creates the terminal
        self.create_terminal()

        # create tabs
        self.create_tabs()

        # set the size policy
        self.set_size_policy()

        # palette background setting, style
        self.create_palette()

        # adds the arm, kill, unarm buttons
        # self.create_arm_kill_buttons()

        # adds the PID insert text boxes
        self.create_PID_insert()

        # adds the log
        self.create_log()

        # stream for the command line output to fill the log
        sys.stdout = Stream(newText=self.onUpdateText)

        # adds the data monitor
        self.create_data_monitor()

        # installs the event filter for 'space bar' and 'a'
        qApp.installEventFilter(self)

        # creates a button to deliver a live motor output plot graph
        self.motor_output_plot_graph_is_open = False
        self.create_motor_output_plot_button()

        # create the flight motion labels
        self.create_flight_motion_labels()

        # shows the current information of the drone
        self.drone_information()

        # add logo
        self.set_logo()

        # set up about tab
        self.show_about_info()

        # commands currently allowed in the terminal
        self.accepted_commands = {"connect", "arm", "kill", "forward",
                                  "altitude", "vehicle status", "pi status", "square"}

        # accepted IPs for the Raspberry Pi
        self.accepted_ips = {"192.168.1.1"}

        self.ssh_client = None


    def eventFilter(self, obj, event):
        if event.type() == QEvent.KeyPress:
            if event.key() == Qt.Key_Return:
                x = self.term.toPlainText().strip()
                split = x.split(' ')
                if split[0] in self.accepted_commands:
                        if split[0] == "connect":
                            if len(split) > 1:
                                if split[1] in self.accepted_ips:
                                    print("> Connecting RPi...")
                                    print("=> " + split[1])
                                    self.ssh_client = self.connect_to_pi(split[1], 22, 'admin')
                        elif split[0] == "arm":
                            print("> Arming...")
                            # self.executeCommand(self.ssh_client, 'python ./RPi_FC.py')
                self.term.clear()
        return super(DroneGUI, self).eventFilter(obj, event)


    # filters space bar to allow it to be a killswitch only
    # filters 'a' to allow it to arm the drone only
    #def eventFilter(self, obj, event):
    #     if event.type() == QEvent.KeyPress:
    #         if event.key() == Qt.Key_Space:
    #             if self.arm_button.isChecked():
    #                 print("KILL SWITCH ACTIVATED")
    #                 self.arm_button.toggle()
    #                 self.arm_button.setEnabled(False)
    #                 self.undo_killswitch_button.setEnabled(True)
    #                 self.undo_killswitch_button.setStyleSheet("background-color: yellow; color:black")
    #                 self.arm_button.setStyleSheet("background-color: Gray")
    #                 self.killswitch_button.setEnabled(False)
    #                 self.killswitch_button.setStyleSheet("background-color: Darkred; color:black")
    #                 self.curr_status.setStyleSheet("background-color: #922B3E;")
    #                 self.curr_status.setText("Inactive")
    #                 self.flight_timer.stop()
    #                 # fc.receiver.ARM = False
    #                 return True
    #             else:
    #                 return True
    #         if event.key() == Qt.Key_A:
    #             if not(self.arm_button.isChecked()):
    #                 print()
    #                 print("Initialize Arming Process...")
    #                 self.arm_button.setStyleSheet("background-color: Green")
    #                 self.undo_killswitch_button.setEnabled(False)
    #                 self.killswitch_button.setEnabled(True)
    #                 self.killswitch_button.setStyleSheet("background-color: red")
    #                 self.undo_killswitch_button.setStyleSheet("background-color:rgb(53,53,53);")
    #                 self.arm_button.setEnabled(False)
    #                 self.arm_button.setChecked(True)
    #                 self.curr_status.setStyleSheet("background-color: #507D2A")
    #                 self.curr_status.setText("Active")
    #                 self.flight_timer.start(1000)
    #                 # Since we're skipping the unlock arm button,
    #                 # fc.run()
    #                 return True
    #             else:
    #                 return True
    #     return super(DroneGUI, self).eventFilter(obj, event)

    # Connects to the IP using a port, username, and password via SSH.
    def connect_to_pi(self, ip, port, username, password="******"):
        sshClient = paramiko.SSHClient()
        sshClient.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        sshClient.load_system_host_keys()
        try:
            sshClient.connect(ip, port, username, password, timeout=10)
        except Exception as e:
            print(e)
            sshClient.connect(ip + ".local", port, username, password)

        return sshClient

    # Takes in an sshClient and sends the command to it
    def executeCommand(sshClient, command):
        stdin, stdout, stderr = sshClient.exec_command(command)
        print("> COMMAND:", command)

    # creates a log for the command line output
    def create_terminal(self):
        self.term = QTextEdit(self)
        self.term.move(l-260, 20)
        self.term.setFixedSize(260,22)
        self.term.setFixedHeight(18)
        self.term.moveCursor(QTextCursor.Start)
        self.term.setReadOnly(False)
        self.term.setCursorWidth(4)

    # resizes the GUI
    def set_size_policy(self):
        self.sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.sizePolicy.setHorizontalStretch(0)
        self.sizePolicy.setVerticalStretch(0)
        self.sizePolicy.setHeightForWidth(self.sizePolicy.hasHeightForWidth())
        self.setSizePolicy(self.sizePolicy)
        self.setMaximumSize(l, w)
        self.setMinimumSize(l, w)

    # Creates the tabs
    def create_tabs(self):
        self.tabWidget = QTabWidget(self)
        self.tabWidget.setGeometry(QRect(0, 150, l-260,w-100 ))
        self.tabWidget.setMaximumSize(QSize(l, w-100))
        self.tabWidget.setTabPosition(QTabWidget.North)
        self.tabWidget.setTabShape(QTabWidget.Rounded)
        self.tabWidget.setElideMode(Qt.ElideRight)
        self.tabWidget.setUsesScrollButtons(False)
        self.tabWidget.setDocumentMode(True)
        self.tabWidget.setTabsClosable(False)
        self.tabWidget.setMovable(False)
        self.tabWidget.setTabBarAutoHide(False)
        self.data_tab = QWidget()
        self.settings_tab = QWidget()
        self.flight_pattern_tab = QWidget()
        self.about_tab = QWidget()
        self.tabWidget.addTab(self.settings_tab, "Settings")
        self.tabWidget.addTab(self.data_tab, "Data")
        self.tabWidget.addTab(self.flight_pattern_tab, "Flight Pattern")
        self.tabWidget.addTab(self.about_tab, "About")
        self.tabWidget.show()

    # Defines the palette colors
    def create_palette(self):
        self.setWindowTitle("Flight Controller")
        app.setStyle("Fusion")
        app.setFont(QFont("Helvetica"))
        dark_palette = QPalette()
        dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.WindowText, Qt.white)
        dark_palette.setColor(QPalette.Base, QColor(25, 25, 25))
        dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
        dark_palette.setColor(QPalette.ToolTipText, Qt.white)
        dark_palette.setColor(QPalette.Text, Qt.white)
        dark_palette.setColor(QPalette.Button, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.ButtonText, Qt.white)
        dark_palette.setColor(QPalette.BrightText, Qt.red)
        dark_palette.setColor(QPalette.Link, QColor(42, 130, 218))
        dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
        dark_palette.setColor(QPalette.HighlightedText, Qt.black)
        app.setPalette(dark_palette)

    # # create buttons to arm, and kill, and un-kill the drone
    # def create_arm_kill_buttons(self):
    #     # button to arm the drone
    #     self.arm_button = QPushButton('ARM', self)
    #     self.arm_button.setDefault(False)
    #     self.arm_button.setAutoDefault(False)
    #     self.arm_button.setStyleSheet("background-color: green")
    #     self.arm_button.move(0, 0)
    #     self.arm_button.resize(70, 43)
    #     self.arm_button.setFont(QFont("Helvetica", 17.5))
    #     self.arm_button.setCheckable(True)
    #     self.arm_button.setEnabled(True)
    #     self.arm_button.clicked.connect(self.arm_drone)
    #     self.arm_button.setShortcut("A")
    #
    #     # button to kill the drone
    #     self.killswitch_button = QPushButton('KILL SWITCH', self)
    #     self.killswitch_button.move(l-110, 0)
    #     self.killswitch_button.setDefault(False)
    #     self.killswitch_button.setAutoDefault(False)
    #     self.killswitch_button.setFont(QFont("Helvetica", 17.0))
    #     self.killswitch_button.resize(110, 60)
    #     self.killswitch_button.clicked.connect(self.kill_motor)
    #     self.killswitch_button.setStyleSheet("background-color: red")
    #     self.killswitch_button.setEnabled(False)
    #     self.killswitch_button.setShortcut("Space")
    #
    #     # button to undo kill switch
    #     self.undo_killswitch_button = QPushButton('Unlock ARM', self)
    #     self.undo_killswitch_button.setDefault(False)
    #     self.undo_killswitch_button.setAutoDefault(False)
    #     self.undo_killswitch_button.move(l-110, 62)
    #     self.undo_killswitch_button.setFont(QFont("Helvetica", 12))
    #     self.undo_killswitch_button.resize(75, 30)
    #     self.undo_killswitch_button.clicked.connect(self.undo_killswitch)
    #     self.undo_killswitch_button.setStyleSheet("background-color:rgb(53,53,53);")
    #     self.undo_killswitch_button.setEnabled(False)
    #
    #     # button to exit the application
    #     self.exit_app_button = QPushButton('exit', self)
    #     self.exit_app_button.resize(0,0)
    #     self.exit_app_button.setShortcut("Shift+Q")
    #     self.exit_app_button.clicked.connect(self.exit_application)


    # killswitch for the drone
    def kill_motor(self):
        if self.arm_button.isChecked():
            print("KILL SWITCH ACTIVATED")
            self.flight_timer.stop()
            self.arm_button.toggle()
            self.arm_button.setEnabled(False)
            self.undo_killswitch_button.setEnabled(True)
            self.undo_killswitch_button.setStyleSheet("background-color: yellow; color:black")
            self.killswitch_button.setEnabled(False)
            self.killswitch_button.setStyleSheet("background-color: Darkred; color:black")
            self.arm_button.setStyleSheet("background-color: Gray")
            self.curr_status.setStyleSheet("background-color: #922B3E;")
            self.curr_status.setText("Inactive")
            # fc.receiver.ARM = False

    # allows the drone to be armed again
    def undo_killswitch(self):
        print("Arm button unlocked")
        self.arm_button.setEnabled(True)
        self.undo_killswitch_button.setEnabled(False)
        self.killswitch_button.setStyleSheet("background-color: red")
        self.undo_killswitch_button.setStyleSheet("background-color: Gold")
        self.arm_button.setStyleSheet("background-color: Green")
        # fc.receiver.ARM = True

    # arms the drone
    def arm_drone(self):
        print()
        print("Initialize Arming Process...")
        self.flight_timer.start(1000)
        self.undo_killswitch_button.setEnabled(False)
        self.killswitch_button.setEnabled(True)
        self.undo_killswitch_button.setStyleSheet("background-color:rgb(53,53,53);")
        self.arm_button.setEnabled(False)
        self.curr_status.setStyleSheet("background-color: #507D2A")
        self.curr_status.setText("Active")
        # fc.run()

    # displays current drone information
    def drone_information(self):
        # widget for the drone status section
        self.drone_status = QWidget(self.settings_tab)
        self.drone_status.resize(180,110)
        self.drone_status.move(92,200)

        self.state_label = QPushButton("Drone Status", self.drone_status)
        self.state_label.setCheckable(False)
        self.state_label.setEnabled(False)
        self.state_label.setStyleSheet("background: #333332; color: white")
        self.state_label.move(0, 0)
        self.state_label.show()
        self.state_label.resize(80,20)
        self.curr_status = QPushButton("Inactive", self.drone_status)
        self.curr_status.setIcon(QIcon("Images/Icons/drone.png"))
        self.curr_status.setDefault(False)
        self.curr_status.setEnabled(False)
        self.curr_status.setStyleSheet("background-color: #922B3E;")
        self.curr_status.move(81,0)
        self.curr_status.resize(70,20)
        self.curr_P = QLineEdit(self.drone_status)
        self.curr_P.setReadOnly(True)
        self.curr_P_label = QLabel(self.drone_status)
        self.curr_P_label.move(2, 25)
        self.curr_P_label.setText("Proportional:")
        self.curr_P_label.show()
        self.curr_P.setText(str(fc.Kp))  # " ", str(fc.Ki), " ", str(fc.Kd))
        self.curr_P.move(80, 25)
        self.curr_P.resize(90,12)
        self.curr_P.show()
        self.curr_I_label = QLabel(self.drone_status)
        self.curr_I_label.move(2, 40)
        self.curr_I_label.setText("       Integral:")
        self.curr_I_label.show()
        self.curr_I = QLineEdit(self.drone_status)
        self.curr_I.setReadOnly(True)
        self.curr_I.setText(str(fc.Ki))  # " ", str(fc.Ki), " ", str(fc.Kd))
        self.curr_I.move(80, 40)
        self.curr_I.resize(90,12)
        self.curr_I.show()
        self.curr_D_label = QLabel(self.drone_status)
        self.curr_D_label.move(2, 55)
        self.curr_D_label.setText("   Derivative:")
        self.curr_D_label.show()
        self.curr_D = QLineEdit(self.drone_status)
        self.curr_D.setReadOnly(True)
        self.curr_D.setText(str(fc.Kd))  # " ", str(fc.Ki), " ", str(fc.Kd))
        self.curr_D.move(80, 55)
        self.curr_D.resize(90, 12)
        self.curr_D.show()
        self.flight_time_label = QLabel("Flight Time:", self.drone_status)
        self.flight_time_label.move(5, 85)
        self.flight_time = QLineEdit(self.drone_status)
        self.flight_time.setReadOnly(True)
        self.flight_time.move(80, 80)
        self.flight_time.setFont(QFont("Helvetica", 15))
        self.flight_time.resize(50,18)
        self.flight_timer = QTimer()
        self.time = QTime(0,0)
        self.flight_timer.timeout.connect(self.update_timer)

        self.hard_wired_button = QPushButton("Hard Wired Inputs", self.settings_tab)
        self.hard_wired_button.move(l-365,2)
        self.hard_wired_button.setStyleSheet("background-color:#002366;")
        self.hard_wired_button.clicked.connect(self.show_hard_wire_connections)

    # gets the current updated PID values
    def get_PID_value(self):
        # try:
        #     fc.Kp = np.array([float(self.Kp0_textbox.text()), float(self.Kp1_textbox.text()), float(self.Kp2_textbox.text())])
        #     fc.Ki = np.array([float(self.Ki0_textbox.text()), float(self.Ki1_textbox.text()), float(self.Ki2_textbox.text())])
        #     fc.Kd = np.array([float(self.Kd0_textbox.text()), float(self.Kd1_textbox.text()), float(self.Kd2_textbox.text())])
        # except(ValueError):
        #     print("Error: Must input values into each coordinate.")
        # else:
        #     print()
        #     print(time.strftime("   %H:%M:%S %Z"))
        #     print("Update PID Gains")
        #     print("P:    ", fc.Kp[0], " ", fc.Kp[1], " ", fc.Kp[2])
        #     print("I :    ", fc.Ki[0], " ", fc.Ki[1], " ", fc.Ki[2])
        #     print("D:    ", fc.Kd[0], " ", fc.Kd[1], " ", fc.Kd[2])
            print()

    # creates the PID text boxes, button for updating PID values
    def create_PID_insert(self):
        print()
        # widget for PID insertion
        # self.PID_widget = QWidget(self.settings_tab)
        # self.PID_widget.resize(300,200)
        # self.PID_widget.move(10,20)
        # # proportional text
        # self.onlyDouble = QDoubleValidator()
        # self.Kp0_textbox = QLineEdit(self.PID_widget)
        # self.Kp0_textbox.clearFocus()
        # self.Kp0_textbox.setValidator(self.onlyDouble)
        # self.Kp0_textbox.resize(50, 23)
        # self.Kp0_textbox.setText(str(fc.Kp[0]))
        # self.Kp1_textbox = QLineEdit(self.PID_widget)
        # self.Kp1_textbox.setValidator(self.onlyDouble)
        # self.Kp1_textbox.resize(50, 23)
        # self.Kp1_textbox.move(50,0)
        # self.Kp1_textbox.setText(str(fc.Kp[1]))
        # self.Kp2_textbox = QLineEdit(self.PID_widget)
        # self.Kp2_textbox.setValidator(self.onlyDouble)
        # self.Kp2_textbox.resize(50, 23)
        # self.Kp2_textbox.move(100, 0)
        # self.Kp2_textbox.setText(str(fc.Kp[2]))
        # # proportional label
        # self.Kp_label = QLabel(self.PID_widget)
        # self.Kp_label.setText('Proportional')
        # self.Kp_label.move(150, 0)
        # self.Kp_label.resize(85, 23)
        # self.Kp_label.setFrameShape(QFrame.Panel)
        # self.Kp_label.setFrameShadow(QFrame.Sunken)
        # self.Kp_label.setLineWidth(3)
        # self.Kp_label.setStyleSheet("background-color:rgb(53,53,53);")
        #
        # # integral text
        # self.Ki0_textbox = QLineEdit(self.PID_widget)
        # self.Ki0_textbox.move(0, 27)
        # self.Ki0_textbox.resize(50, 23)
        # self.Ki0_textbox.setValidator(self.onlyDouble)
        # self.Ki0_textbox.setText(str(fc.Ki[0]))
        # self.Ki1_textbox = QLineEdit(self.PID_widget)
        # self.Ki1_textbox.move(50, 27)
        # self.Ki1_textbox.resize(50, 23)
        # self.Ki1_textbox.setValidator(self.onlyDouble)
        # self.Ki1_textbox.setText(str(fc.Ki[1]))
        # self.Ki2_textbox = QLineEdit(self.PID_widget)
        # self.Ki2_textbox.move(100, 27)
        # self.Ki2_textbox.resize(50, 23)
        # self.Ki2_textbox.setValidator(self.onlyDouble)
        # self.Ki2_textbox.setText(str(fc.Ki[2]))
        # # integral label
        # self.Ki_label = QLabel(self.PID_widget)
        # self.Ki_label.setText('Integral')
        # self.Ki_label.move(150, 27)
        # self.Ki_label.resize(85, 23)
        # self.Ki_label.setFrameShape(QFrame.Panel)
        # self.Ki_label.setFrameShadow(QFrame.Sunken)
        # self.Ki_label.setLineWidth(3)
        # self.Ki_label.setStyleSheet("background-color:rgb(53,53,53);")
        #
        # # derivative text
        # self.Kd0_textbox = QLineEdit(self.PID_widget)
        # self.Kd0_textbox.move(0, 54)
        # self.Kd0_textbox.resize(50, 23)
        # self.Kd0_textbox.setValidator(self.onlyDouble)
        # self.Kd0_textbox.setText(str(fc.Kd[0]))
        # self.Kd1_textbox = QLineEdit(self.PID_widget)
        # self.Kd1_textbox.move(50, 54)
        # self.Kd1_textbox.resize(50, 23)
        # self.Kd1_textbox.setValidator(self.onlyDouble)
        # self.Kd1_textbox.setText(str(fc.Kd[1]))
        # self.Kd2_textbox = QLineEdit(self.PID_widget)
        # self.Kd2_textbox.move(100, 54)
        # self.Kd2_textbox.resize(50, 23)
        # self.Kd2_textbox.setValidator(self.onlyDouble)
        # self.Kd2_textbox.setText(str(fc.Kd[2]))
        # # derivative label
        # self.Kd_label = QLabel(self.PID_widget)
        # self.Kd_label.resize(85, 23)
        # self.Kd_label.setText('Derivative')
        # self.Kd_label.move(150, 54)
        # self.Kd_label.setFrameShape(QFrame.Panel)
        # self.Kd_label.setFrameShadow(QFrame.Sunken)
        # self.Kd_label.setLineWidth(3)
        # self.Kd_label.setStyleSheet("background-color:rgb(53,53,53);")
        #
        # # button to insert new PID values
        # self.insert_PID_values = QPushButton("Insert PID Gains", self.PID_widget)
        # self.insert_PID_values.setStyleSheet("background-color:	#002366;")
        # self.insert_PID_values.move(150, 80)
        # self.insert_PID_values.resize(85, 25)
        # self.insert_PID_values.setFont(QFont("Helvetica", 11.5))
        # self.insert_PID_values.setCheckable(True)
        # self.insert_PID_values.setEnabled(True)
        # self.insert_PID_values.clicked.connect(self.get_PID_value)
        #
        # # label for Roll, Pitch, Yaw
        # self.RPY = QLabel(self.PID_widget)
        # self.RPY.move(0,80)
        # self.RPY.setText(' Roll        Pitch         Yaw  ')
        # self.RPY.setFrameShape(QFrame.Panel)
        # self.RPY.setFrameShadow(QFrame.Sunken)
        # self.RPY.setLineWidth(3)
        # self.RPY.setStyleSheet("background-color:rgb(53,53,53);")

    def onUpdateText(self, text):
        cursor = self.log.textCursor()
        cursor.movePosition(QTextCursor.End)
        cursor.insertText(text)
        self.log.setTextCursor(cursor)
        self.log.ensureCursorVisible()

    def __del__(self):
        sys.stdout = sys.__stdout__

    # creates a log for the command line output
    def create_log(self):
        self.log = QTextEdit(self)
        self.log.move(l-260, w-465)
        self.log.resize(260, w-175)
        self.log.moveCursor(QTextCursor.Start)
        self.log.ensureCursorVisible()
        self.log.setLineWrapMode(QTextEdit.FixedPixelWidth)
        self.log.setReadOnly(True)
        self.log.setLineWrapColumnOrWidth(250)
        try:
            sys.stdout = Stream(newText=self.onUpdateText)
        except AttributeError as error:
            print(error)

    # creates data monitor
    def create_data_monitor(self):
        # make QTimer
        self.qTimer = QTimer(self)


        # pi connection status
        self.pi_connection_status_is_clicked = False
        self.pi_connection_label = QPushButton("Pi Connection", self)
        self.pi_connection_label.setCheckable(False)
        self.pi_connection_label.setEnabled(False)
        self.pi_connection_label.setStyleSheet("background: #333332; color: white")
        self.pi_connection_label.move(2, 96)
        self.pi_connection_label.show()
        self.pi_connection_label.resize(80, 20)
        self.pi_connection_status = QPushButton("Offline", self)
        self.pi_connection_status.move(2,115)
        self.pi_connection_status.setDefault(False)
        self.pi_connection_status.setEnabled(False)
        self.pi_connection_status.setIcon(QIcon('Images/Icons/connection.png'))
        self.pi_connection_status.setStyleSheet("background-color: #922B3E;")

        # set interval to update
        self.qTimer.setInterval(250)

        # connect timeout signal to signal handler
        self.qTimer.timeout.connect(self.get_sensor_value)

        self.qTimer.start()

    # creates the plot graph button
    def create_motor_output_plot_button(self):
        self.plot_button = QPushButton("Motor Output Plot Graph", self.data_tab)
        self.plot_button.setStyleSheet("background-color:#002366;")
        self.plot_button.setIcon(QIcon("Images/Icons/line_graph.png"))
        self.plot_button.clicked.connect(self.create_motor_output_plot)
        self.plot_button.move(2,20)
        # time stamp for the graph's delta time initialization
        self.timestamp = time.time()

    # function to start the timer for QTimer
    def start_timer(self):
        if self.timer.isActive():
            # sets the Y Range for the graph
            self.pw.setYRange(-2, 2)
            print("Graph is already updating at ", self.timer.interval(), " ms between data retrievals")
        else:
            self.timer.start()
            # sets the Y Range for the graph
            self.pw.setYRange(-2, 2)

    # create a live motor output plot graph
    def create_motor_output_plot(self):
        self.motor_output_plot_graph_is_open = True
        # widget for the motor output graph
        self.motor_output_graph_widget = QWidget(self.data_tab)
        self.motor_output_graph_widget.resize(l - 260, w - 100)
        self.motor_output_graph_widget.show()
        # motor 1 output title
        self.motor_1_output_title = QPushButton("Motor 1 Output", self.motor_output_graph_widget)
        self.motor_1_output_title.move(l - 400, 60)
        self.motor_1_output_title.setStyleSheet("background: black; color: gray;")
        self.motor_1_output_title.setEnabled(False)
        self.motor_1_output_title.setCheckable(False)
        self.motor_1_output_title.setFixedSize(90, 13)
        self.motor_1_output_title.setFont(QFont("Helvetica", 11.5))
        self.motor_1_output_title.show()

        self.motor_1_output_title_color = QLabel(self.motor_output_graph_widget)
        self.motor_1_output_title_color.setPixmap(QPixmap('Images/Icons/red_square.png'))
        self.motor_1_output_title_color.move(l - 413, 60)
        self.motor_1_output_title_color.show()

        # motor 2 output title
        self.motor_2_output_title = QPushButton("Motor 2 Output", self.motor_output_graph_widget)
        self.motor_2_output_title_color = QLabel(self.motor_output_graph_widget)
        self.motor_2_output_title_color.setPixmap(QPixmap('Images/Icons/blue_square.png'))
        self.motor_2_output_title_color.move(l - 413, 90)
        self.motor_2_output_title_color.show()
        self.motor_2_output_title.move(l - 400, 90)
        self.motor_2_output_title.setStyleSheet("background: black; color: gray;")
        self.motor_2_output_title.setEnabled(False)
        self.motor_2_output_title.setCheckable(False)
        self.motor_2_output_title.setFixedSize(90, 13)
        self.motor_2_output_title.setFont(QFont("Helvetica", 11.5))
        self.motor_2_output_title.show()

        # motor 3 output title
        self.motor_3_output_title = QPushButton("Motor 3 Output", self.motor_output_graph_widget)
        self.motor_3_output_title_color = QLabel(self.motor_output_graph_widget)
        self.motor_3_output_title_color.setPixmap(QPixmap('Images/Icons/yellow_square.png'))
        self.motor_3_output_title_color.move(l - 413, 120)
        self.motor_3_output_title_color.show()
        self.motor_3_output_title.move(l - 400, 120)
        self.motor_3_output_title.setStyleSheet("background: black; color: gray;")
        self.motor_3_output_title.setEnabled(False)
        self.motor_3_output_title.setCheckable(False)
        self.motor_3_output_title.setFixedSize(90, 13)
        self.motor_3_output_title.setFont(QFont("Helvetica", 11.5))
        self.motor_3_output_title.show()

        # motor 4 output title
        self.motor_4_output_title = QPushButton("Motor 4 Output", self.motor_output_graph_widget)
        self.motor_4_output_title_color = QLabel(self.motor_output_graph_widget)
        self.motor_4_output_title_color.setPixmap(QPixmap('Images/Icons/purple_square.png'))
        self.motor_4_output_title_color.move(l - 413, 150)
        self.motor_4_output_title_color.show()
        self.motor_4_output_title.move(l - 400, 150)
        self.motor_4_output_title.setStyleSheet("background: black; color: gray;")
        self.motor_4_output_title.setEnabled(False)
        self.motor_4_output_title.setCheckable(False)
        self.motor_4_output_title.setFixedSize(90, 13)
        self.motor_4_output_title.setFont(QFont("Helvetica", 11.5))
        self.motor_4_output_title.show()

        # motor 1 output
        self.motor_1_output = QLabel(str(fc.motor_output[0]), self.motor_output_graph_widget)
        self.motor_1_output.move(l - 395, 75)
        self.motor_1_output.resize(70, 12)
        self.motor_1_output.show()

        # motor 2 output
        self.motor_2_output = QLabel(str(fc.motor_output[1]), self.motor_output_graph_widget)
        self.motor_2_output.move(l - 395, 105)
        self.motor_2_output.resize(70, 12)
        self.motor_2_output.show()

        # motor 3 output
        self.motor_3_output = QLabel(str(fc.motor_output[2]), self.motor_output_graph_widget)
        self.motor_3_output.move(l - 395, 135)
        self.motor_3_output.resize(70, 12)
        self.motor_3_output.show()

        # motor 4 output
        self.motor_4_output = QLabel(str(fc.motor_output[3]), self.motor_output_graph_widget)
        self.motor_4_output.move(l - 395, 165)
        self.motor_4_output.resize(70, 12)
        self.motor_4_output.show()


        self.pw = pg.PlotWidget(self.motor_output_graph_widget)
        self.pw.showGrid(x=True,y=True)
        self.pw.setTitle('Live Update Graph (demonstration with sin function)')
        self.pw.move(0,20)
        self.pw.resize(l/2,w/2)
        self.pw.show()
        self.pw.setLabel('left', 'Motor Output')
        self.pw.setLabel('bottom', 'Time', units='s')
        self.pw.setAntialiasing(True)
        # sets the Y Range for the graph
        self.pw.setYRange(-2,2)
        self.timer = pg.QtCore.QTimer(self)

        self.stop_plot_button = QPushButton("Pause", self.motor_output_graph_widget)
        self.stop_plot_button.setStyleSheet("background-color:#002366;")
        self.stop_plot_button.setIcon(QIcon('Images/Icons/stop.png'))
        self.stop_plot_button.clicked.connect(self.timer.stop)
        self.stop_plot_button.resize(80,20)
        self.stop_plot_button.move(20, 0)
        self.stop_plot_button.show()

        self.start_plot_button = QPushButton("Start", self.motor_output_graph_widget)
        self.start_plot_button.setIcon(QIcon('Images/Icons/play.png'))
        self.start_plot_button.resize(80,20)
        self.start_plot_button.setStyleSheet("background-color:#002366;")
        self.start_plot_button.clicked.connect(self.start_timer)
        self.start_plot_button.move(l/2-110,0)
        self.start_plot_button.show()

        # buffer size for the data
        self.buffer = 200
        # queue to get the current delta time and values
        self.queue = Queue(self.buffer)
        # deque containing the values
        self.values_1 = deque([], maxlen=self.buffer)
        self.values_2 = deque([], maxlen=self.buffer)
        self.values_3 = deque([], maxlen = self.buffer)
        self.values_4 = deque([], maxlen=self.buffer)
        self.values_5 = deque([], maxlen=self.buffer)

        # deque containing the delta times
        self.times = deque([], maxlen=self.buffer)

        def update():
            # current delta time
            t = time.time() - self.timestamp

            # value(s) that we want to track
            v1 = fc.motor_output[0]
            v2 = fc.motor_output[1]
            v3 = fc.motor_output[2]
            v4 = fc.motor_output[3]
            # demonstration
            v5 = np.sin(t)


            # put the data into queue
            self.queue.put([t,v1,v2,v3,v4,v5])

            # get the data from the queue. Will wait until item is available
            data = self.queue.get(True, None)

            # append data in each deque
            self.times.append(data[0])
            self.values_1.append(data[1])
            self.values_2.append(data[2])
            self.values_3.append(data[3])
            self.values_4.append(data[4])
            self.values_5.append(data[5])


            # draw the incoming data
            self.pw.clear()
            self.pw.plot(x=list(self.times)[-self.buffer:], y=list(self.values_1)[-self.buffer:],pen='r')
            self.pw.plot(x=list(self.times)[-self.buffer:], y=list(self.values_2)[-self.buffer:],pen='b')
            self.pw.plot(x=list(self.times)[-self.buffer:], y=list(self.values_3)[-self.buffer:],pen='y')
            self.pw.plot(x=list(self.times)[-self.buffer:], y=list(self.values_4)[-self.buffer:], pen='m')
            self.pw.plot(x=list(self.times)[-self.buffer:], y=list(self.values_5)[-self.buffer:], pen='w')

        self.timer.timeout.connect(update)
        # length between updates (in ms)
        self.timer.start(2)

        # gets the sensor's value

    def get_sensor_value(self):

        # get's the motor output values
        if self.motor_output_plot_graph_is_open is True:
            self.motor_1_output.setText(str(fc.motor_output[0]))
            self.motor_2_output.setText(str(fc.motor_output[1]))
            self.motor_3_output.setText(str(fc.motor_output[2]))
            self.motor_4_output.setText(str(fc.motor_output[3]))

        # determines the status of the pi connection
        if fc.pi_online:
            self.pi_connection_status.setStyleSheet("background-color: #507D2A")
            self.pi_connection_status.setText("Online")
            self.pi_connection_status_is_clicked = True
        elif not fc.pi_online and self.pi_connection_status_is_clicked:
            self.pi_connection_status.setStyleSheet("background-color: #922B3E")
            self.pi_connection_status.setText("Offline")
            self.pi_connection_status_is_clicked = False

        # gets the current PID
        self.curr_P.setText(str(fc.Kp))
        self.curr_I.setText(str(fc.Ki))
        self.curr_D.setText(str(fc.Kd))

    # creates labels for the flight motion patterns
    def create_flight_motion_labels(self):
        # Widget for the flight pattern buttons
        self.flight_pattern_widget = QWidget(self.flight_pattern_tab)
        self.flight_pattern_widget.resize(200,200)

        self.flight_motion_label = QLabel(self.flight_pattern_widget)
        self.flight_motion_label.setFrameShape(QFrame.StyledPanel)
        self.flight_motion_label.setFrameShadow(QFrame.Raised)
        self.flight_motion_label.move(2,20)
        self.flight_motion_label.setText("Flight Motion Pattern")

        self.square_pattern = QPushButton("Square", self.flight_pattern_widget)
        self.square_pattern.setIcon(QIcon('Images/Icons/square.png'))
        self.square_pattern.move(2,35)
        self.square_pattern.clicked.connect(self.do_square_pattern)
        self.square_pattern.setStyleSheet("background-color:#002366;")

    # conducts the square pattern
    def do_square_pattern(self):
        print("Completing Square Flight Motion Pattern...")
        print("[Currently Under Development]")

    # exits the application
    def exit_application(self):
        DroneGUI.close(self)

    # updates the flight timer
    def update_timer(self):
        self.time = self.time.addSecs(1)
        self.flight_time.setText(self.time.toString("mm:ss"))

    # sets the logos for ARC and raspberry pi
    def set_logo(self):
        self.arc_logo = QLabel(self)
        self.arc_logo.setPixmap(QPixmap('Images/CUARClogo.png'))
        self.arc_logo.move(l-600,0)

        self.pi_logo = QLabel(self)
        self.pi_logo.setPixmap(QPixmap('Images/Icons/raspberry_pi_logo.png'))
        self.pi_logo.move(87,105)

    # shows pop up for the hard wire connections
    def show_hard_wire_connections(self):
        self.window = QDialog(self.settings_tab)
        self.window.setWindowTitle("Settings")
        self.window.resize(145,405)
        self.window.move(l - 408, 247)
        self.window.show()

        self.gpio_label = QPushButton("GPIO Reference", self.window)
        self.gpio_label.setCheckable(False)
        self.gpio_label.setEnabled(False)
        self.gpio_label.move(24,1)
        self.gpio_label.show()
        self.gpio_label.setStyleSheet("background: #333332; color: white")

        self.motor_1_label_pic = QLabel(self.window)
        self.motor_1_label_pic.setPixmap((QPixmap('Images/Icons/gear.png')))
        self.motor_1_label_pic.move(1,28)
        self.motor_1_label_pic.show()
        self.motor_1_label = QLabel("Motor 1:", self.window)
        self.motor_1_label.move(18,30)
        self.motor_1_label.show()

        self.motor_1_gpio = QLineEdit(self.window)
        self.motor_1_gpio.setReadOnly(True)
        self.motor_1_gpio.move(90,28)
        self.motor_1_gpio.resize(30,12)
        self.motor_1_gpio.show()
        self.motor_1_gpio.setText(str(fc.motor.MOTOR1))

        self.motor_2_label_pic = QLabel(self.window)
        self.motor_2_label_pic.setPixmap((QPixmap('Images/Icons/gear.png')))
        self.motor_2_label_pic.move(1, 48)
        self.motor_2_label_pic.show()
        self.motor_2_label = QLabel("Motor 2:", self.window)
        self.motor_2_label.move(18, 50)
        self.motor_2_label.show()

        self.motor_2_gpio = QLineEdit(self.window)
        self.motor_2_gpio.setReadOnly(True)
        self.motor_2_gpio.move(90, 48)
        self.motor_2_gpio.resize(30, 12)
        self.motor_2_gpio.show()
        self.motor_2_gpio.setText(str(fc.motor.MOTOR2))

        self.motor_3_label_pic = QLabel(self.window)
        self.motor_3_label_pic.setPixmap((QPixmap('Images/Icons/gear.png')))
        self.motor_3_label_pic.move(1, 68)
        self.motor_3_label_pic.show()
        self.motor_3_label = QLabel("Motor 3:", self.window)
        self.motor_3_label.move(18, 70)
        self.motor_3_label.show()

        self.motor_3_gpio = QLineEdit(self.window)
        self.motor_3_gpio.setReadOnly(True)
        self.motor_3_gpio.move(90, 68)
        self.motor_3_gpio.resize(30, 12)
        self.motor_3_gpio.show()
        self.motor_3_gpio.setText(str(fc.motor.MOTOR3))

        self.motor_4_label_pic = QLabel(self.window)
        self.motor_4_label_pic.setPixmap((QPixmap('Images/Icons/gear.png')))
        self.motor_4_label_pic.move(1, 88)
        self.motor_4_label_pic.show()
        self.motor_4_label = QLabel("Motor 4:", self.window)
        self.motor_4_label.move(18, 90)
        self.motor_4_label.show()

        self.motor_4_gpio = QLineEdit(self.window)
        self.motor_4_gpio.setReadOnly(True)
        self.motor_4_gpio.move(90, 88)
        self.motor_4_gpio.resize(30, 12)
        self.motor_4_gpio.show()
        self.motor_4_gpio.setText(str(fc.motor.MOTOR4))

        self.receiver_1_label = QLabel("Receiver 1:", self.window)
        self.receiver_1_label.move(18, 110)
        self.receiver_1_label.show()
        self.receiver_1_label_pic = QLabel(self.window)
        self.receiver_1_label_pic.setPixmap((QPixmap("Images/Icons/receiver.png")))
        self.receiver_1_label_pic.move(1, 107)
        self.receiver_1_label_pic.show()

        self.receiver_1_gpio = QLineEdit(self.window)
        self.receiver_1_gpio.setReadOnly(True)
        self.receiver_1_gpio.move(90,108)
        self.receiver_1_gpio.resize(30,12)
        self.receiver_1_gpio.show()
        self.receiver_1_gpio.setText(str(fc.receiver.RECEIVER_CH1))

        self.receiver_2_label = QLabel("Receiver 2:", self.window)
        self.receiver_2_label.move(18, 130)
        self.receiver_2_label.show()
        self.receiver_2_label_pic = QLabel(self.window)
        self.receiver_2_label_pic.setPixmap((QPixmap("Images/Icons/receiver.png")))
        self.receiver_2_label_pic.move(1, 127)
        self.receiver_2_label_pic.show()

        self.receiver_2_gpio = QLineEdit(self.window)
        self.receiver_2_gpio.setReadOnly(True)
        self.receiver_2_gpio.move(90, 128)
        self.receiver_2_gpio.resize(30, 12)
        self.receiver_2_gpio.show()
        self.receiver_2_gpio.setText(str(fc.receiver.RECEIVER_CH2))

        self.receiver_3_label = QLabel("Receiver 3:", self.window)
        self.receiver_3_label.move(18, 150)
        self.receiver_3_label.show()
        self.receiver_3_label_pic = QLabel(self.window)
        self.receiver_3_label_pic.setPixmap((QPixmap("Images/Icons/receiver.png")))
        self.receiver_3_label_pic.move(1, 147)
        self.receiver_3_label_pic.show()

        self.receiver_3_gpio = QLineEdit(self.window)
        self.receiver_3_gpio.setReadOnly(True)
        self.receiver_3_gpio.move(90, 148)
        self.receiver_3_gpio.resize(30, 12)
        self.receiver_3_gpio.show()
        self.receiver_3_gpio.setText(str(fc.receiver.RECEIVER_CH3))

        self.receiver_4_label = QLabel("Receiver 4:", self.window)
        self.receiver_4_label.move(18, 170)
        self.receiver_4_label.show()
        self.receiver_4_label_pic = QLabel(self.window)
        self.receiver_4_label_pic.setPixmap((QPixmap("Images/Icons/receiver.png")))
        self.receiver_4_label_pic.move(1, 167)
        self.receiver_4_label_pic.show()

        self.receiver_4_gpio = QLineEdit(self.window)
        self.receiver_4_gpio.setReadOnly(True)
        self.receiver_4_gpio.move(90, 168)
        self.receiver_4_gpio.resize(30, 12)
        self.receiver_4_gpio.show()
        self.receiver_4_gpio.setText(str(fc.receiver.RECEIVER_CH4))

        self.receiver_5_label = QLabel("Receiver 5:", self.window)
        self.receiver_5_label.move(18, 190)
        self.receiver_5_label.show()
        self.receiver_5_label_pic = QLabel(self.window)
        self.receiver_5_label_pic.setPixmap((QPixmap("Images/Icons/receiver.png")))
        self.receiver_5_label_pic.move(1, 187)
        self.receiver_5_label_pic.show()

        self.receiver_5_gpio = QLineEdit(self.window)
        self.receiver_5_gpio.setReadOnly(True)
        self.receiver_5_gpio.move(90, 188)
        self.receiver_5_gpio.resize(30, 12)
        self.receiver_5_gpio.show()
        self.receiver_5_gpio.setText(str(fc.receiver.RECEIVER_CH5))

        self.gpio_label = QPushButton("PWM Frequency (Hz)", self.window)
        self.gpio_label.setCheckable(False)
        self.gpio_label.setEnabled(False)
        self.gpio_label.move(2, 210)
        self.gpio_label.show()
        self.gpio_label.setStyleSheet("background: #333332; color: white")

        self.hz_pic = QLabel(self.window)
        self.hz_pic.setPixmap(QPixmap("Images/Icons/freq.png"))
        self.hz_pic.move(70,234)
        self.hz_pic.show()
        self.hz_count = QLineEdit(self.window)
        self.hz_count.setReadOnly(True)
        self.hz_count.move(84, 235)
        self.hz_count.resize(40, 12)
        self.hz_count.show()
        self.hz_count.setText(str(fc.motor.PWM_frequency))

        self.gpio_label = QPushButton("MPU6050 Address", self.window)
        self.gpio_label.setCheckable(False)
        self.gpio_label.setEnabled(False)
        self.gpio_label.move(18, 350)
        self.gpio_label.show()
        self.gpio_label.setStyleSheet("background: #333332; color: white")

        self.imu_pic = QLabel(self.window)
        self.imu_pic.setPixmap(QPixmap("Images/Icons/imu.png"))
        self.imu_pic.move(81, 374)
        self.imu_pic.show()

        self.mpu_address = QLineEdit(self.window)
        self.mpu_address.setReadOnly(True)
        self.mpu_address.move(95, 374)
        self.mpu_address.resize(30, 12)
        self.mpu_address.show()
        self.mpu_address.setText(str(fc.imu.mpu6050_handle))

        # sample time
        self.sample_time_label = QPushButton("Sample Time (ms)", self.window)
        self.sample_time_label.setCheckable(False)
        self.sample_time_label.setEnabled(False)
        self.sample_time_label.move(20, 300)
        self.sample_time_label.show()
        self.sample_time = QLineEdit(self.window)
        self.sample_time.setReadOnly(True)
        self.sample_time.resize(50, 12)
        self.sample_time.move(75, 324)
        self.sample_time.show()
        self.sample_time.setText(str(fc.imu.sample_time))
        self.sample_time_label.setStyleSheet("background: #333332; color: white")
        self.sample_time_pic = QLabel(self.window)
        self.sample_time_pic.setPixmap(QPixmap("Images/Icons/clock.png"))
        self.sample_time_pic.move(58, 323)
        self.sample_time_pic.show()

        # PID input/output limitations
        self.io_lim_label = QPushButton("PID Output Limits", self.window)
        self.io_lim_label.setCheckable(False)
        self.io_lim_label.setEnabled(False)
        self.io_lim_label.move(23, 258)
        self.io_lim_label.show()

        self.io_lim_lower = QLineEdit(self.window)
        self.io_lim_lower.setReadOnly(True)
        self.io_lim_lower.resize(38,12)
        self.io_lim_lower.move(24, 282)
        self.io_lim_lower.show()
        self.io_lim_lower.setText(str(fc.imu.output_min))
        self.io_lim_pic_dwn = QLabel(self.window)
        self.io_lim_pic_dwn.setPixmap(QPixmap("Images/Icons/down_arrow.png"))
        self.io_lim_pic_dwn.move(9, 280)
        self.io_lim_pic_dwn.show()

        self.io_lim_hi = QLineEdit(self.window)
        self.io_lim_hi.setReadOnly(True)
        self.io_lim_hi.resize(38, 12)
        self.io_lim_hi.move(87, 282)
        self.io_lim_hi.show()
        self.io_lim_hi.setText(str(fc.imu.output_max))
        self.io_lim_pic_up = QLabel(self.window)
        self.io_lim_pic_up.setPixmap(QPixmap("Images/Icons/up_arrow.png"))
        self.io_lim_pic_up.move(72, 280)
        self.io_lim_pic_up.show()

    def show_about_info(self):
        self.about_websites = QWidget(self.about_tab)
        self.about_websites.move(10,10)
        self.about_arc_label = QPushButton("ARC", self.about_websites)
        self.about_arc_label.setCheckable(False)
        self.about_arc_label.setEnabled(False)
        self.about_arc_label.move(0, 10)
        self.about_arc_label.show()
        self.arc_website = QLabel(self.about_websites)
        self.arc_website.move(2,36)
        self.arc_website.setText('<a href="http://CUAerialRobotics.github.io/">Aerial Robotics Team</a>')
        self.arc_website.setOpenExternalLinks(True)
        self.arc_website.show()
        self.arc_img = QLabel(self.about_websites)
        self.arc_img.setPixmap(QPixmap('Images/CUARC_about_logo.png'))
        self.arc_img.move(130,0)
        self.arc_img.show()

        self.about_git_label = QPushButton("GitHub", self.about_websites)
        self.about_git_label.setCheckable(False)
        self.about_git_label.setEnabled(False)
        self.about_git_label.move(0, 100)
        self.about_git_label.show()
        self.arc_website_git = QLabel(self.about_websites)
        self.arc_website_git.move(2, 126)
        self.arc_website_git.setText(
            '<a href="https://github.com/CornellAerialRobotics/">GitHub</a>')
        self.arc_website_git.setOpenExternalLinks(True)
        self.arc_website_git.show()
        self.git_img = QLabel(self.about_websites)
        self.git_img.setPixmap(QPixmap('Images/GitHub_logo.png'))
        self.git_img.move(130, 82)
        self.git_img.show()

        self.about_comp_label = QPushButton("Competition", self.about_websites)
        self.about_comp_label.setCheckable(False)
        self.about_comp_label.setEnabled(False)
        self.about_comp_label.move(0, 180)
        self.about_comp_label.show()
        self.comp_website = QLabel(self.about_websites)
        self.comp_website.move(2, 204)
        self.comp_website.setText(
            '<a href="http://www.aerialroboticscompetition.org/">IARC</a>')
        self.comp_website.setOpenExternalLinks(True)
        self.comp_website.show()
        self.comp_website_rules = QLabel(self.about_websites)
        self.comp_website_rules.move(2, 224)
        self.comp_website_rules.setText(
            '<a href="http://www.aerialroboticscompetition.org/rules.php">Mission 8 Rules</a>')
        self.comp_website_rules.setOpenExternalLinks(True)
        self.comp_website_rules.show()
        self.iarc_img = QLabel(self.about_websites)
        self.iarc_img.setPixmap(QPixmap('Images/IARC_logo.png'))
        self.iarc_img.move(130, 174)
        self.iarc_img.show()

        self.about_school_label = QPushButton("School", self.about_websites)
        self.about_school_label.setCheckable(False)
        self.about_school_label.setEnabled(False)
        self.about_school_label.move(0, 274)
        self.about_school_label.show()
        self.school_website = QLabel(self.about_websites)
        self.school_website.move(2, 298)
        self.school_website.setText(
            '<a href="https://www.cornell.edu/">Cornell University</a>')
        self.school_website.setOpenExternalLinks(True)
        self.school_website.show()
        self.cu_img = QLabel(self.about_websites)
        self.cu_img.setPixmap(QPixmap('Images/CU_logo.png'))
        self.cu_img.move(130, 260)
        self.cu_img.show()
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(430, 486)
        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8("images/icon.ico")), QIcon.Normal, QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.formLayoutWidget_2 = QWidget(Dialog)
        self.formLayoutWidget_2.setGeometry(QRect(230, 80, 181, 131))
        self.formLayoutWidget_2.setObjectName(_fromUtf8("formLayoutWidget_2"))
        self.formLayout_2 = QFormLayout(self.formLayoutWidget_2)
        self.formLayout_2.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.label_5 = QLabel(self.formLayoutWidget_2)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label_5)
        self.ball_box = QComboBox(self.formLayoutWidget_2)
        self.ball_box.setObjectName(_fromUtf8("ball_box"))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.ball_box)
        self.label_6 = QLabel(self.formLayoutWidget_2)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_6)
        self.status_box = QComboBox(self.formLayoutWidget_2)
        self.status_box.setObjectName(_fromUtf8("status_box"))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.formLayout_2.setWidget(2, QFormLayout.FieldRole, self.status_box)
        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_2.setItem(1, QFormLayout.FieldRole, spacerItem)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_2.setItem(3, QFormLayout.FieldRole, spacerItem1)
        self.captured_edit = QLineEdit(self.formLayoutWidget_2)
        self.captured_edit.setObjectName(_fromUtf8("captured_edit"))
        self.formLayout_2.setWidget(4, QFormLayout.FieldRole, self.captured_edit)
        self.label = QLabel(self.formLayoutWidget_2)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout_2.setWidget(4, QFormLayout.LabelRole, self.label)
        self.formLayoutWidget_3 = QWidget(Dialog)
        self.formLayoutWidget_3.setGeometry(QRect(20, 80, 171, 131))
        self.formLayoutWidget_3.setObjectName(_fromUtf8("formLayoutWidget_3"))
        self.formLayout_3 = QFormLayout(self.formLayoutWidget_3)
        self.formLayout_3.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
        self.label_8 = QLabel(self.formLayoutWidget_3)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_8)
        self.pokemon_Name_box = QComboBox(self.formLayoutWidget_3)
        self.pokemon_Name_box.setObjectName(_fromUtf8("pokemon_Name_box"))
        self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.pokemon_Name_box)
        spacerItem2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_3.setItem(1, QFormLayout.FieldRole, spacerItem2)
        self.label_9 = QLabel(self.formLayoutWidget_3)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_9)
        self.level_edit = QLineEdit(self.formLayoutWidget_3)
        self.level_edit.setObjectName(_fromUtf8("level_edit"))
        self.formLayout_3.setWidget(2, QFormLayout.FieldRole, self.level_edit)
        self.label_10 = QLabel(self.formLayoutWidget_3)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.formLayout_3.setWidget(3, QFormLayout.LabelRole, self.label_10)
        self.hp_edit = QLineEdit(self.formLayoutWidget_3)
        self.hp_edit.setObjectName(_fromUtf8("hp_edit"))
        self.formLayout_3.setWidget(3, QFormLayout.FieldRole, self.hp_edit)
        self.spriteLabel = QLabel(self.formLayoutWidget_3)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.spriteLabel.sizePolicy().hasHeightForWidth())
        self.spriteLabel.setSizePolicy(sizePolicy)
        self.spriteLabel.setText(_fromUtf8(""))
        self.spriteLabel.setObjectName(_fromUtf8("spriteLabel"))
        self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.spriteLabel)
        self.textBrowser = QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QRect(20, 260, 391, 192))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        self.label_3 = QLabel(Dialog)
        self.label_3.setGeometry(QRect(335, 460, 71, 20))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.label_4 = QLabel(Dialog)
        self.label_4.setGeometry(QRect(20, 30, 251, 16))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.logolabel = QLabel(Dialog)
        self.logolabel.setGeometry(QRect(280, 20, 121, 51))
        self.logolabel.setText(_fromUtf8(""))
        self.logolabel.setObjectName(_fromUtf8("logolabel"))
        pixmap = QPixmap("images/logo.png")
        self.logolabel.setPixmap(pixmap)
        self.logolabel.setMask(pixmap.mask())
        self.calculateButton = QPushButton(Dialog)
        self.calculateButton.setGeometry(QRect(340, 230, 72, 23))
        self.calculateButton.setObjectName(_fromUtf8("calculateButton"))

        self.retranslateUi(Dialog)
        QMetaObject.connectSlotsByName(Dialog)
Exemple #34
0
    def _uic(self):
        # First set up the properties of "self", a QWidget.
        self.setObjectName("EditViewWidget")
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding,
                                 QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            False)  # don't care to bind height to width
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QSize(250, 250))
        self.setFocusPolicy(Qt.StrongFocus)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.setWindowTitle("")
        self.setToolTip("")
        self.setStatusTip("")
        self.setWhatsThis("")
        # Set up our primary widget, the editor
        self.Editor = PTEditor(self, self.my_book)
        self.Editor.setObjectName("Editor")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(2)  # Edit deserves all available space
        sizePolicy.setVerticalStretch(2)
        sizePolicy.setHeightForWidth(False)
        self.Editor.setSizePolicy(sizePolicy)
        self.Editor.setFocusPolicy(Qt.StrongFocus)
        self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
        self.Editor.setAcceptDrops(True)
        self.Editor.setLineWidth(2)
        self.Editor.setDocumentTitle("")
        self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)

        # Set up the frame that will contain the bottom row of widgets
        # It doesn't need a parent and doesn't need to be a class member
        # because it will be added to a layout, which parents it.
        bot_frame = QFrame()
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        bot_frame.setSizePolicy(sizePolicy)
        bot_frame.setMinimumSize(QSize(0, 24))
        bot_frame.setContextMenuPolicy(Qt.NoContextMenu)
        bot_frame.setFrameShape(QFrame.Panel)
        bot_frame.setFrameShadow(QFrame.Sunken)
        bot_frame.setLineWidth(3)

        # Set up the horizontal layout that will contain the following
        # objects. Its parent is the frame, which gives it a look?

        HBL = QHBoxLayout(bot_frame)
        HBL.setContentsMargins(4, 2, 4, 2)

        # Set up DocName, the document name widget. It is parented
        # to the bot_frame and positioned by the layout.

        self.DocName = QLabel(bot_frame)
        self.DocName.setText("")
        self.norm_style = 'color:Black;font-weight:normal;'
        self.mod_style = 'color:Red;font-weight:bold;'
        self.DocName.setStyleSheet(self.norm_style)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.DocName.setSizePolicy(sizePolicy)
        self.DocName.setMinimumSize(QSize(60, 12))
        self.DocName.setContextMenuPolicy(Qt.NoContextMenu)
        self.DocName.setFrameShape(QFrame.StyledPanel)
        self.DocName.setObjectName("DocName")
        self.DocName.setToolTip(
            _TR("EditViewWidget", "Document filename", "tool tip"))
        self.DocName.setWhatsThis(
            _TR(
                "EditViewWidget",
                "The filename of the document being edited. It changes color when the document has been modified."
            ))
        HBL.addWidget(self.DocName)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        HBL.addItem(spacerItem)

        # Set up the label "Folio:" and the Folio display label
        FolioLabel = QLabel(bot_frame)
        FolioLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                | Qt.AlignVCenter)
        FolioLabel.setText(
            _TR("EditViewWidget", "Folio", "label of folio display"))
        HBL.addWidget(FolioLabel)

        self.Folio = QLabel(bot_frame)
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding,
                                 QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.Folio.setSizePolicy(sizePolicy)
        self.Folio.setMinimumSize(QSize(30, 12))
        self.Folio.setContextMenuPolicy(Qt.NoContextMenu)
        self.Folio.setFrameShape(QFrame.StyledPanel)
        self.Folio.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                | Qt.AlignVCenter)
        self.Folio.setObjectName("Folio display")
        self.Folio.setToolTip(
            _TR("EditViewWidget", "Folio value for current page", "tooltip"))
        self.Folio.setStatusTip(
            _TR("EditViewWidget",
                "Folio value for the page under the edit cursor", "statustip"))
        self.Folio.setWhatsThis(
            _TR(
                "EditViewWidget",
                "The Folio (page number) value for the page under the edit cursor. Use the Pages panel to adjust folios to agree with the printed book.",
                "whats this"))
        HBL.addWidget(self.Folio)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        HBL.addItem(spacerItem)
        FolioLabel.setBuddy(self.Folio)

        # Set up the image filename lineedit and its buddy label.
        ImageFilenameLabel = QLabel(bot_frame)
        ImageFilenameLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                        | Qt.AlignVCenter)
        ImageFilenameLabel.setText(
            _TR("EditViewWidget", "Image", "Image field label"))
        HBL.addWidget(ImageFilenameLabel)
        self.ImageFilename = QLineEdit(bot_frame)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.ImageFilename.setSizePolicy(sizePolicy)
        self.ImageFilename.setMinimumSize(QSize(30, 12))
        self.ImageFilename.setMouseTracking(False)
        self.ImageFilename.setFocusPolicy(Qt.ClickFocus)
        self.ImageFilename.setContextMenuPolicy(Qt.NoContextMenu)
        self.ImageFilename.setAcceptDrops(True)
        self.ImageFilename.setInputMask("")
        self.ImageFilename.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                        | Qt.AlignVCenter)
        self.ImageFilename.setObjectName("ImageFilename")
        self.ImageFilename.setToolTip(
            _TR("EditViewWidget", "Scan image filename", "Image tooltip"))
        self.ImageFilename.setStatusTip(
            _TR("EditViewWidget",
                "Filename of the scan image under the edit cursor",
                "Image status tip"))
        self.ImageFilename.setWhatsThis(
            _TR(
                "EditViewWidget",
                "This is the name of the scanned image that produced the text under the edit cursor. This image file is displayed in the Image panel.",
                "Image whats this"))
        HBL.addWidget(self.ImageFilename)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        HBL.addItem(spacerItem)
        ImageFilenameLabel.setBuddy(self.ImageFilename)

        # Set up the line number lineedit and its buddy label.
        LineNumberLabel = QLabel(bot_frame)
        LineNumberLabel.setText(
            _TR("EditViewWidget", "Line#", "Line number label"))
        LineNumberLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                     | Qt.AlignVCenter)
        HBL.addWidget(LineNumberLabel)
        self.LineNumber = QLineEdit(bot_frame)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.LineNumber.setSizePolicy(sizePolicy)
        self.LineNumber.setMinimumSize(QSize(0, 12))
        self.LineNumber.setMouseTracking(False)
        self.LineNumber.setFocusPolicy(Qt.ClickFocus)
        self.LineNumber.setContextMenuPolicy(Qt.NoContextMenu)
        self.LineNumber.setAcceptDrops(True)
        self.LineNumber.setLayoutDirection(Qt.LeftToRight)
        self.LineNumber.setCursorPosition(0)
        self.LineNumber.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                     | Qt.AlignVCenter)
        self.LineNumber.setPlaceholderText("")
        self.LineNumber.setCursorMoveStyle(Qt.LogicalMoveStyle)
        self.LineNumber.setObjectName("LineNumber")
        self.LineNumber.setToolTip(
            _TR("EditViewWidget", "Line number at cursor",
                "Line number tooltip"))
        self.LineNumber.setStatusTip(
            _TR("EditViewWidget",
                "Line number under cursor or top of current selection",
                "Line number statustip"))
        self.LineNumber.setWhatsThis(
            _TR(
                "EditViewWidget",
                "The line number in the document where the edit cursor is, or the top line of the selection. Enter a new number to jump to that line.",
                "Line number whatsthis"))
        ImageFilenameLabel.setBuddy(self.ImageFilename)
        HBL.addWidget(self.LineNumber)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        HBL.addItem(spacerItem)

        # Set up the column number field and its buddy label.
        ColNumberLabel = QLabel(bot_frame)
        ColNumberLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                    | Qt.AlignVCenter)
        ColNumberLabel.setText(
            _TR("EditViewWidget", "Col#", "Col number label"))
        HBL.addWidget(ColNumberLabel)
        self.ColNumber = QLabel(bot_frame)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.ColNumber.setSizePolicy(sizePolicy)
        self.ColNumber.setMinimumSize(QSize(30, 12))
        self.ColNumber.setContextMenuPolicy(Qt.NoContextMenu)
        self.ColNumber.setFrameShape(QFrame.StyledPanel)
        self.ColNumber.setFrameShadow(QFrame.Plain)
        self.ColNumber.setLineWidth(1)
        self.ColNumber.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                    | Qt.AlignVCenter)
        self.ColNumber.setObjectName("ColNumber")
        self.ColNumber.setToolTip(
            _TR("EditViewWidget", "Cursor column number", "tool tip"))
        self.ColNumber.setStatusTip(
            _TR("EditViewWidget", "Cursor column number", "status tip"))
        self.ColNumber.setWhatsThis(
            _TR(
                "EditViewWidget",
                "The column number position of the cursor in the current line.",
                "whatsthis"))
        HBL.addWidget(self.ColNumber)

        # Set up a vertical layout and put two items in it, the editor and HBL
        VBL = QVBoxLayout()
        VBL.setContentsMargins(8, 8, 8, 8)
        VBL.addWidget(self.Editor)
        VBL.addWidget(bot_frame)
        self.setLayout(VBL)
Exemple #35
0
 def _setupUi(self):
     self.setWindowTitle(tr("CSV Options"))
     self.resize(526, 369)
     self.verticalLayout = QVBoxLayout(self)
     msg = tr(
         "Specify which CSV columns correspond to which transaction fields. You must also "
         "uncheck the \"Import\" column for lines that don\'t represent a transaction "
         "(header, footer, comments).")
     self.label = QLabel(msg)
     self.label.setWordWrap(True)
     self.verticalLayout.addWidget(self.label)
     self.gridLayout = QGridLayout()
     self.label_2 = QLabel(tr("Layout:"))
     self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
     self.layoutComboBox = QComboBox(self)
     self.layoutComboBox.setMinimumSize(QtCore.QSize(160, 0))
     self.gridLayout.addWidget(self.layoutComboBox, 0, 1, 1, 1)
     self.label_4 = QLabel(tr("Delimiter:"))
     self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1)
     self.fieldSeparatorEdit = QLineEdit(self)
     self.fieldSeparatorEdit.setMaximumSize(QtCore.QSize(30, 16777215))
     self.gridLayout.addWidget(self.fieldSeparatorEdit, 0, 4, 1, 1)
     self.targetComboBox = QComboBox(self)
     self.gridLayout.addWidget(self.targetComboBox, 1, 1, 1, 1)
     self.label_3 = QLabel(tr("Target:"))
     self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1)
     self.encodingComboBox = QComboBox(self)
     self.gridLayout.addWidget(self.encodingComboBox, 1, 4, 1, 1)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
     self.gridLayout.addItem(spacerItem, 2, 2, 1, 1)
     self.horizontalLayout_2 = QHBoxLayout()
     self.horizontalLayout_2.setSpacing(0)
     spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                               QSizePolicy.Minimum)
     self.horizontalLayout_2.addItem(spacerItem1)
     self.rescanButton = QPushButton(tr("Rescan"))
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(
         self.rescanButton.sizePolicy().hasHeightForWidth())
     self.rescanButton.setSizePolicy(sizePolicy)
     self.horizontalLayout_2.addWidget(self.rescanButton)
     self.gridLayout.addLayout(self.horizontalLayout_2, 2, 3, 1, 2)
     self.label_5 = QLabel(tr("Encoding:"))
     self.gridLayout.addWidget(self.label_5, 1, 3, 1, 1)
     self.verticalLayout.addLayout(self.gridLayout)
     self.tableView = QTableView(self)
     self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setShowGrid(False)
     self.tableView.horizontalHeader().setHighlightSections(False)
     self.tableView.verticalHeader().setVisible(False)
     self.tableView.verticalHeader().setDefaultSectionSize(18)
     self.verticalLayout.addWidget(self.tableView)
     self.horizontalLayout = QHBoxLayout()
     spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                               QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem2)
     self.cancelButton = QPushButton(tr("Cancel"))
     self.cancelButton.setShortcut("Esc")
     self.horizontalLayout.addWidget(self.cancelButton)
     self.continueButton = QPushButton(tr("Continue Import"))
     self.continueButton.setDefault(True)
     self.horizontalLayout.addWidget(self.continueButton)
     self.verticalLayout.addLayout(self.horizontalLayout)
Exemple #36
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        super(PreviewerHTML, self).__init__(parent)
        
        self.__layout = QVBoxLayout(self)
        
        self.titleLabel = QLabel(self)
        self.titleLabel.setWordWrap(True)
        self.titleLabel.setTextInteractionFlags(Qt.NoTextInteraction)
        self.__layout.addWidget(self.titleLabel)
        
        self.__previewAvailable = True
        
        try:
            from PyQt5.QtWebEngineWidgets import QWebEngineView
            self.previewView = QWebEngineView(self)
            self.previewView.page().linkHovered.connect(self.__showLink)
        except ImportError:
            self.__previewAvailable = False
            self.titleLabel.setText(self.tr(
                "<b>HTML Preview is not available!<br/>"
                "Install QtWebEngine.</b>"))
            self.titleLabel.setAlignment(Qt.AlignHCenter)
            self.__layout.addStretch()
            return
        
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.previewView.sizePolicy().hasHeightForWidth())
        self.previewView.setSizePolicy(sizePolicy)
        self.previewView.setContextMenuPolicy(Qt.NoContextMenu)
        self.previewView.setUrl(QUrl("about:blank"))
        self.__layout.addWidget(self.previewView)
        
        self.jsCheckBox = QCheckBox(self.tr("Enable JavaScript"), self)
        self.jsCheckBox.setToolTip(self.tr(
            "Select to enable JavaScript for HTML previews"))
        self.__layout.addWidget(self.jsCheckBox)
        
        self.ssiCheckBox = QCheckBox(self.tr("Enable Server Side Includes"),
                                     self)
        self.ssiCheckBox.setToolTip(self.tr(
            "Select to enable support for Server Side Includes"))
        self.__layout.addWidget(self.ssiCheckBox)
        
        self.jsCheckBox.clicked[bool].connect(self.on_jsCheckBox_clicked)
        self.ssiCheckBox.clicked[bool].connect(self.on_ssiCheckBox_clicked)
        self.previewView.titleChanged.connect(self.on_previewView_titleChanged)
        
        self.jsCheckBox.setChecked(
            Preferences.getUI("ShowFilePreviewJS"))
        self.ssiCheckBox.setChecked(
            Preferences.getUI("ShowFilePreviewSSI"))
        
        self.__scrollBarPositions = {}
        self.__vScrollBarAtEnd = {}
        self.__hScrollBarAtEnd = {}
        
        self.__processingThread = PreviewProcessingThread()
        self.__processingThread.htmlReady.connect(self.__setHtml)

        self.__previewedPath = None
        self.__previewedEditor = None
Exemple #37
0
    def _createUi_input_box(self) -> QGroupBox:
        input_box = QGroupBox(self)
        box_size_policy = QSizePolicy(QSizePolicy.Preferred,
                                      QSizePolicy.Preferred)
        box_size_policy.setHorizontalStretch(0)
        box_size_policy.setVerticalStretch(0)
        box_size_policy.setHeightForWidth(
            input_box.sizePolicy().hasHeightForWidth()
        )
        input_box.setSizePolicy(box_size_policy)
        input_box.setTitle("")
        input_box.setMinimumSize(QSize(250, 300))
        input_box.setMaximumSize(QSize(250, 300))

        font = QFont()
        font.setBold(True)

        label1 = QLabel("Plot definition", self)
        label1.setFont(font)

        line1 = QFrame(input_box)
        line1.setFrameShape(QFrame.HLine)
        line1.setFrameShadow(QFrame.Sunken)

        label2 = QLabel("Min ΔT:", self)
        label3 = QLabel("Max ΔT:", self)
        label4 = QLabel("# of points:", self)
        label5 = QLabel("Exchanger type:", self)
        label6 = QLabel("Tube Arrangement:", self)
        label7 = QLabel("Shell side material:", self)
        label8 = QLabel("Tube side material:", self)
        label9 = QLabel("Operating pressure:", self)

        min_dt_edit = QLineEdit(self)
        max_dt_edit = QLineEdit(self)
        num_pt_edit = QLineEdit(self)
        ex_typ_cbb = QComboBox(self)
        arrang_cbb = QComboBox(self)
        shell_cbb = QComboBox(self)
        tube_cbb = QComboBox(self)
        press_edit = QLineEdit(self)

        min_dt_edit.setText('5')
        max_dt_edit.setText('30')
        num_pt_edit.setText('10')
        press_edit.setText('1')

        min_dt_edit.setAlignment(Qt.AlignCenter)
        max_dt_edit.setAlignment(Qt.AlignCenter)
        num_pt_edit.setAlignment(Qt.AlignCenter)
        press_edit.setAlignment(Qt.AlignCenter)

        ex_list = ExchangerType.values_list()
        ex_typ_cbb.addItems(ex_list)
        ex_typ_cbb.currentTextChanged.connect(self._update_arrangment)
        ex_typ_cbb.currentTextChanged.connect(self._update_shell_materials)
        
        shell_cbb.currentTextChanged.connect(self._update_tube_materials)

        self._ex_typ_cbb = ex_typ_cbb
        self._arrang_cbb = arrang_cbb
        self._shell_cbb = shell_cbb
        self._tube_cbb = tube_cbb

        ex_typ_cbb.setCurrentIndex(
            ex_list.index(ExchangerType.FLOATING_HEAD.value)
        )

        self._min_dt_edit = min_dt_edit
        self._max_dt_edit = max_dt_edit
        self._num_pt_edit = num_pt_edit
        self._press_edit = press_edit

        spacer = QSpacerItem(20, 40,
                             QSizePolicy.Minimum, QSizePolicy.Expanding)

        form_layout = QFormLayout()
        form_layout.setLabelAlignment(Qt.AlignRight)
        form_layout.setWidget(0, QFormLayout.LabelRole, label2)
        form_layout.setWidget(1, QFormLayout.LabelRole, label3)
        form_layout.setWidget(2, QFormLayout.LabelRole, label4)
        form_layout.setWidget(3, QFormLayout.LabelRole, label5)
        form_layout.setWidget(4, QFormLayout.LabelRole, label6)
        form_layout.setWidget(5, QFormLayout.LabelRole, label7)
        form_layout.setWidget(6, QFormLayout.LabelRole, label8)
        form_layout.setWidget(7, QFormLayout.LabelRole, label9)

        form_layout.setWidget(0, QFormLayout.FieldRole, min_dt_edit)
        form_layout.setWidget(1, QFormLayout.FieldRole, max_dt_edit)
        form_layout.setWidget(2, QFormLayout.FieldRole, num_pt_edit)
        form_layout.setWidget(3, QFormLayout.FieldRole, ex_typ_cbb)
        form_layout.setWidget(4, QFormLayout.FieldRole, arrang_cbb)
        form_layout.setWidget(5, QFormLayout.FieldRole, shell_cbb)
        form_layout.setWidget(6, QFormLayout.FieldRole, tube_cbb)
        form_layout.setWidget(7, QFormLayout.FieldRole, press_edit)

        pushbutton = QPushButton('Plot data', self)
        pushbutton.clicked.connect(self._plot_graph)

        layout = QGridLayout(input_box)
        layout.addWidget(label1, 0, 0, 1, 1)
        layout.addWidget(line1, 1, 0, 1, 1)
        layout.addLayout(form_layout, 2, 0, 1, 1)
        layout.addWidget(pushbutton, 3, 0, 1, 1)
        layout.addItem(spacer, 4, 0, 1, 1)

        return input_box
    def setupUi(self) -> None:
        """

        :return:
        """
        # Generated Setup Code
        self.setObjectName("StockAnalysisTool_Ui")
        self.central_widget = QWidget(self)
        self.central_widget.setObjectName("central_widget")
        self.central_layout = QVBoxLayout(self.central_widget)
        self.central_layout.setObjectName("central_layout")
        self.title_label = QLabel(self.central_widget)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.title_label.sizePolicy().hasHeightForWidth())
        self.title_label.setSizePolicy(sizePolicy)
        font = QFont()
        font.setFamily("Garamond")
        font.setPointSize(22)
        font.setBold(True)
        font.setWeight(75)
        self.title_label.setFont(font)
        self.title_label.setAlignment(Qt.AlignCenter)
        self.title_label.setObjectName("title_label")
        self.central_layout.addWidget(self.title_label)
        self.title_h_divider = QFrame(self.central_widget)
        self.title_h_divider.setFrameShape(QFrame.HLine)
        self.title_h_divider.setFrameShadow(QFrame.Sunken)
        self.title_h_divider.setObjectName("title_h_divider")
        self.central_layout.addWidget(self.title_h_divider)
        self.display_layout = QHBoxLayout()
        self.display_layout.setObjectName("display_layout")
        self.graph_layout = QVBoxLayout()
        self.graph_layout.setObjectName("graph_layout")
        self.date_axis = pg.DateAxisItem(orientation='bottom')
        self.graph = pg.PlotWidget(axisItems={'bottom': self.date_axis})
        self.graph_legend = self.graph.addLegend()
        self.graph_layout.addWidget(self.graph)
        self.data_selection_layout = QGridLayout()
        self.open_data_cb = QCheckBox(self.central_widget)
        self.open_data_cb.setObjectName("open")
        self.data_selection_layout.addWidget(self.open_data_cb, 0, 0, 1, 1)
        self.high_data_cb = QCheckBox(self.central_widget)
        self.high_data_cb.setObjectName("high")
        self.data_selection_layout.addWidget(self.high_data_cb, 0, 1, 1, 1)
        self.low_data_cb = QCheckBox(self.central_widget)
        self.low_data_cb.setObjectName("low")
        self.data_selection_layout.addWidget(self.low_data_cb, 0, 2, 1, 1)
        self.close_data_cb = QCheckBox(self.central_widget)
        self.close_data_cb.setObjectName("close")
        self.data_selection_layout.addWidget(self.close_data_cb, 0, 3, 1, 1)
        self.adjclose_data_cb = QCheckBox(self.central_widget)
        self.adjclose_data_cb.setObjectName("adjclose")
        self.data_selection_layout.addWidget(self.adjclose_data_cb, 0, 4, 1, 1)
        self.volume_data_cb = QCheckBox(self.central_widget)
        self.volume_data_cb.setObjectName("volume")
        self.data_selection_layout.addWidget(self.volume_data_cb, 0, 5, 1, 1)
        self.graph_layout.addLayout(self.data_selection_layout)
        self.save_fig_btn = QPushButton(self.central_widget)
        self.save_fig_btn.setObjectName("save_fig_btn")
        self.graph_layout.addWidget(self.save_fig_btn)
        self.graph_options_layout = QGridLayout()
        self.sample_rate_label = QLabel(self.central_widget)
        self.sample_rate_label.setText("Sample Rate:")
        self.graph_options_layout.addWidget(self.sample_rate_label, 0, 0, 1, 1)
        self.sample_rate_combo = QComboBox(self.central_widget)
        self.sample_rate_combo.addItems(self.sample_rates)
        self.graph_options_layout.addWidget(self.sample_rate_combo, 0, 1, 1, 1)
        self.time_delta_label = QLabel(self.central_widget)
        self.time_delta_label.setText("Time delta:")
        self.graph_options_layout.addWidget(self.time_delta_label, 0, 2, 1, 1)
        self.time_delta_combo = QComboBox(self.central_widget)
        self.time_delta_combo.addItems(self.time_deltas)
        self.graph_options_layout.addWidget(self.time_delta_combo, 0, 3, 1, 1)
        self.graph_layout.addLayout(self.graph_options_layout)
        self.display_layout.addLayout(self.graph_layout)
        self.main_v_divider = QFrame(self.central_widget)
        self.main_v_divider.setFrameShape(QFrame.VLine)
        self.main_v_divider.setFrameShadow(QFrame.Sunken)
        self.main_v_divider.setObjectName("main_v_divider")
        self.display_layout.addWidget(self.main_v_divider)

        self.options_layout = QVBoxLayout()
        self.options_layout.setObjectName("options_layout")

        robinhood_account_layout = QHBoxLayout()
        robinhood_account_name_label = QLabel(self.central_widget)
        robinhood_account_name_label.setText("Robinhood Account:")
        self.robinhood_account_name_textedit = QTextEdit()
        robinhood_account_layout.addWidget(robinhood_account_name_label)
        robinhood_account_layout.addWidget(
            self.robinhood_account_name_textedit)
        self.options_layout.addLayout(robinhood_account_layout)
        robinhood_password_layout = QHBoxLayout()
        robinhood_account_password_label = QLabel(self.central_widget)
        robinhood_account_password_label.setText("Robinhood Password:"******"robinhood_login_button")
        self.options_layout.addWidget(self.robinhood_login_button)

        self.top_h_divider = QFrame(self.central_widget)
        self.top_h_divider.setFrameShape(QFrame.HLine)
        self.top_h_divider.setFrameShadow(QFrame.Sunken)
        self.top_h_divider.setObjectName("top_h_divider")
        self.options_layout.addWidget(self.top_h_divider)

        self.source_selection_layout = QHBoxLayout()
        self.source_selection_layout.setObjectName("source_selection_layout")
        self.source_label = QLabel(self.central_widget)
        self.source_label.setObjectName("source_label")
        self.source_selection_layout.addWidget(self.source_label)
        self.source_combo = QComboBox(self.central_widget)
        self.source_combo.setObjectName("source_combo")
        self.source_combo.addItem("")
        self.source_combo.addItem("")
        self.source_combo.addItem("")
        self.source_selection_layout.addWidget(self.source_combo)
        self.options_layout.addLayout(self.source_selection_layout)
        self.stock_selection_layout = QHBoxLayout()
        self.stock_selection_layout.setObjectName("stock_selection_layout")
        self.stock_label = QLabel(self.central_widget)
        self.stock_label.setObjectName("stock_label")
        self.stock_selection_layout.addWidget(self.stock_label)
        self.stock_combo = QComboBox(self.central_widget)
        self.stock_combo.setObjectName("stock_combo")
        self.stock_combo.addItems(self.valid_stock_tickers)
        self.stock_selection_layout.addWidget(self.stock_combo)
        self.options_layout.addLayout(self.stock_selection_layout)

        self.second_from_top_h_divider = QFrame(self.central_widget)
        self.second_from_top_h_divider.setFrameShape(QFrame.HLine)
        self.second_from_top_h_divider.setFrameShadow(QFrame.Sunken)
        self.second_from_top_h_divider.setObjectName(
            "second_from_top_h_divider")
        self.options_layout.addWidget(self.second_from_top_h_divider)

        self.momentum_indicator_label = QLabel(self.central_widget)
        self.momentum_indicator_label.setObjectName("momentum_indicator_label")
        self.options_layout.addWidget(self.momentum_indicator_label)
        # Momentum Indicators
        self.momentum_indicator_layout = QGridLayout()
        self.rsi_cb = QCheckBox(self.central_widget)
        self.rsi_cb.setObjectName("rsi_cb")
        self.momentum_indicator_layout.addWidget(self.rsi_cb, 0, 0, 1, 1)
        self.rsi_time_frame_label = QLabel(self.central_widget)
        self.rsi_time_frame_label.setText("Time frame:")
        self.momentum_indicator_layout.addWidget(self.rsi_time_frame_label, 0,
                                                 1, 1, 1)
        self.rsi_time_frame_text = QTextEdit(self.central_widget)
        font_metric = QFontMetrics(self.rsi_time_frame_text.font())
        self.rsi_time_frame_text.setFixedHeight(font_metric.lineSpacing())
        self.rsi_time_frame_text.setFixedWidth(50)
        self.rsi_time_frame_text.setText(str(self.rsi_n))
        self.momentum_indicator_layout.addWidget(self.rsi_time_frame_text, 0,
                                                 2, 1, 1)
        self.williams_r_cb = QCheckBox(self.central_widget)
        self.williams_r_cb.setObjectName("williams_r_cb")
        self.momentum_indicator_layout.addWidget(self.williams_r_cb, 1, 0, 1,
                                                 1)
        self.cmo_cb = QCheckBox(self.central_widget)
        self.cmo_cb.setObjectName("cmo_cb")
        self.momentum_indicator_layout.addWidget(self.cmo_cb, 2, 0, 1, 1)
        self.macd_cb = QCheckBox(self.central_widget)
        self.macd_cb.setObjectName("macd_cb")
        self.momentum_indicator_layout.addWidget(self.macd_cb, 3, 0, 1, 1)
        self.roc_cb = QCheckBox(self.central_widget)
        self.roc_cb.setObjectName("roc_cb")
        self.momentum_indicator_layout.addWidget(self.roc_cb, 4, 0, 1, 1)
        self.middle_h_divider = QFrame(self.central_widget)
        self.middle_h_divider.setFrameShape(QFrame.HLine)
        self.middle_h_divider.setFrameShadow(QFrame.Sunken)
        self.middle_h_divider.setObjectName("middle_h_divider")
        self.options_layout.addLayout(self.momentum_indicator_layout)
        self.options_layout.addWidget(self.middle_h_divider)

        # Averages Indicators
        self.averages_label = QLabel(self.central_widget)
        self.averages_label.setObjectName("averages_label")
        self.options_layout.addWidget(self.averages_label)
        self.wma_cb = QCheckBox(self.central_widget)
        self.wma_cb.setObjectName("wma_cb")
        self.options_layout.addWidget(self.wma_cb)
        self.ema_cb = QCheckBox(self.central_widget)
        self.ema_cb.setObjectName("ema_cb")
        self.options_layout.addWidget(self.ema_cb)
        self.sma_cb = QCheckBox(self.central_widget)
        self.sma_cb.setObjectName("sma_cb")
        self.options_layout.addWidget(self.sma_cb)
        self.hma_cb = QCheckBox(self.central_widget)
        self.hma_cb.setObjectName("hma_cb")
        self.options_layout.addWidget(self.hma_cb)
        self.trix_cb = QCheckBox(self.central_widget)
        self.trix_cb.setObjectName("trix_cb")
        self.options_layout.addWidget(self.trix_cb)
        self.bottom_h_divider = QFrame(self.central_widget)
        self.bottom_h_divider.setFrameShape(QFrame.HLine)
        self.bottom_h_divider.setFrameShadow(QFrame.Sunken)
        self.bottom_h_divider.setObjectName("bottom_h_divider")
        self.options_layout.addWidget(self.bottom_h_divider)

        # Trend Indicators
        self.trend_indicators_label = QLabel(self.central_widget)
        self.trend_indicators_label.setObjectName("trend_indicators_label")
        self.options_layout.addWidget(self.trend_indicators_label)
        self.cci_cb = QCheckBox(self.central_widget)
        self.cci_cb.setObjectName("cci_cb")
        self.options_layout.addWidget(self.cci_cb)
        self.dpo_cb = QCheckBox(self.central_widget)
        self.dpo_cb.setObjectName("dpo_cb")
        self.options_layout.addWidget(self.dpo_cb)
        self.cmf_cb = QCheckBox(self.central_widget)
        self.cmf_cb.setObjectName("cmf_cb")
        self.options_layout.addWidget(self.cmf_cb)
        self.adx_cb = QCheckBox(self.central_widget)
        self.adx_cb.setObjectName("adx_cb")
        self.options_layout.addWidget(self.adx_cb)
        self.force_index_cb = QCheckBox(self.central_widget)
        self.force_index_cb.setObjectName("checkBox_14")
        self.options_layout.addWidget(self.force_index_cb)
        self.display_layout.addLayout(self.options_layout)
        self.central_layout.addLayout(self.display_layout)
        self.setCentralWidget(self.central_widget)
        self.statusbar = QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        self.retranslateUi()
        self.setCallbacks()
        QMetaObject.connectSlotsByName(self)
Exemple #39
0
 def __init__(self):
     super().__init__()
     policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     policy.setHeightForWidth(True)
     self.setSizePolicy(policy)
Exemple #40
0
    def _uic(self):
        # First set up the properties of "self", a QWidget.
        self.setObjectName("EditViewWidget")
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(False) # don't care to bind height to width
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QSize(250, 250))
        self.setFocusPolicy(Qt.StrongFocus)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.setWindowTitle("")
        self.setToolTip("")
        self.setStatusTip("")
        self.setWhatsThis("")
        # Set up our primary widget, the editor
        self.Editor = PTEditor(self,self.my_book)
        self.Editor.setObjectName("Editor")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(2) # Edit deserves all available space
        sizePolicy.setVerticalStretch(2)
        sizePolicy.setHeightForWidth(False)
        self.Editor.setSizePolicy(sizePolicy)
        self.Editor.setFocusPolicy(Qt.StrongFocus)
        self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
        self.Editor.setAcceptDrops(True)
        self.Editor.setLineWidth(2)
        self.Editor.setDocumentTitle("")
        self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)

        # Set up the frame that will contain the bottom row of widgets
        # It doesn't need a parent and doesn't need to be a class member
        # because it will be added to a layout, which parents it.
        bot_frame = QFrame()
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        bot_frame.setSizePolicy(sizePolicy)
        bot_frame.setMinimumSize(QSize(0, 24))
        bot_frame.setContextMenuPolicy(Qt.NoContextMenu)
        bot_frame.setFrameShape(QFrame.Panel)
        bot_frame.setFrameShadow(QFrame.Sunken)
        bot_frame.setLineWidth(3)

        # Set up the horizontal layout that will contain the following
        # objects. Its parent is the frame, which gives it a look?

        HBL = QHBoxLayout(bot_frame)
        HBL.setContentsMargins(4,2,4,2)

        # Set up DocName, the document name widget. It is parented
        # to the bot_frame and positioned by the layout.

        self.DocName = QLabel(bot_frame)
        self.DocName.setText("")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.DocName.setSizePolicy(sizePolicy)
        self.DocName.setMinimumSize(QSize(60, 12))
        self.DocName.setContextMenuPolicy(Qt.NoContextMenu)
        self.DocName.setFrameShape(QFrame.StyledPanel)
        self.DocName.setObjectName("DocName")
        self.DocName.setToolTip(_TR("EditViewWidget", "Document filename", "tool tip"))
        self.DocName.setWhatsThis(_TR("EditViewWidget", "The filename of the document being edited. It changes color when the document has been modified."))
        HBL.addWidget(self.DocName)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
        HBL.addItem(spacerItem)

        # Set up the label "Folio:" and the Folio display label
        FolioLabel = QLabel(bot_frame)
        FolioLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        FolioLabel.setText(_TR("EditViewWidget", "Folio", "label of folio display"))
        HBL.addWidget(FolioLabel)

        self.Folio = QLabel(bot_frame)
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.Folio.setSizePolicy(sizePolicy)
        self.Folio.setMinimumSize(QSize(30, 12))
        self.Folio.setContextMenuPolicy(Qt.NoContextMenu)
        self.Folio.setFrameShape(QFrame.StyledPanel)
        self.Folio.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        self.Folio.setObjectName("Folio display")
        self.Folio.setToolTip(_TR("EditViewWidget", "Folio value for current page", "tooltip"))
        self.Folio.setStatusTip(_TR("EditViewWidget", "Folio value for the page under the edit cursor", "statustip"))
        self.Folio.setWhatsThis(_TR("EditViewWidget", "The Folio (page number) value for the page under the edit cursor. Use the Pages panel to adjust folios to agree with the printed book.","whats this"))
        HBL.addWidget(self.Folio)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
        HBL.addItem(spacerItem)
        FolioLabel.setBuddy(self.Folio)

        # Set up the image filename lineedit and its buddy label.
        ImageFilenameLabel = QLabel(bot_frame)
        ImageFilenameLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        ImageFilenameLabel.setText(_TR("EditViewWidget", "Image", "Image field label"))
        HBL.addWidget(ImageFilenameLabel)
        self.ImageFilename = QLineEdit(bot_frame)
        sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.ImageFilename.setSizePolicy(sizePolicy)
        self.ImageFilename.setMinimumSize(QSize(30, 12))
        self.ImageFilename.setMouseTracking(False)
        self.ImageFilename.setFocusPolicy(Qt.ClickFocus)
        self.ImageFilename.setContextMenuPolicy(Qt.NoContextMenu)
        self.ImageFilename.setAcceptDrops(True)
        self.ImageFilename.setInputMask("")
        self.ImageFilename.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        self.ImageFilename.setObjectName("ImageFilename")
        self.ImageFilename.setToolTip(_TR("EditViewWidget", "Scan image filename", "Image tooltip"))
        self.ImageFilename.setStatusTip(_TR("EditViewWidget", "Filename of the scan image under the edit cursor", "Image status tip"))
        self.ImageFilename.setWhatsThis(_TR("EditViewWidget", "This is the name of the scanned image that produced the text under the edit cursor. This image file is displayed in the Image panel.","Image whats this"))
        HBL.addWidget(self.ImageFilename)
        spacerItem =  QSpacerItem(0, 0,  QSizePolicy.Expanding,  QSizePolicy.Minimum)
        HBL.addItem(spacerItem)
        ImageFilenameLabel.setBuddy(self.ImageFilename)

        # Set up the line number lineedit and its buddy label.
        LineNumberLabel = QLabel(bot_frame)
        LineNumberLabel.setText(_TR("EditViewWidget", "Line#", "Line number label"))
        LineNumberLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        HBL.addWidget(LineNumberLabel)
        self.LineNumber = QLineEdit(bot_frame)
        sizePolicy = QSizePolicy( QSizePolicy.Expanding,  QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.LineNumber.setSizePolicy(sizePolicy)
        self.LineNumber.setMinimumSize(QSize(0, 12))
        self.LineNumber.setMouseTracking(False)
        self.LineNumber.setFocusPolicy(Qt.ClickFocus)
        self.LineNumber.setContextMenuPolicy(Qt.NoContextMenu)
        self.LineNumber.setAcceptDrops(True)
        self.LineNumber.setLayoutDirection(Qt.LeftToRight)
        self.LineNumber.setCursorPosition(0)
        self.LineNumber.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        self.LineNumber.setPlaceholderText("")
        self.LineNumber.setCursorMoveStyle(Qt.LogicalMoveStyle)
        self.LineNumber.setObjectName("LineNumber")
        self.LineNumber.setToolTip(_TR("EditViewWidget", "Line number at cursor", "Line number tooltip"))
        self.LineNumber.setStatusTip(_TR("EditViewWidget", "Line number under cursor or top of current selection","Line number statustip"))
        self.LineNumber.setWhatsThis(_TR("EditViewWidget", "The line number in the document where the edit cursor is, or the top line of the selection. Enter a new number to jump to that line.","Line number whatsthis"))
        ImageFilenameLabel.setBuddy(self.ImageFilename)
        HBL.addWidget(self.LineNumber)
        spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
        HBL.addItem(spacerItem)

        # Set up the column number field and its buddy label.
        ColNumberLabel = QLabel(bot_frame)
        ColNumberLabel.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        ColNumberLabel.setText(_TR("EditViewWidget", "Col#", "Col number label"))
        HBL.addWidget(ColNumberLabel)
        self.ColNumber = QLabel(bot_frame)
        sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        self.ColNumber.setSizePolicy(sizePolicy)
        self.ColNumber.setMinimumSize(QSize(30, 12))
        self.ColNumber.setContextMenuPolicy(Qt.NoContextMenu)
        self.ColNumber.setFrameShape(QFrame.StyledPanel)
        self.ColNumber.setFrameShadow(QFrame.Plain)
        self.ColNumber.setLineWidth(1)
        self.ColNumber.setAlignment( Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter )
        self.ColNumber.setObjectName("ColNumber")
        self.ColNumber.setToolTip(_TR("EditViewWidget", "Cursor column number", "tool tip"))
        self.ColNumber.setStatusTip(_TR("EditViewWidget", "Cursor column number", "status tip"))
        self.ColNumber.setWhatsThis(_TR("EditViewWidget", "The column number position of the cursor in the current line.","whatsthis"))
        HBL.addWidget(self.ColNumber)

        # Set up a vertical layout and put two items in it, the editor and HBL
        VBL = QVBoxLayout()
        VBL.setContentsMargins(8, 8, 8, 8)
        VBL.addWidget(self.Editor)
        VBL.addWidget(bot_frame)
        self.setLayout(VBL)

        # end of _uic
Exemple #41
0
class TitleBar(QWidget):
    def __init__(self, ui_main):
        super().__init__()

        self.ui_main = ui_main

        self.initUI()

        self.minimizeBtn.clicked.connect(self.ui_main.showMinimized)
        self.resizeBtn.clicked.connect(self.resizeClicked)

    def initUI(self):
        self.sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        self.sizePolicy.setHorizontalStretch(0)
        self.sizePolicy.setVerticalStretch(0)

        self.centralFrame = QFrame(self)
        self.centralFrame.setMinimumSize(QSize(0, 40))
        self.centralFrame.setMaximumSize(QSize(16777215, 42))
        self.centralFrame.setStyleSheet(u"background-color: rgba(27, 29, 35, 255)")
        self.centralFrame.setFrameShape(QFrame.NoFrame)
        self.centralFrame.setFrameShadow(QFrame.Raised)
        self.centralFrame.setContentsMargins(0, 0, 0, 0)

        """
        Title Frame, Label, and Layout
        """
        self.titleFrame = QFrame(self.centralFrame)
        self.sizePolicy.setHeightForWidth(self.titleFrame.sizePolicy().hasHeightForWidth())
        self.titleFrame.setSizePolicy(self.sizePolicy)
        self.titleFrame.setFrameShape(QFrame.NoFrame)
        self.titleFrame.setFrameShadow(QFrame.Raised)
        self.titleFrame.setContentsMargins(0, 0, 0, 0)
        self.titleFrame.setStyleSheet("border: none;")

        self.label = TitleBarLabel(self.titleFrame)

        self.titleFrameLayout = QHBoxLayout(self.titleFrame)
        self.titleFrameLayout.setSpacing(0)
        self.titleFrameLayout.setContentsMargins(5, 0, 10, 0)

        self.titleFrameLayout.addWidget(self.label)

        """
        Buttons Frame, Buttons, and Layout
        """
        self.btnsFrame = QFrame(self.centralFrame)
        self.sizePolicy.setHeightForWidth(self.btnsFrame.sizePolicy().hasHeightForWidth())
        self.btnsFrame.setSizePolicy(self.sizePolicy)
        self.btnsFrame.setMaximumSize(QSize(120, 16777215))
        self.btnsFrame.setFrameShape(QFrame.NoFrame)
        self.btnsFrame.setFrameShadow(QFrame.Raised)
        self.btnsFrame.setContentsMargins(0, 0, 0, 0)
        self.btnsFrame.setStyleSheet("border: none;")

        self.minimizeBtn = MinimizeButton(self.btnsFrame)
        self.resizeBtn = ResizeButton(self.btnsFrame)
        self.closeBtn = CloseButton(self.btnsFrame)

        self.btnsLayout = QHBoxLayout(self.btnsFrame)
        self.btnsLayout.addWidget(self.minimizeBtn)
        self.btnsLayout.addWidget(self.resizeBtn)
        self.btnsLayout.addWidget(self.closeBtn)
        self.btnsLayout.setSpacing(0)
        self.btnsLayout.setContentsMargins(0, 0, 0, 0)

        """
        Central Layout
        """
        self.centralLayout = QHBoxLayout(self.centralFrame)
        self.centralLayout.addWidget(self.titleFrame)
        self.centralLayout.addWidget(self.btnsFrame, 0, Qt.AlignRight)
        self.centralLayout.setSpacing(0)
        self.centralLayout.setContentsMargins(0, 0, 0, 0)

        """
        UI Layout
        """
        self.uiLayout = QVBoxLayout(self)
        self.uiLayout.addWidget(self.centralFrame)
        self.uiLayout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(self.uiLayout)

    def mouseMoveEvent(self, ev):
        self.ui_main.moveWindow(ev)

    def resizeClicked(self):
        if self.ui_main.windowState() == Qt.WindowMaximized:
            self.ui_main.showNormal()
            self.setToolTip("Maximize")
            self.resizeBtn.setIcon(QtGui.QIcon(resource_path("icons/cil-window-maximize.png")))

        else:
            self.ui_main.showMaximized()
            self.setToolTip("Restore")
            self.resizeBtn.setIcon(QtGui.QIcon(resource_path("icons/cil-window-restore.png")))
Exemple #42
0
    def _setupUi(self):
        self.setWindowTitle(tr("Schedule Info"))
        self.resize(469, 416)
        self.setModal(True)
        self.verticalLayout_2 = QVBoxLayout(self)
        self.tabWidget = QTabWidget(self)
        self.tab = QWidget()
        self.formLayout = QFormLayout(self.tab)
        self.formLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
        self.label_2 = QLabel(tr("Start Date:"))
        self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label_2)
        self.startDateEdit = DateEdit(self.tab)
        self.startDateEdit.setMaximumSize(QSize(120, 16777215))
        self.formLayout.setWidget(0, QFormLayout.FieldRole, self.startDateEdit)
        self.label_7 = QLabel(tr("Repeat Type:"))
        self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_7)
        self.repeatTypeComboBoxView = QComboBox(self.tab)
        self.formLayout.setWidget(1, QFormLayout.FieldRole, self.repeatTypeComboBoxView)
        self.label_8 = QLabel(tr("Every:"))
        self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_8)
        self.horizontalLayout_2 = QHBoxLayout()
        self.repeatEverySpinBox = QSpinBox(self.tab)
        self.repeatEverySpinBox.setMinimum(1)
        self.horizontalLayout_2.addWidget(self.repeatEverySpinBox)
        self.repeatEveryDescLabel = QLabel(self.tab)
        self.horizontalLayout_2.addWidget(self.repeatEveryDescLabel)
        self.formLayout.setLayout(2, QFormLayout.FieldRole, self.horizontalLayout_2)
        self.label_9 = QLabel(tr("Stop Date:"))
        self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_9)
        self.stopDateEdit = DateEdit(self.tab, is_clearable=True)
        self.stopDateEdit.setMaximumSize(QSize(120, 16777215))
        self.formLayout.setWidget(3, QFormLayout.FieldRole, self.stopDateEdit)
        self.label_3 = QLabel(tr("Description:"))
        self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_3)
        self.descriptionEdit = DescriptionEdit(self.model.completable_edit, self.tab)
        self.formLayout.setWidget(4, QFormLayout.FieldRole, self.descriptionEdit)
        self.label_4 = QLabel(tr("Payee:"))
        self.formLayout.setWidget(5, QFormLayout.LabelRole, self.label_4)
        self.payeeEdit = PayeeEdit(self.model.completable_edit, self.tab)
        self.formLayout.setWidget(5, QFormLayout.FieldRole, self.payeeEdit)
        self.label_5 = QLabel(tr("Check #:"))
        self.formLayout.setWidget(6, QFormLayout.LabelRole, self.label_5)
        self.checkNoEdit = QLineEdit(self.tab)
        self.checkNoEdit.setMaximumSize(QSize(120, 16777215))
        self.formLayout.setWidget(6, QFormLayout.FieldRole, self.checkNoEdit)
        self.amountLabel = QLabel(tr("Transfers:"))
        self.formLayout.setWidget(7, QFormLayout.LabelRole, self.amountLabel)
        self.splitTableView = TableView(self.tab)
        self.splitTableView.setMinimumSize(QSize(355, 0))
        self.splitTableView.setAcceptDrops(True)
        self.splitTableView.setDragEnabled(True)
        self.splitTableView.setDragDropOverwriteMode(False)
        self.splitTableView.setDragDropMode(QAbstractItemView.InternalMove)
        self.splitTableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.splitTableView.horizontalHeader().setDefaultSectionSize(40)
        self.splitTableView.verticalHeader().setVisible(False)
        self.splitTableView.verticalHeader().setDefaultSectionSize(18)
        self.formLayout.setWidget(7, QFormLayout.FieldRole, self.splitTableView)
        self.widget = QWidget(self.tab)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth())
        self.widget.setSizePolicy(sizePolicy)
        self.horizontalLayout_6 = QHBoxLayout(self.widget)
        self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem)
        self.addSplitButton = QPushButton(self.widget)
        icon = QIcon()
        icon.addPixmap(QPixmap(':/plus_8'), QIcon.Normal, QIcon.Off)
        self.addSplitButton.setIcon(icon)
        self.horizontalLayout_6.addWidget(self.addSplitButton)
        self.removeSplitButton = QPushButton(self.widget)
        icon1 = QIcon()
        icon1.addPixmap(QPixmap(':/minus_8'), QIcon.Normal, QIcon.Off)
        self.removeSplitButton.setIcon(icon1)
        self.horizontalLayout_6.addWidget(self.removeSplitButton)
        self.formLayout.setWidget(8, QFormLayout.FieldRole, self.widget)
        self.tabWidget.addTab(self.tab, tr("Info"))
        self.tab_3 = QWidget()
        self.horizontalLayout_5 = QHBoxLayout(self.tab_3)
        self.notesEdit = QPlainTextEdit(self.tab_3)
        self.horizontalLayout_5.addWidget(self.notesEdit)
        self.tabWidget.addTab(self.tab_3, tr("Notes"))
        self.verticalLayout_2.addWidget(self.tabWidget)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Save)
        self.verticalLayout_2.addWidget(self.buttonBox)
        self.label_2.setBuddy(self.startDateEdit)
        self.label_7.setBuddy(self.repeatTypeComboBoxView)
        self.label_3.setBuddy(self.descriptionEdit)
        self.label_4.setBuddy(self.payeeEdit)
        self.label_5.setBuddy(self.checkNoEdit)

        self.tabWidget.setCurrentIndex(0)
Exemple #43
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1871, 1200)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.transformsGroupBox = QGroupBox(self.centralwidget)
        self.transformsGroupBox.setGeometry(QRect(1500, 170, 240, 500))
        self.transformsGroupBox.setMaximumSize(QSize(240, 600))
        font = QFont()
        font.setFamily("MS Shell Dlg 2")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.transformsGroupBox.setFont(font)
        self.transformsGroupBox.setToolTip("")
        self.transformsGroupBox.setWhatsThis("")
        self.transformsGroupBox.setObjectName("transformsGroupBox")
        self.edgesButton = QPushButton(self.transformsGroupBox)
        self.edgesButton.setGeometry(QRect(110, 180, 120, 30))
        self.edgesButton.setObjectName("edgesButton")
        self.brightnessButton = QPushButton(self.transformsGroupBox)
        self.brightnessButton.setGeometry(QRect(110, 20, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.brightnessButton.setFont(font)
        self.brightnessButton.setObjectName("brightnessButton")
        self.getSizeButton = QPushButton(self.transformsGroupBox)
        self.getSizeButton.setGeometry(QRect(0, 470, 75, 23))
        self.getSizeButton.setObjectName("getSizeButton")
        self.paramsGroupBox = QGroupBox(self.transformsGroupBox)
        self.paramsGroupBox.setGeometry(QRect(10, 29, 91, 321))
        font = QFont()
        font.setPointSize(8)
        self.paramsGroupBox.setFont(font)
        self.paramsGroupBox.setObjectName("paramsGroupBox")
        self.leftSlider = QSlider(self.paramsGroupBox)
        self.leftSlider.setGeometry(QRect(10, 50, 20, 240))
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.leftSlider.sizePolicy().hasHeightForWidth())
        self.leftSlider.setSizePolicy(sizePolicy)
        self.leftSlider.setOrientation(Qt.Vertical)
        self.leftSlider.setTickPosition(QSlider.TicksAbove)
        self.leftSlider.setObjectName("leftSlider")
        self.rightSlider = QSlider(self.paramsGroupBox)
        self.rightSlider.setGeometry(QRect(50, 50, 20, 240))
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.rightSlider.sizePolicy().hasHeightForWidth())
        self.rightSlider.setSizePolicy(sizePolicy)
        self.rightSlider.setOrientation(Qt.Vertical)
        self.rightSlider.setTickPosition(QSlider.TicksAbove)
        self.rightSlider.setObjectName("rightSlider")
        self.leftLabel = QLabel(self.paramsGroupBox)
        self.leftLabel.setGeometry(QRect(10, 20, 20, 15))
        self.leftLabel.setTextFormat(Qt.PlainText)
        self.leftLabel.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
        self.leftLabel.setObjectName("leftLabel")
        self.rightLabel = QLabel(self.paramsGroupBox)
        self.rightLabel.setGeometry(QRect(50, 20, 20, 15))
        self.rightLabel.setTextFormat(Qt.PlainText)
        self.rightLabel.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
        self.rightLabel.setObjectName("rightLabel")
        self.adaptiveThresholdButton = QPushButton(self.transformsGroupBox)
        self.adaptiveThresholdButton.setGeometry(QRect(110, 140, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.adaptiveThresholdButton.setFont(font)
        self.adaptiveThresholdButton.setObjectName("adaptiveThresholdButton")
        self.gray2colSelButton = QPushButton(self.transformsGroupBox)
        self.gray2colSelButton.setGeometry(QRect(110, 100, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.gray2colSelButton.setFont(font)
        self.gray2colSelButton.setObjectName("gray2colSelButton")
        self.gray2colAllButton = QPushButton(self.transformsGroupBox)
        self.gray2colAllButton.setGeometry(QRect(110, 60, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.gray2colAllButton.setFont(font)
        self.gray2colAllButton.setObjectName("gray2colAllButton")
        self.fftButton = QPushButton(self.transformsGroupBox)
        self.fftButton.setGeometry(QRect(110, 220, 120, 30))
        self.fftButton.setObjectName("fftButton")
        self.dftButton = QPushButton(self.transformsGroupBox)
        self.dftButton.setGeometry(QRect(110, 260, 120, 30))
        self.dftButton.setObjectName("dftButton")
        self.gaborButton = QPushButton(self.transformsGroupBox)
        self.gaborButton.setGeometry(QRect(110, 300, 120, 30))
        self.gaborButton.setObjectName("gaborButton")
        self.differenceButton = QPushButton(self.transformsGroupBox)
        self.differenceButton.setGeometry(QRect(110, 340, 120, 30))
        self.differenceButton.setObjectName("differenceButton")
        self.RGB2GrayButton = QPushButton(self.transformsGroupBox)
        self.RGB2GrayButton.setGeometry(QRect(110, 380, 120, 30))
        self.RGB2GrayButton.setObjectName("RGB2GrayButton")
        self.invertedCheckBox = QCheckBox(self.transformsGroupBox)
        self.invertedCheckBox.setGeometry(QRect(110, 430, 121, 17))
        self.invertedCheckBox.setObjectName("invertedCheckBox")
        self.angleDial = QDial(self.transformsGroupBox)
        self.angleDial.setGeometry(QRect(20, 360, 81, 64))
        self.angleDial.setMinimum(1)
        self.angleDial.setMaximum(4)
        self.angleDial.setPageStep(1)
        self.angleDial.setSliderPosition(1)
        self.angleDial.setWrapping(False)
        self.angleDial.setNotchesVisible(True)
        self.angleDial.setObjectName("angleDial")
        self.groupButtonsBox = QGroupBox(self.centralwidget)
        self.groupButtonsBox.setGeometry(QRect(1500, 730, 241, 141))
        self.groupButtonsBox.setMaximumSize(QSize(250, 600))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.groupButtonsBox.setFont(font)
        self.groupButtonsBox.setObjectName("groupButtonsBox")
        self.addImgButton = QPushButton(self.groupButtonsBox)
        self.addImgButton.setGeometry(QRect(50, 20, 150, 30))
        palette = QPalette()
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Button, brush)
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Inactive, QPalette.Button, brush)
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Disabled, QPalette.Button, brush)
        self.addImgButton.setPalette(palette)
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.addImgButton.setFont(font)
        self.addImgButton.setObjectName("addImgButton")
        self.saveSceneImgButton = QPushButton(self.groupButtonsBox)
        self.saveSceneImgButton.setGeometry(QRect(50, 60, 150, 30))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.saveSceneImgButton.setFont(font)
        self.saveSceneImgButton.setObjectName("saveSceneImgButton")
        self.saveImgButton = QPushButton(self.groupButtonsBox)
        self.saveImgButton.setGeometry(QRect(50, 100, 150, 30))
        font = QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.saveImgButton.setFont(font)
        self.saveImgButton.setObjectName("saveImgButton")
        self.graphicsView = QGraphicsView(self.centralwidget)
        self.graphicsView.setGeometry(QRect(10, 15, 1471, 900))
        self.graphicsView.setMaximumSize(QSize(4000, 3000))
        self.graphicsView.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.graphicsView.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.graphicsView.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
        self.graphicsView.setObjectName("graphicsView")
        self.scene = TransformScene()
        self.graphicsView.setScene(self.scene)
        self.scaleEditLabel = QLabel(self.centralwidget)
        self.scaleEditLabel.setGeometry(QRect(1500, 100, 47, 13))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.scaleEditLabel.setFont(font)
        self.scaleEditLabel.setObjectName("scaleEditLabel")
        self.scaleBox = QDoubleSpinBox(self.centralwidget)
        self.scaleBox.setGeometry(QRect(1550, 100, 62, 22))
        font = QFont()
        font.setBold(True)
        font.setWeight(75)
        self.scaleBox.setFont(font)
        self.scaleBox.setMinimum(0.1)
        self.scaleBox.setMaximum(10.0)
        self.scaleBox.setSingleStep(0.1)
        self.scaleBox.setProperty("value", 0.5)
        self.scaleBox.setObjectName("scaleBox")
        self.infoLabel = QLabel(self.centralwidget)
        self.infoLabel.setGeometry(QRect(1499, 130, 230, 20))
        self.infoLabel.setFrameShape(QFrame.WinPanel)
        self.infoLabel.setText("")
        self.infoLabel.setAlignment(Qt.AlignCenter)
        self.infoLabel.setObjectName("infoLabel")
        self.infoLabel_2 = QLabel(self.centralwidget)
        self.infoLabel_2.setGeometry(QRect(1500, 20, 230, 20))
        font = QFont()
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.infoLabel_2.setFont(font)
        self.infoLabel_2.setFrameShape(QFrame.WinPanel)
        self.infoLabel_2.setText("")
        self.infoLabel_2.setAlignment(Qt.AlignCenter)
        self.infoLabel_2.setObjectName("infoLabel_2")
        self.infoLabel_3 = QLabel(self.centralwidget)
        self.infoLabel_3.setGeometry(QRect(1500, 60, 230, 20))
        font = QFont()
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.infoLabel_3.setFont(font)
        self.infoLabel_3.setFrameShape(QFrame.Box)
        self.infoLabel_3.setText("")
        self.infoLabel_3.setAlignment(Qt.AlignCenter)
        self.infoLabel_3.setObjectName("infoLabel_3")
        self.clearImgButton = QPushButton(self.centralwidget)
        self.clearImgButton.setGeometry(QRect(1550, 690, 150, 30))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.clearImgButton.setFont(font)
        self.clearImgButton.setObjectName("clearImgButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 1871, 21))
        self.menubar.setObjectName("menubar")
        self.menuHelp = QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.actionHelp = QAction(MainWindow)
        self.actionHelp.setObjectName("actionHelp")
        self.actionAbout = QAction(MainWindow)
        self.actionAbout.setObjectName("actionAbout")
        self.actionDefault_Values = QAction(MainWindow)
        self.actionDefault_Values.setObjectName("actionDefault_Values")
        self.menuHelp.addAction(self.actionHelp)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionDefault_Values)
        self.menubar.addAction(self.menuHelp.menuAction())

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
        self.scene.file_signal.connect(on_file_signal)
        self.scene.info_signal.connect(on_info_signal)
        self.scene.sliders_reset_signal.connect(on_sliders_reset_signal)
Exemple #44
0
    def _buildUi(self):
        self._clues = {}
        self._selectionComboBox = None
        self.loadLanguage()
        self.loadClueAlbum('clue-album.ini')

        if self._clues:
            self._selectionComboBox = QComboBox()
            self._selectionComboBox.addItem(self.tr("Load clue..."), None)
            for k in self._clues:
                clue = self._clues[k]
                self._selectionComboBox.addItem(clue.title, k)

        self._options = {}
        if os.path.isfile('definitions.ini'):
            definitions = QSettings('definitions.ini', QSettings.IniFormat)
            for group in definitions.childGroups():
                definitions.beginGroup(group)
                if group == "options":
                    for key in definitions.childKeys():
                        self._options[key] = definitions.value(key)
                definitions.endGroup()

        main_layout = QVBoxLayout()
        main_layout.setSpacing(12)

        self._led = LedWidget(self.tr("Raspberry Teletext"), QSize(40, 20))
        self._led.setRedAsBold(True)
        self._led.setRedAsRed(True)
        self._led.switchOn('gray')

        settings_button = QPushButton()
        settings_button.setIcon(QIcon("./settings.svg"))
        settings_button.setFlat(True)
        settings_button.setToolTip(self.tr("Effects and language"))
        settings_button.setIconSize(QSize(16, 16))
        settings_button.setFixedSize(QSize(24, 24))

        header_layout = QHBoxLayout()
        header_layout.addWidget(self._led)
        header_layout.addWidget(settings_button, Qt.AlignRight)
        main_layout.addLayout(header_layout)

        stop_button = QPushButton()
        stop_button.setIcon(QIcon("./cancel.svg"))
        stop_button.setFlat(True)
        stop_button.setToolTip(self.tr("Clear TV screen"))
        stop_button.setIconSize(QSize(16, 16))
        stop_button.setFixedSize(QSize(24, 24))

        if 'tv-screen-width' in self._options and 'tv-screen-height' in self._options:
            hint = QSize(int(self._options['tv-screen-width']), int(self._options['tv-screen-height']))
            # self._tvScreen = TvScreenLabel(self.tr("<div align=center>Display on TV</div>"), hint)
            self._tvScreen = TvScreenLabel('', hint)
            policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        else:
            # self._tvScreen = TvScreenLabel(self.tr("<div align=center>Display on TV</div>"))
            self._tvScreen = TvScreenLabel('')
            policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        policy.setHeightForWidth(True)
        self._tvScreen.setSizePolicy(policy)

        display_layout = QHBoxLayout()
        display_layout.addWidget(self._tvScreen)
        display_layout.addStretch()
        display_layout.addWidget(stop_button, Qt.AlignRight)
        main_layout.addLayout(display_layout)

        if self._selectionComboBox:
            main_layout.addWidget(self._selectionComboBox)

        self._editor = QPlainTextEdit()
        self._editor.setFrameShape(QFrame.NoFrame)
        self._editor.setCursorWidth(8)
        main_layout.addWidget(self._editor)

        clear_button = QPushButton(self.tr("Erase draft"))
        clear_button.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)

        send_button = QPushButton(self.tr("Display on TV"))
        send_button.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)

        button_layout = QHBoxLayout()
        button_layout.addWidget(send_button)
        button_layout.addWidget(clear_button)
        main_layout.addLayout(button_layout)

        self.setLayout(main_layout)

        settings_button.pressed.connect(self.settings)
        stop_button.pressed.connect(self.stop)
        clear_button.pressed.connect(self.erase)
        send_button.pressed.connect(self.send)
        self.switchLed.connect(self._led.switchOn)
        if self._selectionComboBox:
            self._selectionComboBox.activated.connect(self.selectClue)

        self._editor.setFocusPolicy(Qt.StrongFocus)
        self._editor.setFocus(Qt.OtherFocusReason)
Exemple #45
0
    def initUI(self):
        """
        Inicjuje UI
        """
        self.view_u.setObjectName('Usługi')
        self.view_k.setObjectName('Klienci')
        self.view_p.setObjectName('Pracownicy')
        self.view.setObjectName('Rezerwacje')
        self.table_init_u()
        self.table_init_k()
        self.table_init_p()
        self.table_init()
        self.btn_mod.setDisabled(True)
        self.btn_usun.setDisabled(True)
        self.btn_dodaj.setDisabled(True)

        # Tworzenie kontrolek
        lbl_wysz_u = QLabel('Wyszukaj usługę:')
        lbl_wysz_k = QLabel('Wyszukaj klienta:')
        lbl_wysz_p = QLabel('Wyszukaj pracownika:')
        txt_wysz_u = QLineEdit(self)
        txt_wysz_k = QLineEdit(self)
        txt_wysz_p = QLineEdit(self)
        lbl_klient = QLabel('Klient:')
        lbl_usluga = QLabel('Usługa:')
        lbl_termin = QLabel('Termin:')

        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.kalendarz.sizePolicy().hasHeightForWidth())
        self.kalendarz.setSizePolicy(sizePolicy)

        # Tworzenie widoków
        centralbox = QHBoxLayout()
        hbox_wysz_u = QHBoxLayout()
        hbox_wysz_k = QHBoxLayout()
        hbox_wysz_p = QHBoxLayout()
        vbox_u = QVBoxLayout()
        vbox_k = QVBoxLayout()
        vbox_p = QVBoxLayout()
        vbox_right = QVBoxLayout()
        hbox_btn = QHBoxLayout()
        hbox_k = QHBoxLayout()
        hbox_u = QHBoxLayout()
        hbox_t = QHBoxLayout()
        vbox_cal = QVBoxLayout()
        groupbox = QGroupBox('Godziny:')
        groupbox.setLayout(self.gb_layout)
        hbox_left = QHBoxLayout()

        # Metody
        self.lbl_termin_.setCalendarWidget(self.kalendarz)
        self.lbl_termin_.setDate(self.kalendarz.selectedDate())
        self.dzien_tyg = self.kalendarz.selectedDate().dayOfWeek()
        txt_wysz_u.textChanged.connect(self.searching_u)
        txt_wysz_k.textChanged.connect(self.searching_k)
        txt_wysz_p.textChanged.connect(self.searching_p)
        self.view_k.clicked.connect(lambda: self.clicked_table(self.view_k))
        self.view_p.clicked.connect(lambda: self.clicked_table(self.view_p))
        self.view_u.clicked.connect(lambda: self.clicked_table(self.view_u))
        self.view.clicked.connect(lambda: self.clicked_table(self.view))
        self.kalendarz.clicked.connect(self.show_data)
        self.btn_dodaj.clicked.connect(self.add)
        self.btn_mod.clicked.connect(self.modify)
        self.btn_usun.clicked.connect(self.remove)

        # Ustawianie widoków
        hbox_wysz_k.addWidget(lbl_wysz_k)
        hbox_wysz_k.addWidget(txt_wysz_k)
        hbox_wysz_p.addWidget(lbl_wysz_p)
        hbox_wysz_p.addWidget(txt_wysz_p)
        hbox_wysz_u.addWidget(lbl_wysz_u)
        hbox_wysz_u.addWidget(txt_wysz_u)
        vbox_u.addLayout(hbox_wysz_u)
        vbox_u.addWidget(self.view_u)
        vbox_k.addLayout(hbox_wysz_k)
        vbox_k.addWidget(self.view_k)
        vbox_p.addLayout(hbox_wysz_p)
        vbox_p.addWidget(self.view_p)
        vbox_right.addLayout(vbox_p)
        vbox_right.addLayout(vbox_u)
        vbox_right.addLayout(vbox_k)
        hbox_btn.addWidget(self.btn_usun)
        hbox_btn.addWidget(self.btn_mod)
        hbox_k.addWidget(lbl_klient)
        hbox_k.addWidget(self.lbl_klient_)
        hbox_u.addWidget(lbl_usluga)
        hbox_u.addWidget(self.lbl_usluga_)
        hbox_t.addWidget(lbl_termin)
        hbox_t.addWidget(self.lbl_termin_)
        vbox_cal.addWidget(self.kalendarz)
        vbox_cal.addLayout(hbox_u)
        vbox_cal.addLayout(hbox_t)
        vbox_cal.addLayout(hbox_k)
        self.view.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum))
        vbox_cal.addWidget(self.view)
        vbox_cal.addLayout(hbox_btn)
        vbox_cal.addWidget(self.btn_dodaj)
        hbox_left.addLayout(vbox_cal)
        hbox_left.addWidget(groupbox)
        centralbox.addLayout(hbox_left)
        centralbox.addLayout(vbox_right)

        self.setLayout(centralbox)
        self.show()
 def __init__(self, parent):
     QLabel.__init__(self, parent)
     sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     sizePolicy.setHeightForWidth(True)
     self.setSizePolicy(sizePolicy)
Exemple #47
0
class SideMenu(QWidget):
    SCAN_BUTTON = 0
    VIEW_BUTTON = 1
    WRITE_BUTTON = 2

    def __init__(self, parent):
        super().__init__()

        self.initUI()

    def initUI(self):
        self.centralFrame = QFrame(self)

        self.sizePolicy = QSizePolicy(QSizePolicy.Preferred,
                                      QSizePolicy.Preferred)
        self.sizePolicy.setHorizontalStretch(0)
        self.sizePolicy.setVerticalStretch(0)
        self.sizePolicy.setHeightForWidth(
            self.centralFrame.sizePolicy().hasHeightForWidth())

        self.centralFrame.setSizePolicy(self.sizePolicy)
        self.centralFrame.setFrameShape(QFrame.NoFrame)
        self.centralFrame.setFrameShadow(QFrame.Raised)
        self.centralFrame.setMinimumSize(QSize(70, 0))
        self.centralFrame.setMaximumSize(QSize(70, 16777215))
        self.centralFrame.setLayoutDirection(Qt.LeftToRight)
        self.centralFrame.setStyleSheet(u"background-color: rgb(27, 29, 35);")

        self.logoFrame = QFrame(self.centralFrame)
        self.logoFrame.setFrameShape(QFrame.NoFrame)
        self.logoFrame.setFrameShadow(QFrame.Raised)
        self.logoFrame.setContentsMargins(0, 0, 0, 0)
        self.logoFrame.setStyleSheet("border: none;")

        self.logoWidget = Logo(self.logoFrame)

        self.logoLayout = QHBoxLayout(self.logoFrame)
        self.logoLayout.setAlignment(Qt.AlignCenter)
        self.logoLayout.addWidget(self.logoWidget)

        self.btnsFrame = QFrame(self.centralFrame)
        self.btnsFrame.setFrameShape(QFrame.NoFrame)
        self.btnsFrame.setFrameShadow(QFrame.Raised)
        self.btnsFrame.setContentsMargins(0, 0, 0, 0)
        self.btnsFrame.setStyleSheet("border: none;")

        self.networkBtn = MenuButton(self.btnsFrame)
        self.networkBtn.setIcon(QIcon(
            resource_path("icons/cil-wifi-signal-1")))
        self.networkBtn.setToolTip("Scan for Devices")

        self.viewBtn = MenuButton(self.btnsFrame)
        self.viewBtn.setIcon(QIcon(resource_path("icons/cil-speedometer")))
        self.viewBtn.setToolTip("View Device Measurements")

        self.writeBtn = MenuButton(self.btnsFrame)
        self.writeBtn.setIcon(QIcon(resource_path("icons/cil-transfer")))
        self.writeBtn.setToolTip("Output Device Measurements")

        self.btnsLayout = QVBoxLayout(self.btnsFrame)
        self.btnsLayout.addWidget(self.networkBtn)
        self.btnsLayout.addWidget(self.viewBtn)
        self.btnsLayout.addWidget(self.writeBtn)
        self.btnsLayout.setContentsMargins(0, 0, 0, 0)

        self.centralLayout = QVBoxLayout(self.centralFrame)
        self.centralLayout.addWidget(self.logoFrame,
                                     stretch=.5,
                                     alignment=Qt.AlignTop)
        self.centralLayout.addWidget(self.btnsFrame,
                                     stretch=4,
                                     alignment=Qt.AlignTop)
        self.centralLayout.setContentsMargins(0, 0, 0, 0)

        self.uiLayout = QHBoxLayout(self)
        self.uiLayout.addWidget(self.centralFrame)
        self.uiLayout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(self.uiLayout)
    def __init__(self):
        super().__init__()

        #window
        self.resize(595, 284)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QtCore.QSize(595, 284))
        self.setMaximumSize(QtCore.QSize(16777215, 16777215))

        self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/icon.svg')))
        self.setWindowTitle("Persepolis Download Manager")

        self.gridLayout = QtWidgets.QGridLayout(self)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        #progress_tabWidget
        self.progress_tabWidget = QtWidgets.QTabWidget(self)
        #informations_tab
        self.informations_tab = QtWidgets.QWidget()
        self.informations_verticalLayout = QtWidgets.QVBoxLayout(
            self.informations_tab)
        #link_label
        self.link_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.link_label)

        #status_label
        self.status_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.status_label)
        #downloaded_label
        self.downloaded_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.downloaded_label)
        #save_label
        self.save_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.save_label)
        #rate_label
        self.rate_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.rate_label)
        #time_label
        self.time_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.time_label)

        self.connections_label = QtWidgets.QLabel(self.informations_tab)
        self.informations_verticalLayout.addWidget(self.connections_label)

        self.progress_tabWidget.addTab(self.informations_tab, "")
        #options_tab
        self.options_tab = QtWidgets.QWidget()
        self.widget = QtWidgets.QWidget(self.options_tab)
        self.widget.setGeometry(QtCore.QRect(30, 7, 511, 151))

        self.options_gridLayout = QtWidgets.QGridLayout(self.widget)
        self.options_gridLayout.setContentsMargins(0, 0, 0, 0)
        #limit_checkBox
        self.limit_checkBox = QtWidgets.QCheckBox(self.widget)
        self.options_gridLayout.addWidget(self.limit_checkBox, 0, 0, 1, 1)
        #after_checkBox
        self.after_checkBox = QtWidgets.QCheckBox(self.widget)
        self.options_gridLayout.addWidget(self.after_checkBox, 0, 1, 1, 1)
        #limit_frame
        self.limit_frame = QtWidgets.QFrame(self.widget)
        self.limit_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QtWidgets.QFrame.Raised)

        self.widget1 = QtWidgets.QWidget(self.limit_frame)
        self.widget1.setGeometry(QtCore.QRect(44, 27, 151, 62))
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget1)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        #limit_spinBox
        self.limit_spinBox = QtWidgets.QSpinBox(self.widget1)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        self.horizontalLayout.addWidget(self.limit_spinBox)
        #limit_comboBox
        self.limit_comboBox = QtWidgets.QComboBox(self.widget1)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        self.horizontalLayout.addWidget(self.limit_comboBox)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        #limit_pushButton
        self.limit_pushButton = QtWidgets.QPushButton(self.widget1)
        self.verticalLayout_2.addWidget(self.limit_pushButton)
        self.options_gridLayout.addWidget(self.limit_frame, 1, 0, 1, 1)
        #after_frame
        self.after_frame = QtWidgets.QFrame(self.widget)
        self.after_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.after_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        #after_comboBox
        self.widget = QtWidgets.QWidget(self.after_frame)
        self.widget.setGeometry(QtCore.QRect(77, 28, 150, 60))

        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget)
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)

        self.after_comboBox = QtWidgets.QComboBox(self.after_frame)
        self.after_comboBox.setGeometry(QtCore.QRect(73, 46, 111, 26))
        self.after_comboBox.addItem("")
        self.after_comboBox.addItem("")

        self.verticalLayout_3.addWidget(self.after_comboBox)
        #after_pushButton
        self.after_pushButton = QtWidgets.QPushButton(self.widget)
        self.verticalLayout_3.addWidget(self.after_pushButton)

        self.options_gridLayout.addWidget(self.after_frame, 1, 1, 1, 1)
        self.progress_tabWidget.addTab(self.options_tab, "")
        self.verticalLayout.addWidget(self.progress_tabWidget)

        #download_progressBar
        self.download_progressBar = QtWidgets.QProgressBar(self)
        self.verticalLayout.addWidget(self.download_progressBar)

        self.button_horizontalLayout = QtWidgets.QHBoxLayout()
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.button_horizontalLayout.addItem(spacerItem)
        #resume_pushButton
        self.resume_pushButton = QtWidgets.QPushButton(self)
        self.button_horizontalLayout.addWidget(self.resume_pushButton)
        self.resume_pushButton.setIcon(QIcon(icons + 'play'))
        #pause_pushButton
        self.pause_pushButton = QtWidgets.QPushButton(self)
        self.button_horizontalLayout.addWidget(self.pause_pushButton)
        self.pause_pushButton.setIcon(QIcon(icons + 'pause'))
        #stop_pushButton
        self.stop_pushButton = QtWidgets.QPushButton(self)
        self.button_horizontalLayout.addWidget(self.stop_pushButton)
        self.verticalLayout.addLayout(self.button_horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
        self.stop_pushButton.setIcon(QIcon(icons + 'stop'))

        self.progress_tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(self)
        #labels
        self.link_label.setText("Link :")
        self.status_label.setText("Status : ")
        self.downloaded_label.setText("Downloaded :")
        self.save_label.setText("Save as : ")
        self.rate_label.setText("Transfer rate : ")
        self.time_label.setText("Estimate time left :")
        self.connections_label.setText("Number of connections : ")
        self.progress_tabWidget.setTabText(
            self.progress_tabWidget.indexOf(self.informations_tab),
            "Download informations")
        self.limit_checkBox.setText("Limit Speed")
        self.after_checkBox.setText("After download")
        self.limit_comboBox.setItemText(0, "KB/S")
        self.limit_comboBox.setItemText(1, "MB/S")
        self.limit_pushButton.setText("Apply")

        self.after_comboBox.setItemText(0, "Shut Down as root")
        self.after_comboBox.setItemText(1, "Shut Down")

        self.progress_tabWidget.setTabText(
            self.progress_tabWidget.indexOf(self.options_tab),
            "Download Options")
        self.resume_pushButton.setText("Resume")
        self.pause_pushButton.setText("Pause")
        self.stop_pushButton.setText("Stop")
        self.after_pushButton.setText("Apply")
Exemple #49
0
    def setupUi(self):
        sizePolicy2 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

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

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

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

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

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


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

        self.btnMinimize = QPushButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setIcon((QIcon(":/icon/minimize.png")))
        self.btnMinimize.setMinimumSize(QSize(40, 25))
        self.btnMinimize.setMaximumSize(QSize(40, 25))
        sizePolicy2.setHeightForWidth(self.btnMinimize.sizePolicy().hasHeightForWidth())

        self.btnRestore = QPushButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setIcon(QIcon(":/icon/restore.png"))
        self.btnRestore.setMinimumSize(QSize(40, 25))
        self.btnRestore.setMaximumSize(QSize(40, 25))
        sizePolicy2.setHeightForWidth(self.btnRestore.sizePolicy().hasHeightForWidth())
        self.btnRestore.setVisible(False)

        self.btnMaximize = QPushButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setIcon(QIcon(":/icon/maximize.png"))
        self.btnMaximize.setMinimumSize(QSize(40, 25))
        self.btnMaximize.setMaximumSize(QSize(40, 25))
        sizePolicy2.setHeightForWidth(self.btnMaximize.sizePolicy().hasHeightForWidth())
        self.btnMaximize.setDisabled(True)

        self.btnClose = QPushButton (self.titleBar)
        self.btnClose.setIcon(QIcon(":/icon/close.png"))
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setMinimumSize(QSize(40, 25))
        self.btnClose.setMaximumSize(QSize(40, 25))
        sizePolicy2.setHeightForWidth(self.btnClose.sizePolicy().hasHeightForWidth())
        self.btnClose.setSizePolicy(sizePolicy2)
        #self.btnClose.setSizePolicy(spButtons)


        self.vboxFrame.addWidget(self.titleBar)

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

        self.vboxWindow.addWidget(self.windowFrame)

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

        else:

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

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

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

        # set stylesheet

        self.setStyleSheet(window_stylesheet)

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)
    def __init__(self, parent=None, doc_ctrlr=None):
        super(DocumentWindow, self).__init__(parent)

        self.controller = doc_ctrlr
        doc = doc_ctrlr.document()
        self.setupUi(self)
        self.settings = QSettings()
        self._readSettings()

        # Slice setup
        self.slicescene = QGraphicsScene(parent=self.slice_graphics_view)
        self.sliceroot = SliceRootItem(rect=self.slicescene.sceneRect(),\
                                       parent=None,\
                                       window=self,\
                                       document=doc)
        self.sliceroot.setFlag(QGraphicsItem.ItemHasNoContents)
        self.slicescene.addItem(self.sliceroot)
        self.slicescene.setItemIndexMethod(QGraphicsScene.NoIndex)
        assert self.sliceroot.scene() == self.slicescene
        self.slice_graphics_view.setScene(self.slicescene)
        self.slice_graphics_view.scene_root_item = self.sliceroot
        self.slice_graphics_view.setName("SliceView")
        self.slice_tool_manager = SliceToolManager(self)

        # Part toolbar
        splitter_size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        splitter_size_policy.setHorizontalStretch(0)
        splitter_size_policy.setVerticalStretch(0)
        splitter_size_policy.setHeightForWidth(self.main_splitter.sizePolicy().hasHeightForWidth())

        self.slice_splitter.setSizePolicy(splitter_size_policy)
        self.slice_splitter.setFrameShape(QFrame.NoFrame)
        self.slice_splitter.setFrameShadow(QFrame.Plain)
        self.slice_splitter.setLineWidth(0)
        self.slice_splitter.setOrientation(Qt.Horizontal)
        self.slice_splitter.setOpaqueResize(False)
        self.slice_splitter.setHandleWidth(0)

        self.part_toolbar = PartToolBar(doc, self.slice_splitter)
        self.slice_splitter.addWidget(self.slice_graphics_view) # reorder

        # Path setup
        self.pathscene = QGraphicsScene(parent=self.path_graphics_view)
        self.pathroot = PathRootItem(rect=self.pathscene.sceneRect(),\
                                     parent=None,\
                                     window=self,\
                                     document=doc)
        self.pathroot.setFlag(QGraphicsItem.ItemHasNoContents)
        self.pathscene.addItem(self.pathroot)
        self.pathscene.setItemIndexMethod(QGraphicsScene.NoIndex)
        assert self.pathroot.scene() == self.pathscene
        self.path_graphics_view.setScene(self.pathscene)
        self.path_graphics_view.scene_root_item = self.pathroot
        self.path_graphics_view.setScaleFitFactor(0.9)
        self.path_graphics_view.setName("PathView")

        # Path toolbar
        self.path_splitter.setSizePolicy(splitter_size_policy)
        self.path_splitter.setFrameShape(QFrame.NoFrame)
        self.path_splitter.setFrameShadow(QFrame.Plain)
        self.path_splitter.setLineWidth(0)
        self.path_splitter.setOrientation(Qt.Horizontal)
        self.path_splitter.setOpaqueResize(False)
        self.path_splitter.setHandleWidth(0)
        self.path_splitter.setObjectName("path_splitter")
        self.path_splitter.setSizes([600,0]) # for path_splitter horizontal
        self.path_splitter.addWidget(self.selectionToolBar)
        self.path_toolbar = PathToolBar(doc, self.path_splitter)
        # self.path_splitter.addWidget(self.path_graphics_view) # reorder
        self.path_color_panel = ColorPanel()
        self.path_graphics_view.toolbar = self.path_color_panel  # HACK for customqgraphicsview
        self.pathscene.addItem(self.path_color_panel)
        self.path_tool_manager = PathToolManager(self, self.path_toolbar)
        self.slice_tool_manager.path_tool_manager = self.path_tool_manager
        self.path_tool_manager.slice_tool_manager = self.slice_tool_manager

        # set the selection filter default
        doc.documentSelectionFilterChangedSignal.emit(["endpoint", "scaffold", "staple", "xover"])

        self.path_graphics_view.setupGL()
        self.slice_graphics_view.setupGL()
        if GL:
            pass
            # self.slicescene.drawBackground = self.drawBackgroundGL
            # self.pathscene.drawBackground = self.drawBackgroundGL

        # Edit menu setup
        self.actionUndo = doc_ctrlr.undoStack().createUndoAction(self)
        self.actionRedo = doc_ctrlr.undoStack().createRedoAction(self)
        self.actionUndo.setText(QApplication.translate(
                                            "MainWindow", "Undo",
                                            None))
        self.actionUndo.setShortcut(QApplication.translate(
                                            "MainWindow", "Ctrl+Z",
                                            None))
        self.actionRedo.setText(QApplication.translate(
                                            "MainWindow", "Redo",
                                            None))
        self.actionRedo.setShortcut(QApplication.translate(
                                            "MainWindow", "Ctrl+Shift+Z",
                                            None))
        self.sep = QAction(self)
        self.sep.setSeparator(True)
        self.menu_edit.insertAction(self.action_modify, self.sep)
        self.menu_edit.insertAction(self.sep, self.actionRedo)
        self.menu_edit.insertAction(self.actionRedo, self.actionUndo)
        self.main_splitter.setSizes([250, 550])  # balance main_splitter size
        self.statusBar().showMessage("")
Exemple #51
0
    def __init__(self):
        super(InstallDB, self).__init__()

        self.db = None
        self.url = None

        self.setGeometry(0, 0, 610, 400)
        self.setWindowTitle(texts.window_principal_title)
        screen = QDesktopWidget().screenGeometry()
        self.x = (screen.width() / 2) - (self.frameSize().width() / 2)
        self.y = (screen.height() / 2) - (self.frameSize().height() / 2)
        self.move(self.x, self.y)
        self.setStyleSheet("background-color: rgb(239, 235, 231);")

        self.centralwidget = QWidget(self)
        self.centralwidget.setGeometry(0, 0, 610, 400)

        # Install Part 1
        self.widget_1 = QWidget(self.centralwidget)
        self.widget_1.setGeometry(0, 0, 610, 400)
        self.widget_1.setHidden(False)

        self.vbox_main_1 = QWidget(self.widget_1)
        self.vbox_main_1.setGeometry(0, 0, 610, 400)

        self.vbox_part_1 = QVBoxLayout(self.vbox_main_1)
        self.vbox_part_1.setContentsMargins(20, 20, 20, 20)
        self.vbox_part_1.setSpacing(10)

        self.tb_1 = QTextBrowser()
        self.tb_1.setText(texts.install_text_1)
        self.vbox_part_1.addWidget(self.tb_1)

        self.line_1 = QFrame(self.vbox_main_1)
        self.line_1.setFrameShape(QFrame.HLine)
        self.line_1.setFrameShadow(QFrame.Sunken)
        self.vbox_part_1.addWidget(self.line_1)

        self.hbox_rbs = QHBoxLayout()

        self.label = QLabel(texts.lb_label)
        self.hbox_rbs.addWidget(self.label)

        self.rb_sqlite = QRadioButton('SQLite')
        icon = QIcon()
        icon.addPixmap(QPixmap("images/sqlite.ico"),
                       QIcon.Normal, QIcon.Off)
        self.rb_sqlite.setIcon(icon)
        self.rb_sqlite.setIconSize(QSize(24, 24))
        self.rb_sqlite.setChecked(True)
        self.hbox_rbs.addWidget(self.rb_sqlite)

        self.rb_postgres = QRadioButton('PostgreSQL')
        icon1 = QIcon()
        icon1.addPixmap(QPixmap("images/postgresql-24x24.png"),
                        QIcon.Normal, QIcon.Off)
        self.rb_postgres.setIcon(icon1)
        self.rb_postgres.setIconSize(QSize(24, 24))
        self.hbox_rbs.addWidget(self.rb_postgres)

        self.rb_mysql = QRadioButton('MySQL')
        icon2 = QIcon()
        icon2.addPixmap(QPixmap("images/mysql-24x24.png"),
                        QIcon.Normal, QIcon.Off)
        self.rb_mysql.setIcon(icon2)
        self.rb_mysql.setIconSize(QSize(24, 24))
        self.hbox_rbs.addWidget(self.rb_mysql)
        self.vbox_part_1.addLayout(self.hbox_rbs)

        self.line_2 = QFrame(self.vbox_main_1)
        self.line_2.setFrameShape(QFrame.HLine)
        self.line_2.setFrameShadow(QFrame.Sunken)
        self.vbox_part_1.addWidget(self.line_2)

        self.hbox_pb_next = QHBoxLayout()
        self.hbox_pb_next.setContentsMargins(150, 10, 200, -1)

        self.hbox_pb_next = QHBoxLayout()
        self.hbox_pb_next.setContentsMargins(150, 10, 200, -1)

        self.pb_next = QPushButton()
        self.pb_next.clicked.connect(self.pb_next_clicked)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.pb_next.sizePolicy().hasHeightForWidth())
        self.pb_next.setSizePolicy(sizePolicy)
        self.pb_next.setMaximumSize(QSize(400, 40))
        icon3 = QIcon()
        icon3.addPixmap(QPixmap("images/bt-next-24x24.png"),
                        QIcon.Normal, QIcon.Off)
        self.pb_next.setIcon(icon3)
        self.pb_next.setIconSize(QSize(400, 40))
        self.pb_next.setStyleSheet("background-color: rgb(211, 215, 207);\n"
                                   "alternate-background-color: "
                                   "qradialgradient(spread:repeat, cx:0.5, "
                                   "cy:0.5, radius:0.5, fx:0.5, fy:0.5, "
                                   "stop:0 rgba(184,184,184, 255), "
                                   "stop:.5 rgba(211,211,211, 255), "
                                   "stop:1 rgba(255, 255, 255, 255));")
        self.hbox_pb_next.addWidget(self.pb_next)
        self.vbox_part_1.addLayout(self.hbox_pb_next)

        # Install Part 2
        self.widget_2 = QWidget(self.centralwidget)
        self.widget_2.setGeometry(0, 0, 621, 521)
        self.widget_2.setObjectName("widget_2")
        self.widget_2.setHidden(True)

        self.vbox_main_2 = QWidget(self.widget_2)
        self.vbox_main_2.setGeometry(0, 0, 621, 521)
        self.vbox_main_2.setObjectName("verticalLayoutWidget_2")
        self.vbox_part_2 = QVBoxLayout(self.vbox_main_2)
        self.vbox_part_2.setContentsMargins(20, 20, 20, 20)
        self.vbox_part_2.setSpacing(10)

        self.tb_2 = QTextBrowser()

        self.vbox_part_2.addWidget(self.tb_2)

        self.line_3 = QFrame(self.vbox_main_2)
        self.line_3.setFrameShape(QFrame.HLine)
        self.line_3.setFrameShadow(QFrame.Sunken)
        self.vbox_part_2.addWidget(self.line_3)

        self.fm_part_2 = QFormLayout()
        self.fm_part_2.setSpacing(10)

        self.lb_bd_name = QLabel(texts.lb_db_name)
        self.le_bd_name = QLineEdit('ms_collection')
        self.fm_part_2.setWidget(0, QFormLayout.LabelRole, self.lb_bd_name)
        self.fm_part_2.setWidget(0, QFormLayout.FieldRole, self.le_bd_name)

        self.lb_host = QLabel(texts.lb_host)
        self.le_host = QLineEdit('localhost')
        self.fm_part_2.setWidget(1, QFormLayout.LabelRole, self.lb_host)
        self.fm_part_2.setWidget(1, QFormLayout.FieldRole, self.le_host)

        self.lb_port = QLabel(texts.lb_port)
        self.le_port = QLineEdit()
        self.fm_part_2.setWidget(2, QFormLayout.FieldRole, self.le_port)
        self.fm_part_2.setWidget(2, QFormLayout.LabelRole, self.lb_port)

        self.lb_user = QLabel(texts.lb_user)
        self.le_user = QLineEdit('root')
        self.fm_part_2.setWidget(3, QFormLayout.LabelRole, self.lb_user)
        self.fm_part_2.setWidget(3, QFormLayout.FieldRole, self.le_user)

        self.lb_pw = QLabel(texts.lb_pw)
        self.le_pw = QLineEdit()
        self.fm_part_2.setWidget(4, QFormLayout.LabelRole, self.lb_pw)
        self.fm_part_2.setWidget(4, QFormLayout.FieldRole, self.le_pw)

        self.vbox_part_2.addLayout(self.fm_part_2)

        self.hbox_pb_send = QHBoxLayout()
        spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                             QSizePolicy.Minimum)
        self.hbox_pb_send.addItem(spacer)

        self.pb_ok = QPushButton()
        self.pb_ok.clicked.connect(self.pb_ok_clicked)
        icon3 = QIcon()
        icon3.addPixmap(QPixmap("images/bt-ok-24x24.png"),
                        QIcon.Normal, QIcon.Off)
        self.pb_ok.setIcon(icon3)
        self.pb_ok.setIconSize(QSize(250, 40))
        self.pb_ok.setStyleSheet(
            "background-color: rgb(211, 215, 207); "
            "alternate-background-color: "
            "qradialgradient(spread:repeat, cx:0.5, "
            "cy:0.5, radius:0.5, fx:0.5, fy:0.5, "
            "stop:0 rgba(184,184,184, 255), "
            "stop:.5 rgba(211,211,211, 255), "
            "stop:1 rgba(255, 255, 255, 255));"
        )
        self.hbox_pb_send.addWidget(self.pb_ok)

        self.hbox_pb_send.addItem(spacer)

        self.line_3 = QFrame(self.vbox_main_2)
        self.line_3.setFrameShape(QFrame.HLine)
        self.line_3.setFrameShadow(QFrame.Sunken)

        self.vbox_part_2.addWidget(self.line_3)
        self.vbox_part_2.addLayout(self.hbox_pb_send)
Exemple #52
0
    def _setupUi(self): # has to take place *before* base elements creation
        self.setWindowTitle("moneyGuru")
        self.resize(700, 580)
        self.centralwidget = QWidget(self)
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.topBar = QWidget(self.centralwidget)
        self.horizontalLayout_2 = QHBoxLayout(self.topBar)
        self.horizontalLayout_2.setContentsMargins(2, 0, 2, 0)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.dateRangeSelectorView = DateRangeSelectorView(self.topBar)
        self.dateRangeSelectorView.setMinimumSize(QSize(220, 0))
        self.horizontalLayout_2.addWidget(self.dateRangeSelectorView)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.searchLineEdit = SearchEdit(self.topBar)
        self.searchLineEdit.setMaximumSize(QSize(240, 16777215))
        self.horizontalLayout_2.addWidget(self.searchLineEdit)
        self.verticalLayout.addWidget(self.topBar)
        self.tabBar = TabBarPlus(self.centralwidget)
        self.tabBar.setMinimumSize(QSize(0, 20))
        self.verticalLayout.addWidget(self.tabBar)
        self.mainView = QStackedWidget(self.centralwidget)
        self.verticalLayout.addWidget(self.mainView)

        # Bottom buttons & status label
        self.bottomBar = QWidget(self.centralwidget)
        self.horizontalLayout = QHBoxLayout(self.bottomBar)
        self.horizontalLayout.setContentsMargins(2, 2, 2, 2)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.newItemButton = QPushButton(self.bottomBar)
        buttonSizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        buttonSizePolicy.setHorizontalStretch(0)
        buttonSizePolicy.setVerticalStretch(0)
        buttonSizePolicy.setHeightForWidth(self.newItemButton.sizePolicy().hasHeightForWidth())
        self.newItemButton.setSizePolicy(buttonSizePolicy)
        self.newItemButton.setIcon(QIcon(QPixmap(':/plus_8')))
        self.horizontalLayout.addWidget(self.newItemButton)
        self.deleteItemButton = QPushButton(self.bottomBar)
        self.deleteItemButton.setSizePolicy(buttonSizePolicy)
        self.deleteItemButton.setIcon(QIcon(QPixmap(':/minus_8')))
        self.horizontalLayout.addWidget(self.deleteItemButton)
        self.editItemButton = QPushButton(self.bottomBar)
        self.editItemButton.setSizePolicy(buttonSizePolicy)
        self.editItemButton.setIcon(QIcon(QPixmap(':/info_gray_12')))
        self.horizontalLayout.addWidget(self.editItemButton)
        self.horizontalLayout.addItem(horizontalSpacer(size=20))
        self.graphVisibilityButton = QPushButton()
        self.graphVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.graphVisibilityButton.setIcon(QIcon(QPixmap(':/graph_visibility_on_16')))
        self.horizontalLayout.addWidget(self.graphVisibilityButton)
        self.piechartVisibilityButton = QPushButton()
        self.piechartVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.piechartVisibilityButton.setIcon(QIcon(QPixmap(':/piechart_visibility_on_16')))
        self.horizontalLayout.addWidget(self.piechartVisibilityButton)
        self.columnsVisibilityButton = QPushButton()
        self.columnsVisibilityButton.setSizePolicy(buttonSizePolicy)
        self.columnsVisibilityButton.setIcon(QIcon(QPixmap(':/columns_16')))
        self.horizontalLayout.addWidget(self.columnsVisibilityButton)

        self.statusLabel = QLabel(tr("Status"))
        self.statusLabel.setAlignment(Qt.AlignCenter)
        self.horizontalLayout.addWidget(self.statusLabel)
        self.verticalLayout.addWidget(self.bottomBar)


        self.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 700, 20))
        self.menuFile = QMenu(tr("File"))
        self.menuOpenRecent = QMenu(tr("Open Recent"))
        self.menuView = QMenu(tr("View"))
        self.menuDateRange = QMenu(tr("Date Range"))
        self.menuEdit = QMenu(tr("Edit"))
        self.menuHelp = QMenu(tr("Help"))
        self.setMenuBar(self.menubar)
        self.actionOpenDocument = QAction(tr("Open..."), self)
        self.actionOpenDocument.setShortcut("Ctrl+O")
        self.actionShowNetWorth = QAction(tr("Net Worth"), self)
        self.actionShowNetWorth.setShortcut("Ctrl+1")
        self.actionShowNetWorth.setIcon(QIcon(QPixmap(':/balance_sheet_48')))
        self.actionShowProfitLoss = QAction(escapeamp(tr("Profit & Loss")), self)
        self.actionShowProfitLoss.setShortcut("Ctrl+2")
        self.actionShowProfitLoss.setIcon(QIcon(QPixmap(':/income_statement_48')))
        self.actionShowTransactions = QAction(tr("Transactions"), self)
        self.actionShowTransactions.setShortcut("Ctrl+3")
        self.actionShowTransactions.setIcon(QIcon(QPixmap(':/transaction_table_48')))
        self.actionShowSelectedAccount = QAction(tr("Show Account"), self)
        self.actionShowSelectedAccount.setShortcut("Ctrl+]")
        self.actionNewItem = QAction(tr("New Item"), self)
        self.actionNewItem.setShortcut("Ctrl+N")
        self.actionDeleteItem = QAction(tr("Remove Selected"), self)
        self.actionEditItem = QAction(tr("Show Info"), self)
        self.actionEditItem.setShortcut("Ctrl+I")
        self.actionToggleGraph = QAction(tr("Toggle Graph"), self)
        self.actionToggleGraph.setShortcut("Ctrl+Alt+G")
        self.actionTogglePieChart = QAction(tr("Toggle Pie Chart"), self)
        self.actionTogglePieChart.setShortcut("Ctrl+Alt+P")
        self.actionMoveUp = QAction(tr("Move Up"), self)
        self.actionMoveUp.setShortcut("Ctrl++")
        self.actionMoveDown = QAction(tr("Move Down"), self)
        self.actionMoveDown.setShortcut("Ctrl+-")
        self.actionNavigateBack = QAction(tr("Go Back"), self)
        self.actionNavigateBack.setShortcut("Ctrl+[")
        self.actionNewAccountGroup = QAction(tr("New Account Group"), self)
        self.actionNewAccountGroup.setShortcut("Ctrl+Shift+N")
        self.actionShowNextView = QAction(tr("Next View"), self)
        self.actionShowNextView.setShortcut("Ctrl+Shift+]")
        self.actionShowPreviousView = QAction(tr("Previous View"), self)
        self.actionShowPreviousView.setShortcut("Ctrl+Shift+[")
        self.actionNewDocument = QAction(tr("New Document"), self)
        self.actionImport = QAction(tr("Import..."), self)
        self.actionImport.setShortcut("Ctrl+Alt+I")
        self.actionExport = QAction(tr("Export..."), self)
        self.actionExport.setShortcut("Ctrl+Alt+E")
        self.actionSave = QAction(tr("Save"), self)
        self.actionSave.setShortcut("Ctrl+S")
        self.actionSaveAs = QAction(tr("Save As..."), self)
        self.actionSaveAs.setShortcut("Ctrl+Shift+S")
        self.actionAbout = QAction(tr("About moneyGuru"), self)
        self.actionToggleReconciliationMode = QAction(tr("Toggle Reconciliation Mode"), self)
        self.actionToggleReconciliationMode.setShortcut("Ctrl+Shift+R")
        self.actionToggleAccountExclusion = QAction(tr("Toggle Exclusion Status of Account"), self)
        self.actionToggleAccountExclusion.setShortcut("Ctrl+Shift+X")
        self.actionShowSchedules = QAction(tr("Schedules"), self)
        self.actionShowSchedules.setShortcut("Ctrl+4")
        self.actionShowSchedules.setIcon(QIcon(QPixmap(':/schedules_48')))
        self.actionReconcileSelected = QAction(tr("Reconcile Selection"), self)
        self.actionReconcileSelected.setShortcut("Ctrl+R")
        self.actionMakeScheduleFromSelected = QAction(tr("Make Schedule from Selected"), self)
        self.actionMakeScheduleFromSelected.setShortcut("Ctrl+M")
        self.actionShowPreferences = QAction(tr("Preferences..."), self)
        self.actionPrint = QAction(tr("Print..."), self)
        self.actionPrint.setShortcut("Ctrl+P")
        self.actionQuit = QAction(tr("Quit moneyGuru"), self)
        self.actionQuit.setShortcut("Ctrl+Q")
        self.actionUndo = QAction(tr("Undo"), self)
        self.actionUndo.setShortcut("Ctrl+Z")
        self.actionRedo = QAction(tr("Redo"), self)
        self.actionRedo.setShortcut("Ctrl+Y")
        self.actionShowHelp = QAction(tr("moneyGuru Help"), self)
        self.actionShowHelp.setShortcut("F1")
        self.actionDuplicateTransaction = QAction(tr("Duplicate Transaction"), self)
        self.actionDuplicateTransaction.setShortcut("Ctrl+D")
        self.actionJumpToAccount = QAction(tr("Jump to Account..."), self)
        self.actionJumpToAccount.setShortcut("Ctrl+Shift+A")
        self.actionNewTab = QAction(tr("New Tab"), self)
        self.actionNewTab.setShortcut("Ctrl+T")
        self.actionCloseTab = QAction(tr("Close Tab"), self)
        self.actionCloseTab.setShortcut("Ctrl+W")

        self.menuFile.addAction(self.actionNewDocument)
        self.menuFile.addAction(self.actionNewTab)
        self.menuFile.addAction(self.actionOpenDocument)
        self.menuFile.addAction(self.menuOpenRecent.menuAction())
        self.menuFile.addAction(self.actionImport)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionCloseTab)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSaveAs)
        self.menuFile.addAction(self.actionExport)
        self.menuFile.addAction(self.actionPrint)
        self.menuFile.addAction(self.actionQuit)
        self.menuView.addAction(self.actionShowNetWorth)
        self.menuView.addAction(self.actionShowProfitLoss)
        self.menuView.addAction(self.actionShowTransactions)
        self.menuView.addAction(self.actionShowSchedules)
        self.menuView.addAction(self.actionShowPreviousView)
        self.menuView.addAction(self.actionShowNextView)
        self.menuView.addAction(self.menuDateRange.menuAction())
        self.menuView.addAction(self.actionShowPreferences)
        self.menuView.addAction(self.actionToggleGraph)
        self.menuView.addAction(self.actionTogglePieChart)
        self.menuEdit.addAction(self.actionNewItem)
        self.menuEdit.addAction(self.actionNewAccountGroup)
        self.menuEdit.addAction(self.actionDeleteItem)
        self.menuEdit.addAction(self.actionEditItem)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionMoveUp)
        self.menuEdit.addAction(self.actionMoveDown)
        self.menuEdit.addAction(self.actionDuplicateTransaction)
        self.menuEdit.addAction(self.actionMakeScheduleFromSelected)
        self.menuEdit.addAction(self.actionReconcileSelected)
        self.menuEdit.addAction(self.actionToggleReconciliationMode)
        self.menuEdit.addAction(self.actionToggleAccountExclusion)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionShowSelectedAccount)
        self.menuEdit.addAction(self.actionNavigateBack)
        self.menuEdit.addAction(self.actionJumpToAccount)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionUndo)
        self.menuEdit.addAction(self.actionRedo)
        self.menuHelp.addAction(self.actionShowHelp)
        self.menuHelp.addAction(self.actionAbout)
        mainmenus = [self.menuFile, self.menuEdit, self.menuView, self.menuHelp]
        for menu in mainmenus:
            self.menubar.addAction(menu.menuAction())
            setAccelKeys(menu)
        setAccelKeys(self.menubar)
        self.tabBar.setMovable(True)
        self.tabBar.setTabsClosable(True)
        self.tabBar.setExpanding(False)

        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Right)
        self._shortcutNextTab = QShortcut(seq, self)
        seq = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Left)
        self._shortcutPrevTab = QShortcut(seq, self)
class DifficultyDisplayer(QGraphicsWidget):
    notFocus = pyqtSignal()
    difficultySelected = pyqtSignal(str)

    def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.width = 100
        self.height = 50

        self.diff_menu = DifficultyMenu(self.width, self.height, self)
        self.diff_menu.setY(-self.diff_menu.height)
        self.diff_menu.setVisible(False)

        self.text = "None"

        self.box_pen = QPen()
        self.box_pen.setColor(Qt.white)
        self.pen_width = 3
        self.box_pen.setWidth(self.pen_width)

        self.diff_box = QRectF(0, 0, self.width, self.height)

        self.setMinimumSize(QSizeF(self.width, self.height))
        self.setMaximumSize(QSizeF(self.width, self.height))

        self.size_policy = QSizePolicy(QSizePolicy.Minimum,
                                       QSizePolicy.Minimum)
        self.size_policy.setHeightForWidth(True)
        self.setSizePolicy(self.size_policy)

        self.setAcceptedMouseButtons(Qt.LeftButton)

        self.diff_menu.menuClicked.connect(self.selected_difficulty)
        self.diff_menu.menuClicked.connect(self.difficultySelected.emit)
        self.diff_menu.loseFocus.connect(self.notFocus.emit)

    def set_disabled(self, state):
        if state:
            self.setAcceptedMouseButtons(Qt.NoButton)
        else:
            self.setAcceptedMouseButtons(Qt.LeftButton)

    def paint(self, painter, style, widget=None):
        painter.setPen(self.box_pen)
        painter.drawRect(self.diff_box)
        painter.drawText(self.diff_box, Qt.AlignCenter, self.text)
        painter.drawRect(self.boundingRect())

    def mousePressEvent(self, event):
        if not self.diff_menu.isVisible():
            self.diff_menu.setFocus()
            self.diff_menu.setVisible(True)
        else:
            self.diff_menu.setVisible(False)
            self.notFocus.emit()

    def selected_difficulty(self, string):
        self.diff_menu.setVisible(False)
        self.set_text(string)
        self.notFocus.emit()

    def set_text(self, string):
        self.text = string
        self.update()

    def boundingRect(self):
        return QRectF(0, 0, self.width, self.height)
Exemple #54
0
    def __init__(self):
        """

        :rtype:
        """
        super(FightView, self).__init__()
        self.setObjectName('FightView')

        self.setStyleSheet(GetQssFile.readQss('../resource/qss/fight.qss'))

        # set the size attribute
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)

        self.frame = QFrame(self)
        self.frame.setGeometry(QDesktopWidget().screenGeometry())

        # set main layout
        self.main_layout = QHBoxLayout(self)
        self.main_layout.setContentsMargins(10, 10, 10, 20)
        self.main_layout.setSpacing(10)

        # self.game_widget = EmbeddedWindow()
        self.game_widget = QWidget()
        self.main_layout.addWidget(self.game_widget)

        # set widget of layout
        self.view = QLabel(self)
        self.view.setObjectName('view')
        self.view.setScaledContents(True)
        self.view.setPixmap(QPixmap('../resource/drawable/view.png'))
        self.view.setMinimumSize(600, 700)
        self.main_layout.addWidget(self.view)
        # self.game_widget.add_widget(self.view)

        self.information = QPlainTextEdit(self)
        self.information.setObjectName('information')
        self.information.setPlaceholderText('the output of simulation')
        self.information.setReadOnly(True)
        self.information.setMaximumBlockCount(1000)
        self.information.setLineWrapMode(QPlainTextEdit.WidgetWidth)
        self.information.setFrameShape(QFrame.Panel)
        self.information.setFrameShadow(QFrame.Sunken)
        self.information.setLineWidth(3)
        self.information.setMinimumSize(300, 700)
        self.information.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.information.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.main_layout.addWidget(self.information)

        # set the stretch of two widget
        # self.main_layout.addWidget(self.scroll_area)
        self.main_layout.setStretchFactor(self.view, 3)
        # self.main_layout.setStretchFactor(self.game_widget, 3)
        self.main_layout.setStretchFactor(self.information, 1)

        self.setLayout(self.main_layout)

        # initialization
        self.initUI()
Exemple #55
0
    def initUI(self):
        # Color of needle
        self.setNeedleColor(50, 50, 50, 255)

        # Color of needle hub
        self.setNeedleHubColor(50, 50, 50, 255)

        # Color of gauge values
        self.setGaugeValuesColor(255, 255, 255, 255)

        # Color of LCD value
        self.setDigitalValueColor(255, 255, 255, 255)

        # Gauge needle object
        self.needle = QObject
        self.setNeedleStyle([
            QPolygon([
                QPoint(4, 4),
                QPoint(-4, 4),
                QPoint(-3, -120),
                QPoint(0, -126),
                QPoint(3, -120)
            ])
        ])

        # minimum gauge value
        self.minGaugeValue = 0

        # maximum gauge value
        self.maxGaugeValue = 500

        # current gauge value
        self.gaugeValue = self.minGaugeValue

        # gauge value units
        self.gaugeValueUnits = ''

        # outer radius of gauge
        self.gaugeOuterRadius = 1

        # inner radius of gauge
        self.gaugeInnerRadius = 0.95

        # orientation of gauge
        self.gaugeRotation = 135

        # number of degrees to draw gauge (360 is a complete circle)
        self.gaugeArcAngle = 270

        # number of gauge values
        self.setGaugeValueMajorAxisCount(10)

        # number of ticks between gauge values
        self.gaugeValueMinorAxisCount = 5

        self.pen = QPen(QColor(0, 0, 0))
        self.font = QFont('Decorative', 20)

        self.gaugeColors = []
        self.setGaugeColors([[.00, Qt.red], [.1, Qt.yellow], [.15, Qt.green],
                             [1, Qt.transparent]])

        # gauge value font family and font size
        self.setGaugeValuesEnabled(True)
        self.gaugeValueFont = "Decorative"
        self.initGaugeValueFontSize = 15
        self.gaugeValueFontSize = self.initGaugeValueFontSize

        # digital value font family and font size
        self.digitalValueEnabled = True
        self.digitalValueFontName = "Decorative"
        self.initDigitalValueFontSize = 40
        self.digitalValueUnitsFontSize = 15
        self.digitalValueFontSize = self.initDigitalValueFontSize
        self.digitalValueRadius = 0.7

        self.setGaugeColorBarsEnabled(True)
        self.setGaugeAnnulusFilledEnabled(True)

        self.needleHubEnabled = True
        self.gaugeMinorAxisMarkerEnabled = True
        self.gaugeMajorAxisMarkerEnabled = True

        self.needleSize = 0.8
        self.needleEnabled = True

        self.update()

        self.resizeGauge()

        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QSize(300, 300))
        self.setMaximumSize(QSize(600, 600))
        self.setBaseSize(QSize(300, 300))
Exemple #56
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1010, 754)

        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(
            _fromUtf8("centralwidget"))  # do not change this name
        self.gridLayout = QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.splitter_2 = QSplitter(self.centralwidget)
        self.splitter_2.setOrientation(Qt.Vertical)
        self.splitter_2.setObjectName(_fromUtf8("splitter_2"))

        self.MainTabWidget = QTabWidget(self.splitter_2)
        self.MainTabWidget.setObjectName(_fromUtf8("MainTabWidget"))
        self.ScanTab = QWidget()
        self.ScanTab.setObjectName(_fromUtf8("ScanTab"))
        self.gridLayout_2 = QGridLayout(self.ScanTab)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.splitter = QSplitter(self.ScanTab)
        self.splitter.setOrientation(Qt.Horizontal)
        self.splitter.setObjectName(_fromUtf8("splitter"))

        # size policies
        self.sizePolicy = QSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Expanding)
        self.sizePolicy.setHorizontalStretch(
            0
        )  # this specifies that the widget will keep its width when the window is resized
        self.sizePolicy.setVerticalStretch(0)

        self.sizePolicy2 = QSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Expanding)
        self.sizePolicy2.setHorizontalStretch(
            1
        )  # this specifies that the widget will expand its width when the window is resized
        self.sizePolicy2.setVerticalStretch(0)

        self.setupLeftPanel()
        self.setupRightPanel()
        self.setupMainTabs()
        self.setupBottomPanel()

        self.gridLayout.addWidget(self.splitter_2, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.setupMenuBar(MainWindow)
        self.retranslateUi(MainWindow)
        self.setDefaultIndexes()
        QMetaObject.connectSlotsByName(MainWindow)

    def setupLeftPanel(self):
        self.HostsTabWidget = QTabWidget(self.splitter)
        self.sizePolicy.setHeightForWidth(
            self.HostsTabWidget.sizePolicy().hasHeightForWidth())
        self.HostsTabWidget.setSizePolicy(self.sizePolicy)
        self.HostsTabWidget.setObjectName(_fromUtf8("HostsTabWidget"))

        self.HostsTab = QWidget()
        self.HostsTab.setObjectName(_fromUtf8("HostsTab"))
        self.keywordTextInput = QLineEdit()
        self.FilterApplyButton = QToolButton()
        self.searchIcon = QIcon()
        self.searchIcon.addPixmap(QPixmap(_fromUtf8("./images/search.png")),
                                  QIcon.Normal, QIcon.Off)
        self.FilterApplyButton.setIconSize(QSize(29, 21))
        self.FilterApplyButton.setIcon(self.searchIcon)
        self.FilterAdvancedButton = QToolButton()
        self.advancedIcon = QIcon()
        self.advancedIcon.addPixmap(
            QPixmap(_fromUtf8("./images/advanced.png")), QIcon.Normal,
            QIcon.Off)
        self.FilterAdvancedButton.setIconSize(QSize(19, 19))
        self.FilterAdvancedButton.setIcon(self.advancedIcon)
        self.vlayout = QVBoxLayout(self.HostsTab)
        self.vlayout.setObjectName(_fromUtf8("vlayout"))
        self.HostsTableView = QTableView(self.HostsTab)
        self.HostsTableView.setObjectName(_fromUtf8("HostsTableView"))
        self.vlayout.addWidget(self.HostsTableView)

        self.addHostsOverlay = QTextEdit(
            self.HostsTab
        )  # the overlay widget that appears over the hosttableview
        self.addHostsOverlay.setObjectName(_fromUtf8("addHostsOverlay"))
        self.addHostsOverlay.setText('Click here to add host(s) to scope')
        self.addHostsOverlay.setReadOnly(True)
        self.addHostsOverlay.setContextMenuPolicy(Qt.NoContextMenu)

        ###
        self.addHostsOverlay.setFont(QFont('', 12))
        self.addHostsOverlay.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        ###

        self.vlayout.addWidget(self.addHostsOverlay)
        self.hlayout = QHBoxLayout()
        self.hlayout.addWidget(self.keywordTextInput)
        self.hlayout.addWidget(self.FilterApplyButton)
        self.hlayout.addWidget(self.FilterAdvancedButton)
        self.vlayout.addLayout(self.hlayout)
        self.HostsTabWidget.addTab(self.HostsTab, _fromUtf8(""))

        self.ServicesLeftTab = QWidget()
        self.ServicesLeftTab.setObjectName(_fromUtf8("ServicesLeftTab"))
        self.horizontalLayout_2 = QHBoxLayout(self.ServicesLeftTab)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.ServiceNamesTableView = QTableView(self.ServicesLeftTab)
        self.ServiceNamesTableView.setObjectName(
            _fromUtf8("ServiceNamesTableView"))
        self.horizontalLayout_2.addWidget(self.ServiceNamesTableView)
        self.HostsTabWidget.addTab(self.ServicesLeftTab, _fromUtf8(""))

        self.ToolsTab = QWidget()
        self.ToolsTab.setObjectName(_fromUtf8("ToolsTab"))
        self.horizontalLayout_3 = QHBoxLayout(self.ToolsTab)
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.ToolsTableView = QTableView(self.ToolsTab)
        self.ToolsTableView.setObjectName(_fromUtf8("ToolsTableView"))
        self.horizontalLayout_3.addWidget(self.ToolsTableView)
        self.HostsTabWidget.addTab(self.ToolsTab, _fromUtf8(""))

    def setupRightPanel(self):
        self.ServicesTabWidget = QTabWidget()
        self.ServicesTabWidget.setEnabled(True)
        self.sizePolicy2.setHeightForWidth(
            self.ServicesTabWidget.sizePolicy().hasHeightForWidth())
        self.ServicesTabWidget.setSizePolicy(self.sizePolicy2)
        self.ServicesTabWidget.setObjectName(_fromUtf8("ServicesTabWidget"))
        self.splitter.addWidget(self.ServicesTabWidget)

        ###

        self.splitter_3 = QSplitter()
        self.splitter_3.setOrientation(Qt.Horizontal)
        self.splitter_3.setObjectName(_fromUtf8("splitter_3"))
        self.splitter_3.setSizePolicy(
            self.sizePolicy2
        )  # this makes the tools tab stay the same width when resizing the window

        ###

        self.ToolHostsWidget = QWidget()
        self.ToolHostsWidget.setObjectName(_fromUtf8("ToolHostsTab"))
        self.ToolHostsLayout = QVBoxLayout(self.ToolHostsWidget)
        self.ToolHostsLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.ToolHostsTableView = QTableView(self.ToolHostsWidget)
        self.ToolHostsTableView.setObjectName(_fromUtf8("ServicesTableView"))
        self.ToolHostsLayout.addWidget(self.ToolHostsTableView)
        self.splitter_3.addWidget(self.ToolHostsWidget)

        self.DisplayWidget = QWidget()
        self.DisplayWidget.setObjectName('ToolOutput')
        self.DisplayWidget.setSizePolicy(self.sizePolicy2)
        #self.toolOutputTextView = QTextEdit(self.DisplayWidget)
        self.toolOutputTextView = QPlainTextEdit(self.DisplayWidget)
        self.toolOutputTextView.setReadOnly(True)
        self.DisplayWidgetLayout = QHBoxLayout(self.DisplayWidget)
        self.DisplayWidgetLayout.addWidget(self.toolOutputTextView)
        self.splitter_3.addWidget(self.DisplayWidget)

        self.ScreenshotWidget = ImageViewer()
        self.ScreenshotWidget.setObjectName('Screenshot')
        self.ScreenshotWidget.scrollArea.setSizePolicy(self.sizePolicy2)
        self.ScreenshotWidget.scrollArea.setContextMenuPolicy(
            Qt.CustomContextMenu)
        self.splitter_3.addWidget(self.ScreenshotWidget.scrollArea)

        self.splitter.addWidget(self.splitter_3)

        ###

        self.ServicesRightTab = QWidget()
        self.ServicesRightTab.setObjectName(_fromUtf8("ServicesRightTab"))
        self.verticalLayout = QVBoxLayout(self.ServicesRightTab)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.ServicesTableView = QTableView(self.ServicesRightTab)
        self.ServicesTableView.setObjectName(_fromUtf8("ServicesTableView"))
        self.verticalLayout.addWidget(self.ServicesTableView)
        self.ServicesTabWidget.addTab(self.ServicesRightTab, _fromUtf8(""))

        self.ScriptsTab = QWidget()
        self.ScriptsTab.setObjectName(_fromUtf8("ScriptsTab"))
        self.horizontalLayout_6 = QHBoxLayout(self.ScriptsTab)
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))

        self.splitter_4 = QSplitter(self.ScriptsTab)
        self.splitter_4.setOrientation(Qt.Horizontal)
        self.splitter_4.setObjectName(_fromUtf8("splitter_4"))

        self.ScriptsTableView = QTableView()
        self.ScriptsTableView.setObjectName(_fromUtf8("ScriptsTableView"))
        self.splitter_4.addWidget(self.ScriptsTableView)

        self.ScriptsOutputTextEdit = QPlainTextEdit()
        self.ScriptsOutputTextEdit.setObjectName(
            _fromUtf8("ScriptsOutputTextEdit"))
        self.ScriptsOutputTextEdit.setReadOnly(True)
        self.splitter_4.addWidget(self.ScriptsOutputTextEdit)
        self.horizontalLayout_6.addWidget(self.splitter_4)
        self.ServicesTabWidget.addTab(self.ScriptsTab, _fromUtf8(""))

        self.InformationTab = QWidget()
        self.InformationTab.setObjectName(_fromUtf8("InformationTab"))
        self.ServicesTabWidget.addTab(self.InformationTab, _fromUtf8(""))

        self.NotesTab = QWidget()
        self.NotesTab.setObjectName(_fromUtf8("NotesTab"))
        self.horizontalLayout_4 = QHBoxLayout(self.NotesTab)
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        #self.NotesTextEdit = QTextEdit(self.NotesTab)
        self.NotesTextEdit = QPlainTextEdit(self.NotesTab)
        self.NotesTextEdit.setObjectName(_fromUtf8("NotesTextEdit"))
        self.horizontalLayout_4.addWidget(self.NotesTextEdit)
        self.ServicesTabWidget.addTab(self.NotesTab, _fromUtf8(""))

    def setupMainTabs(self):
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
        self.gridLayout_3 = QGridLayout()
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.gridLayout_2.addLayout(self.gridLayout_3, 0, 0, 1, 1)
        self.MainTabWidget.addTab(self.ScanTab, _fromUtf8(""))

        self.BruteTab = QWidget()
        self.BruteTab.setObjectName(_fromUtf8("BruteTab"))
        self.horizontalLayout_7 = QHBoxLayout(self.BruteTab)
        self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
        self.BruteTabWidget = QTabWidget(self.BruteTab)
        self.BruteTabWidget.setObjectName(_fromUtf8("BruteTabWidget"))
        self.horizontalLayout_7.addWidget(self.BruteTabWidget)
        self.MainTabWidget.addTab(self.BruteTab, _fromUtf8(""))

    def setupBottomPanel(self):
        self.BottomTabWidget = QTabWidget(self.splitter_2)
        self.BottomTabWidget.setSizeIncrement(QSize(0, 0))
        self.BottomTabWidget.setBaseSize(QSize(0, 0))
        self.BottomTabWidget.setObjectName(_fromUtf8("BottomTabWidget"))

        self.LogTab = QWidget()
        self.LogTab.setObjectName(_fromUtf8("LogTab"))
        self.horizontalLayout_5 = QHBoxLayout(self.LogTab)
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.ProcessesTableView = QTableView(self.LogTab)
        self.ProcessesTableView.setObjectName(_fromUtf8("ProcessesTableView"))
        self.horizontalLayout_5.addWidget(self.ProcessesTableView)
        self.BottomTabWidget.addTab(self.LogTab, _fromUtf8(""))


#       self.TerminalTab = QWidget()
#       self.TerminalTab.setObjectName(_fromUtf8("TerminalTab"))
#       self.BottomTabWidget.addTab(self.TerminalTab, _fromUtf8(""))
#       self.PythonTab = QWidget()
#       self.PythonTab.setObjectName(_fromUtf8("PythonTab"))
#       self.BottomTabWidget.addTab(self.PythonTab, _fromUtf8(""))

    def setupMenuBar(self, MainWindow):
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 1010, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuFile = QMenu(self.menubar)
        self.menuFile.setObjectName(_fromUtf8("menuFile"))
        #       self.menuEdit = QMenu(self.menubar)
        #       self.menuEdit.setObjectName(_fromUtf8("menuEdit"))
        #        self.menuSettings = QMenu(self.menubar)
        #        self.menuSettings.setObjectName(_fromUtf8("menuSettings"))
        self.menuHelp = QMenu(self.menubar)
        self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName(_fromUtf8("actionExit"))
        self.actionOpen = QAction(MainWindow)
        self.actionOpen.setObjectName(_fromUtf8("actionOpen"))
        self.actionSave = QAction(MainWindow)
        self.actionSave.setObjectName(_fromUtf8("actionSave"))
        self.actionImportNmap = QAction(MainWindow)
        self.actionImportNmap.setObjectName(_fromUtf8("actionImportNmap"))
        self.actionSaveAs = QAction(MainWindow)
        self.actionSaveAs.setObjectName(_fromUtf8("actionSaveAs"))
        self.actionNew = QAction(MainWindow)
        self.actionNew.setObjectName(_fromUtf8("actionNew"))
        self.actionAddHosts = QAction(MainWindow)
        self.actionAddHosts.setObjectName(_fromUtf8("actionAddHosts"))
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSaveAs)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionAddHosts)
        self.menuFile.addAction(self.actionImportNmap)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menubar.addAction(self.menuFile.menuAction())
        #       self.menubar.addAction(self.menuEdit.menuAction())
        #       self.menubar.addAction(self.menuSettings.menuAction())
        #        self.menubar.addAction(self.menuSettings.menuAction())
        #        self.actionSettings = QAction(MainWindow)
        #        self.actionSettings.setObjectName(_fromUtf8("getSettingsMenu"))
        #        self.menuSettings.addAction(self.actionSettings)

        self.actionHelp = QAction(MainWindow)
        self.actionHelp.setObjectName(_fromUtf8("getHelp"))
        self.menuHelp.addAction(self.actionHelp)
        self.menubar.addAction(self.menuHelp.menuAction())

    def setDefaultIndexes(self):
        self.MainTabWidget.setCurrentIndex(1)
        self.HostsTabWidget.setCurrentIndex(1)
        self.ServicesTabWidget.setCurrentIndex(1)
        self.BruteTabWidget.setCurrentIndex(1)
        self.BottomTabWidget.setCurrentIndex(0)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            QApplication.translate("MainWindow", "SPARTA 2.0", None))
        self.HostsTabWidget.setTabText(
            self.HostsTabWidget.indexOf(self.HostsTab),
            QApplication.translate("MainWindow", "Hosts", None))
        self.HostsTabWidget.setTabText(
            self.HostsTabWidget.indexOf(self.ServicesLeftTab),
            QApplication.translate("MainWindow", "Services", None))
        self.HostsTabWidget.setTabText(
            self.HostsTabWidget.indexOf(self.ToolsTab),
            QApplication.translate("MainWindow", "Tools", None))
        self.ServicesTabWidget.setTabText(
            self.ServicesTabWidget.indexOf(self.ServicesRightTab),
            QApplication.translate("MainWindow", "Services", None))
        self.ServicesTabWidget.setTabText(
            self.ServicesTabWidget.indexOf(self.ScriptsTab),
            QApplication.translate("MainWindow", "Scripts", None))
        self.ServicesTabWidget.setTabText(
            self.ServicesTabWidget.indexOf(self.InformationTab),
            QApplication.translate("MainWindow", "Information", None))
        self.ServicesTabWidget.setTabText(
            self.ServicesTabWidget.indexOf(self.NotesTab),
            QApplication.translate("MainWindow", "Notes", None))
        #       self.ServicesTabWidget.setTabText(self.ServicesTabWidget.indexOf(self.ScreenshotsTab), QApplication.translate("MainWindow", "Screenshots", None))
        self.MainTabWidget.setTabText(
            self.MainTabWidget.indexOf(self.ScanTab),
            QApplication.translate("MainWindow", "Scan", None))
        #self.BruteTabWidget.setTabText(self.BruteTabWidget.indexOf(self.tab), QApplication.translate("MainWindow", "Tab 1", None))
        #self.BruteTabWidget.setTabText(self.BruteTabWidget.indexOf(self.tab_2), QApplication.translate("MainWindow", "Tab 2", None))
        self.MainTabWidget.setTabText(
            self.MainTabWidget.indexOf(self.BruteTab),
            QApplication.translate("MainWindow", "Brute", None))
        self.BottomTabWidget.setTabText(
            self.BottomTabWidget.indexOf(self.LogTab),
            QApplication.translate("MainWindow", "Log", None))
        #       self.BottomTabWidget.setTabText(self.BottomTabWidget.indexOf(self.TerminalTab), QApplication.translate("MainWindow", "Terminal", None))
        #       self.BottomTabWidget.setTabText(self.BottomTabWidget.indexOf(self.PythonTab), QApplication.translate("MainWindow", "Python", None))
        self.menuFile.setTitle(
            QApplication.translate("MainWindow", "File", None))
        #       self.menuEdit.setTitle(QApplication.translate("MainWindow", "Edit", None))
        #       self.menuSettings.setTitle(QApplication.translate("MainWindow", "Settings", None))
        self.menuHelp.setTitle(
            QApplication.translate("MainWindow", "Help", None))
        self.actionExit.setText(
            QApplication.translate("MainWindow", "Exit", None))
        self.actionExit.setToolTip(
            QApplication.translate("MainWindow", "Exit the application", None))
        self.actionExit.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+Q", None))
        self.actionOpen.setText(
            QApplication.translate("MainWindow", "Open", None))
        self.actionOpen.setToolTip(
            QApplication.translate("MainWindow",
                                   "Open an existing project file", None))
        self.actionOpen.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+O", None))
        self.actionSave.setText(
            QApplication.translate("MainWindow", "Save", None))
        self.actionSave.setToolTip(
            QApplication.translate("MainWindow", "Save the current project",
                                   None))
        self.actionSave.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+S", None))
        self.actionImportNmap.setText(
            QApplication.translate("MainWindow", "Import nmap", None))
        self.actionImportNmap.setToolTip(
            QApplication.translate("MainWindow", "Import an nmap xml file",
                                   None))
        self.actionImportNmap.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+I", None))
        self.actionSaveAs.setText(
            QApplication.translate("MainWindow", "Save As", None))
        self.actionNew.setText(
            QApplication.translate("MainWindow", "New", None))
        self.actionNew.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+N", None))
        self.actionAddHosts.setText(
            QApplication.translate("MainWindow", "Add host(s) to scope", None))
        self.actionAddHosts.setShortcut(
            QApplication.translate("MainWindow", "Ctrl+H", None))
        #self.actionSettings.setText(QApplication.translate("MainWindow", "Preferences", None))
        self.actionHelp.setText(
            QApplication.translate("MainWindow", "Help", None))
        self.actionHelp.setShortcut(
            QApplication.translate("MainWindow", "F1", None))
    def initUI(self):

        self.setStyleSheet(qdarkstyle.load_stylesheet())

        self.horizontalLayout = QHBoxLayout()
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setSizeConstraint(QLayout.SetDefaultConstraint)
        self.verticalLayout.setSpacing(6)
        self.gridLayout = QGridLayout()

        self.imageLabel = QLabel()
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.imageLabel.sizePolicy().hasHeightForWidth())
        self.imageLabel.setSizePolicy(sizePolicy)
        self.imageLabel.setMinimumSize(QSize(200, 130))
        self.imageLabel.setMaximumSize(QSize(200, 130))
        self.imageLabel.setPixmap(
            QPixmap("./Arduino/logo/CUAtHomeLogo-Horz.png").scaled(
                200, 130, Qt.KeepAspectRatio, Qt.FastTransformation))
        self.verticalLayout.addWidget(self.imageLabel)

        self.startbutton = QPushButton("Start", self)
        self.startbutton.setCheckable(False)
        self.startbutton.clicked.connect(self.startbutton_pushed)
        self.startbutton.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.startbutton, 0, 0, 1, 1)

        self.stopbutton = QPushButton("Stop", self)
        self.stopbutton.setCheckable(False)
        self.stopbutton.clicked.connect(self.stopbutton_pushed)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.stopbutton.sizePolicy().hasHeightForWidth())
        self.stopbutton.setSizePolicy(sizePolicy)
        self.stopbutton.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.stopbutton, 0, 1, 1, 1)

        self.clearbutton = QPushButton("Clear", self)
        self.clearbutton.setCheckable(False)
        self.clearbutton.clicked.connect(self.clearbutton_pushed)
        self.clearbutton.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.clearbutton, 1, 0, 1, 1)

        self.savebutton = QPushButton("Save", self)
        self.savebutton.setCheckable(False)
        self.savebutton.clicked.connect(self.savebutton_pushed)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.savebutton.sizePolicy().hasHeightForWidth())
        self.savebutton.setSizePolicy(sizePolicy)
        self.savebutton.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.savebutton, 1, 1, 1, 1)

        self.settings = QPushButton("Settings", self)
        self.settings.clicked.connect(self.settingsMenu)
        self.settings.setMaximumSize(QSize(300, 20))
        self.gridLayout.addWidget(self.settings, 2, 0, 1, 2)

        self.checkBoxShowAll = QCheckBox("Show All Plots", self)
        self.checkBoxShowAll.setMaximumSize(QSize(100, 20))
        self.checkBoxShowAll.setChecked(True)
        self.checkBoxShowAll.toggled.connect(self.visibilityAll)
        self.gridLayout.addWidget(self.checkBoxShowAll, 3, 0, 1, 1)

        self.checkBoxHideAll = QCheckBox("Hide All Plots", self)
        self.checkBoxHideAll.setChecked(False)
        self.checkBoxHideAll.toggled.connect(self.hideAll)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.checkBoxHideAll.sizePolicy().hasHeightForWidth())
        self.checkBoxHideAll.setSizePolicy(sizePolicy)
        self.checkBoxHideAll.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.checkBoxHideAll, 3, 1, 1, 1)

        self.checkBoxPlot1 = QCheckBox("Plot 1", self)
        self.checkBoxPlot1.toggled.connect(self.visibility1)
        self.checkBoxPlot1.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.checkBoxPlot1, 4, 0, 1, 1)

        self.checkBoxPlot2 = QCheckBox("Plot 2", self)
        self.checkBoxPlot2.toggled.connect(self.visibility2)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.checkBoxPlot2.sizePolicy().hasHeightForWidth())
        self.checkBoxPlot2.setSizePolicy(sizePolicy)
        self.checkBoxPlot2.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.checkBoxPlot2, 4, 1, 1, 1)

        self.checkBoxShowAll.stateChanged.connect(self.checkbox_logic)
        self.checkBoxHideAll.stateChanged.connect(self.checkbox_logic)
        self.checkBoxPlot1.stateChanged.connect(self.checkbox_logic)
        self.checkBoxPlot2.stateChanged.connect(self.checkbox_logic)

        self.PowerScalingLabel = QLabel("Power Scaling (%)", self)
        self.PowerScalingLabel.setMinimumSize(QSize(100, 20))
        self.PowerScalingLabel.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.PowerScalingLabel, 7, 0, 1, 1)
        self.PowerScalingInput = QLineEdit("", self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.PowerScalingInput.sizePolicy().hasHeightForWidth())
        self.PowerScalingInput.setSizePolicy(sizePolicy)
        self.PowerScalingInput.setMaximumSize(QSize(100, 20))
        #self.PowerScalingInput.setValidator(QRegExpValidator(QRegExp("^[0-9][0-9]?$|^100$"))) #0-1 as a float FIX THIS
        self.gridLayout.addWidget(self.PowerScalingInput, 7, 1, 1, 1)

        self.FrequencyLabel = QLabel("Frequency (Hz)", self)
        self.FrequencyLabel.setMinimumSize(QSize(100, 20))
        self.FrequencyLabel.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.FrequencyLabel, 8, 0, 1, 1)
        self.FrequencyInput = QLineEdit("", self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.FrequencyInput.sizePolicy().hasHeightForWidth())
        self.FrequencyInput.setSizePolicy(sizePolicy)
        self.FrequencyInput.setMaximumSize(QSize(100, 20))
        self.FrequencyInput.setValidator(QDoubleValidator())
        self.gridLayout.addWidget(self.FrequencyInput, 8, 1, 1, 1)

        PID_validator = QDoubleValidator(
            0.0000, 50.000, 4, notation=QDoubleValidator.StandardNotation)

        self.PCheckBox = QCheckBox("P", self)
        self.PCheckBox.setMaximumSize(QSize(100, 20))
        self.PCheckBox.setChecked(True)
        self.PCheckBox.toggled.connect(self.PCheckBoxLogic)
        self.gridLayout.addWidget(self.PCheckBox, 9, 0, 1, 1)
        self.PInput = QLineEdit("", self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.PInput.sizePolicy().hasHeightForWidth())
        self.PInput.setSizePolicy(sizePolicy)
        self.PInput.setMaximumSize(QSize(100, 20))
        self.PInput.setValidator(PID_validator)
        self.gridLayout.addWidget(self.PInput, 9, 1, 1, 1)

        self.ICheckBox = QCheckBox("I", self)
        self.ICheckBox.setMaximumSize(QSize(100, 20))
        self.ICheckBox.setChecked(True)
        self.ICheckBox.toggled.connect(self.ICheckBoxLogic)
        self.gridLayout.addWidget(self.ICheckBox, 10, 0, 1, 1)
        self.IInput = QLineEdit("", self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.IInput.sizePolicy().hasHeightForWidth())
        self.IInput.setSizePolicy(sizePolicy)
        self.IInput.setMaximumSize(QSize(100, 20))
        self.IInput.setValidator(PID_validator)
        self.gridLayout.addWidget(self.IInput, 10, 1, 1, 1)

        self.DCheckBox = QCheckBox("D", self)
        self.DCheckBox.setMaximumSize(QSize(100, 20))
        self.DCheckBox.setChecked(True)
        self.DCheckBox.toggled.connect(self.DCheckBoxLogic)
        self.gridLayout.addWidget(self.DCheckBox, 11, 0, 1, 1)
        self.DInput = QLineEdit("", self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.DInput.sizePolicy().hasHeightForWidth())
        self.DInput.setSizePolicy(sizePolicy)
        self.DInput.setMaximumSize(QSize(100, 20))
        self.DInput.setValidator(PID_validator)
        self.gridLayout.addWidget(self.DInput, 11, 1, 1, 1)

        self.LabType = QComboBox()
        self.LabType.addItems(["Position", "Speed"])
        #self.LabType.activated.connect(self.getLabType)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.LabType.sizePolicy().hasHeightForWidth())
        self.LabType.setSizePolicy(sizePolicy)
        self.LabType.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.LabType, 5, 1, 1, 1)
        self.LabLabel = QLabel("Lab Type")
        self.LabLabel.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.LabLabel, 5, 0, 1, 1)

        self.inputForms = QComboBox()
        self.inputForms.addItems(["Sine", "Step"])
        self.inputForms.activated.connect(self.getInput)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.inputForms.sizePolicy().hasHeightForWidth())
        self.inputForms.setSizePolicy(sizePolicy)
        self.inputForms.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.inputForms, 6, 1, 1, 1)
        self.inputType = QLabel("Input Type")
        self.inputType.setMaximumSize(QSize(100, 20))
        self.gridLayout.addWidget(self.inputType, 6, 0, 1, 1)

        self.verticalLayout.addLayout(self.gridLayout)
        spacerItem = QSpacerItem(20, 80, QSizePolicy.Minimum,
                                 QSizePolicy.Fixed)
        self.verticalLayout.addItem(spacerItem)

        #What is this?

        self.label = QLabel()
        self.label.setMaximumSize(QSize(200, 130))
        self.label.setText("")
        self.verticalLayout.addWidget(self.label)

        self.horizontalLayout.addLayout(self.verticalLayout)
        self.rightVerticalLayout = QVBoxLayout()

        self.graphWidgetOutput = PlotWidget()
        self.graphWidgetInput = PlotWidget()

        #Adds grid lines
        self.graphWidgetOutput.showGrid(x=True, y=True, alpha=None)
        self.graphWidgetInput.showGrid(x=True, y=True, alpha=None)

        #self.graphWidget.setXRange(0, 100, padding=0) #Doesn't move with the plot. Can drag around
        #self.graphWidget.setLimits(xMin=0, xMax=100)#, yMin=c, yMax=d) #Doesn't move with the plot. Cannot drag around

        #self.graphWidget.setYRange(0, 4, padding=0)
        self.graphWidgetOutput.setYRange(-11, 11, padding=0)
        self.graphWidgetOutput.enableAutoRange()
        self.graphWidgetInput.setYRange(-11, 11, padding=0)
        self.graphWidgetInput.enableAutoRange()

        #Changes background color of graph
        self.graphWidgetOutput.setBackground((0, 0, 0))
        self.graphWidgetInput.setBackground((0, 0, 0))

        #Adds a legend after data starts to plot NOT before
        self.graphWidgetOutput.addLegend()

        #Adds title to graphs
        self.graphWidgetOutput.setTitle("Response", color="w", size="12pt")
        self.graphWidgetInput.setTitle("PWM Actuation Signal",
                                       color="w",
                                       size="12pt")

        self.rightVerticalLayout.addWidget(self.graphWidgetOutput)
        self.rightVerticalLayout.addWidget(self.graphWidgetInput)
        self.horizontalLayout.addLayout(self.rightVerticalLayout)

        self.setLayout(self.horizontalLayout)

        #Plot time update settings
        self.timer = QTimer()
        self.timer.setInterval(
            50
        )  #Changes the plot speed. Defaulted to 50. Can be placed in startbutton_pushed() method
        self.initialState()
        time.sleep(2)
        try:
            self.timer.timeout.connect(self.update)
        except:
            raise Exception("Not Connected")
class Canvas(QWidget):
    def __init__(self,
                 images: list,
                 nStimuli: int,
                 imageWidth: int,
                 nrow: int,
                 ncol: int,
                 conditions: list,
                 conditionOrder: list,
                 nTrials: int,
                 useCustomTimer: bool = False,
                 trialTimeOut: int = 10000,
                 addNoise=True,
                 customCalibration: bool = False,
                 customCalibrationSize: int = 20,
                 fixationCrossSize=20,
                 fixationCrossMs=3000,
                 driftToleranceDeg=2.0,
                 inTrainingMode=False,
                 left: int = 50,
                 top: int = 50,
                 width: int = 2560,
                 height: int = 1440):

        super().__init__()
        # Set window params
        self.title = 'Copying task'
        self.left = left
        self.top = top
        self.width = width
        self.height = height

        self.sizePolicy = QSizePolicy(QSizePolicy.Preferred,
                                      QSizePolicy.Preferred)
        self.sizePolicy.setHeightForWidth(True)
        self.setSizePolicy(self.sizePolicy)
        self.styleStr = "background-color:transparent"

        # Set stimuli params
        self.nStimuli = nStimuli
        self.allImages = images
        self.images = None
        self.shuffledImages = None

        self.imageWidth = imageWidth
        self.nrow = nrow
        self.ncol = ncol

        # Set experiment params
        self.nTrials = nTrials
        self.conditions = conditions
        self.nConditions = len(conditions)
        self.conditionOrder = conditionOrder

        self.currentTrial = 1
        self.conditionOrderIndex = 0
        self.currentConditionIndex = self.conditionOrder[
            self.conditionOrderIndex]

        self.useCustomTimer = useCustomTimer
        self.visibleTime = 0
        self.occludedTime = 0
        self.backCrossing = False
        self.backCrossStart = 0
        self.possibleBlinkStart = None

        self.addNoise = addNoise
        self.trialTimeOut = trialTimeOut

        self.customCalibration = customCalibration
        self.customCalibrationSize = customCalibrationSize
        self.fixationCrossSize = fixationCrossSize
        self.fixationCrossMs = fixationCrossMs
        self.driftToleranceDeg = driftToleranceDeg

        self.spacePushed = False

        # Set tracking vars
        self.timer = QTimer(self)
        self.fixTimer = QTimer()
        self.fixTimer2 = QTimer()
        self.mouse = QCursor()
        self.dragStartTime = None
        self.dragStartPosition = None
        self.lastNow = 0

        self.mean_error, self.sd_error = 0, 0
        self.inTrainingMode = inTrainingMode

        # Track correct placements
        self.correctPlacements = pd.DataFrame(columns=[
            'x', 'y', 'Name', 'shouldBe', 'Correct', 'Time', 'dragDuration',
            'dragDistance', 'Trial', 'Condition', 'visibleTime', 'cameFromX',
            'cameFromY'
        ])

        self.mouseTrackerDict = {
            key: []
            for key in ['x', 'y', 'Time', 'TrackerTime', 'Trial', 'Condition']
        }

        self.eventTracker = pd.DataFrame(columns=[
            'Time', 'TrackerTime', 'TimeDiff', 'Event', 'Condition', 'Trial'
        ])

        self.projectFolder = Path(__file__).parent

        self.ppNumber = None
        self.setParticipantNumber()

        self.disp = None
        self.tracker = None
        self.recordingSession = 0

        self.inOpeningScreen = True
        self.inFixationScreen = False
        self.initUI()

    # =============================================================================
    # TRACKING FUNCTIONS
    # =============================================================================
    def setParticipantNumber(self):
        # Get input
        number = input('Enter participant number or name:\n')

        # If input is none, try again (recursively)
        if len(number) < 1 or number is None:
            print('Invalid input, try again')
            self.setParticipantNumber()

        # Read already used numbers
        with open(self.projectFolder / 'results/usedNumbers.txt', 'r') as f:
            usedNumbers = json.load(f)

        # If not in use, save and return
        if number not in usedNumbers:
            self.ppNumber = number
            usedNumbers.append(number)

            with open(self.projectFolder / 'results/usedNumbers.txt',
                      'w') as f:
                json.dump(usedNumbers, f)

            # Make dedicated folder for this person
            if not str(self.ppNumber) in os.listdir(
                    self.projectFolder / 'results'):
                os.mkdir(self.projectFolder / f'results/{self.ppNumber}')

            return

        # If already in use, recursively run again
        else:
            print(f'{number} is already in use! Use another number or name')
            self.setParticipantNumber()

    def writeCursorPosition(self, now):
        e = self.mouse.pos()

        self.mouseTrackerDict['x'].append(e.x())
        self.mouseTrackerDict['y'].append(e.y())
        self.mouseTrackerDict['Time'].append(now)
        self.mouseTrackerDict['TrackerTime'].append(self.getTrackerClock())
        self.mouseTrackerDict['Trial'].append(self.currentTrial)
        self.mouseTrackerDict['Condition'].append(self.currentConditionIndex)

    def defaultTimer(self, now):
        # Use default. None means no update, otherwise flip
        if self.exampleGridBox.isVisible():
            if now - self.start >= self.visibleTime:
                self.start = now
                return 'hide', 'show'
        else:
            if now - self.start >= self.occludedTime:
                self.start = now
                return 'show', 'hide'

        return None, None

    def updateTimer(self):
        if self.inOpeningScreen:
            return

        now = round(time.time() * 1000)

        # Only write cursor every 2 ms
        if ((now % 2) == 0) and (now != self.lastNow):
            self.writeCursorPosition(now)
            self.lastNow = now

        # Check for timeout
        if now - self.globalTrialStart >= self.trialTimeOut:
            self.checkIfFinished(timeOut=True)
            return

        # Check if update necessary with custom timer
        if self.useCustomTimer:
            gridInstruction, hourglassInstruction = customTimer(self, now)
        else:
            gridInstruction, hourglassInstruction = self.defaultTimer(now)

        self.showHideExampleGrid(gridInstruction)
        self.showHideHourGlass(hourglassInstruction)

        # Check if result needs checking, every 200ms to avoid too much processing
        if now - self.checkIfFinishedStart >= 500:
            self.checkIfFinished()
            self.checkIfFinishedStart = now

    def runTimer(self):
        self.timer.setInterval(1)  # 1 ms
        self.timer.timeout.connect(self.updateTimer)

        # Unfortunately we need three tracking vars to keep updates not too time-consuming
        self.start = round(time.time() * 1000)
        self.globalTrialStart = self.start
        self.checkIfFinishedStart = self.start

        self.crossingStart = None

        self.timer.start()

    def disconnectTimer(self):
        try:
            self.timer.stop()
        except AttributeError:
            pass  # Happens if the timer has never been started yet

    def getTrackerClock(self):
        try:
            trackerClock = self.tracker.get_eyelink_clock()
        except Exception:
            trackerClock = 0

        return trackerClock

    def writeEvent(self, msg):
        trackerClock = self.getTrackerClock()

        localTime = round(time.time() * 1000)
        timeDiff = localTime - trackerClock

        event = pd.DataFrame(
            {
                'Time': localTime,
                'TrackerTime': trackerClock,
                'TimeDiff': timeDiff,
                'Event': msg,
                'Condition': self.currentConditionIndex,
                'Trial': self.currentTrial
            },
            index=[0])
        self.eventTracker = self.eventTracker.append(event, ignore_index=True)

    def writeFiles(self):
        self.correctPlacements.to_csv(
            self.projectFolder /
            f'results/{self.ppNumber}/{self.ppNumber}-correctPlacements.csv')
        self.eventTracker.to_csv(
            self.projectFolder /
            f'results/{self.ppNumber}/{self.ppNumber}-eventTracking.csv')

    def writeMouseTracker(self):
        mouseTrackerDF = pd.DataFrame(self.mouseTrackerDict)
        mouseTrackerDF.to_csv(
            self.projectFolder /
            f'results/{self.ppNumber}/{self.ppNumber}-mouseTracking-condition{self.currentConditionIndex}-trackingSession-{self.recordingSession}.csv'
        )

        self.mouseTrackerDict = {
            key: []
            for key in ['x', 'y', 'Time', 'TrackerTime', 'Trial', 'Condition']
        }

    def checkIfFinished(self, timeOut=False):
        copiedTemp = self.correctPlacements.loc[self.correctPlacements['Trial']
                                                == self.currentTrial]
        copiedTemp = copiedTemp.loc[copiedTemp['Condition'] ==
                                    self.currentConditionIndex]

        allCorrect = np.all(copiedTemp['Correct'].values)

        if (len(copiedTemp) > 0 and allCorrect) or timeOut:
            self.writeEvent('Finished trial')

            self.clearScreen()

            self.writeFiles()
            self.currentTrial += 1

            self.initOpeningScreen(timeOut)

    def showHideHourGlass(self, specific=None):
        text = None

        if specific is None:
            return

        elif specific == 'show':
            if not self.hourGlass.isVisible():
                self.hourGlass.setVisible(True)
                text = 'Showing'

        elif specific == 'hide':
            if self.hourGlass.isVisible():
                self.hourGlass.setVisible(False)
                text = 'Hiding'

        elif specific == 'flip':
            if self.hourGlass.isVisible():
                self.hourGlass.setVisible(False)
                text = 'Hiding'
            else:
                self.hourGlass.setVisible(True)
                text = 'Showing'

        else:
            raise ValueError(
                f"{specific} is not an accepted keyword for 'showHideHourGlass'."
                + "Choose from: None, 'show', 'hide', 'flip'.")

        if text is not None:
            self.writeEvent(f'{text} hourglass')

    def showHideExampleGrid(self, specific=None):
        text = None

        if specific is None:
            return

        elif specific == 'show':
            if not self.exampleGridBox.isVisible():
                self.exampleGridBox.setVisible(True)
                text = 'Showing'

        elif specific == 'hide':
            if self.exampleGridBox.isVisible():
                self.exampleGridBox.setVisible(False)
                text = 'Hiding'

        elif specific == 'flip':
            if self.exampleGridBox.isVisible():
                self.exampleGridBox.setVisible(False)
                text = 'Hiding'
            else:
                self.exampleGridBox.setVisible(True)
                text = 'Showing'

        else:
            raise ValueError(
                f"{specific} is not an accepted keyword for 'showHideExamplegrid'."
                + "Choose from: None, 'show', 'hide', 'flip'.")

        if text is not None:
            self.writeEvent(f'{text} grid')

    def moveAndRenameTrackerFile(self):
        fromLocation = self.projectFolder / 'default.edf'
        toLocation = self.projectFolder / f'results/{self.ppNumber}/{self.ppNumber}-trackingSession-{self.recordingSession}.edf'
        os.rename(Path(fromLocation), Path(toLocation))

        self.writeMouseTracker()

        self.writeEvent(f'Writing eyetracker session {self.recordingSession}')

        print(f'Saved session {self.recordingSession} to {toLocation}')

    def custom_calibration(self, x, y):
        self.screen = libscreen.Screen()

        self.screen.draw_circle(colour='black',
                                pos=(x, y),
                                r=self.customCalibrationSize,
                                fill=True)
        self.disp.fill(self.screen)

        self.disp.show()

    def eventFilter(self, widget, e):
        if e.type() == QtCore.QEvent.KeyPress:
            key = e.key()

            # Retry the fixation cross with key 'r'
            if key == QtCore.Qt.Key_R and self.inFixationScreen:
                self.clearScreen()
                self.initTask()

            if key == QtCore.Qt.Key_Space and not self.spacePushed:

                # Set spacePushed to true and remove all widgets
                self.spacePushed = True
                self.clearScreen()

                # Start the task
                if self.inOpeningScreen:
                    self.initTask()
                elif self.inFixationScreen:
                    self.continueInitTask()

                return True

            elif key == QtCore.Qt.Key_Backspace:
                print('Backspace pressed')

                self.clearScreen()

                # Try to close the eyetracker
                try:
                    self.tracker.stop_recording()
                    self.tracker.close(full_close=False)
                    self.moveAndRenameTrackerFile()
                    self.disp = None
                    self.tracker = None

                except Exception as e:
                    # There is no recording to stop
                    print(e)

                # Go into calibration
                if self.disp is None:
                    # Program crashes if both pygaze and this want to use fullscreen, so maximize instead of FS
                    self.showMaximized()

                    self.disp = libscreen.Display()
                    self.tracker = EyeTracker(self.disp)

                    if self.customCalibration:
                        self.tracker.set_draw_calibration_target_func(
                            self.custom_calibration)

                    self.tracker.calibrate()
                    self.disp.close()

                    self.showFullScreen()

                    # When done, start recording and init task
                    self.recordingSession += 1
                    self.tracker.start_recording()

                    # Get the async between tracker and os
                    async_val = self.tracker._get_eyelink_clock_async()
                    self.writeEvent(f'Async {async_val}')

                time.sleep(1)
                self.initOpeningScreen()

                return True

            # Trigger early exit
            elif key == QtCore.Qt.Key_Tab:
                try:
                    self.tracker.stop_recording()
                    self.tracker.close(full_close=True)
                    self.moveAndRenameTrackerFile()
                except Exception as e:
                    print(e)

                self.writeEvent('Early exit')

                self.writeFiles()

                self.close()
                print('\nEarly exit')
                raise SystemExit(0)

        return QWidget.eventFilter(self, widget, e)

    def setConditionTiming(self):
        # Try to retrieve condition timing. If index out of range (IndexError), conditions are exhausted.
        # visibleTime and occludedTime are pulled from conditions, and assigned to class after mutation has been done
        try:
            visibleTime, occludedTime = self.getConditionTiming()
        except IndexError as e:
            try:
                self.tracker.stop_recording()
                self.tracker.close(full_close=True)
                self.moveAndRenameTrackerFile()
            except AttributeError as ae:
                print(ae)

            self.writeEvent('Finished')

            self.writeFiles()

            self.close()
            print('\nNo more conditions, the experiment is finished!')
            raise SystemExit(0)

        if self.addNoise and occludedTime != 0:
            sumDuration = visibleTime + occludedTime

            # Generating a noise and its invert keeps the sum duration the same as without permutation
            noise = gauss(mu=1.0, sigma=0.1)

            self.occludedTime = int(occludedTime * noise)
            self.visibleTime = sumDuration - occludedTime
        else:
            self.visibleTime = visibleTime
            self.occludedTime = occludedTime

        self.backCrossStart = 0
        self.backCrossing = False
        # print(f'Moving to condition {self.currentConditionIndex}: ({self.visibleTime}, {self.occludedTime})')

    def getConditionTiming(self):
        # conditionOrderIndex to retrieve a condition number from conditionOrder
        self.currentConditionIndex = self.conditionOrder[
            self.conditionOrderIndex]

        # Use the condition number retrieved from conditionOrder to retrieve the actual condition to use
        visibleTime = self.conditions[self.currentConditionIndex][0]
        occludedTime = self.conditions[self.currentConditionIndex][1]

        return visibleTime, occludedTime

    # =============================================================================
    #     INITIALIZATION OF SCREENS
    # =============================================================================
    def clearScreen(self):
        for i in reversed(range(self.layout.count())):
            self.layout.itemAt(i).widget().setParent(None)

    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.setStyleSheet("background-color:rgb(128, 128, 128)")
        self.layout = QVBoxLayout()

        self.writeEvent('UI init')

        self.loadThumbsUp()
        self.loadFixationCross()
        self.initOpeningScreen()

    def loadThumbsUp(self):
        path = Path(__file__).parent / 'pictograms' / 'thumbs.png'
        with open(path, 'rb') as f:
            im = f.read()

        image = QImage()
        image.loadFromData(im)
        image = image.scaledToWidth(100)
        pixmap = QPixmap.fromImage(image)

        self.thumbsUp = QLabel()

        self.thumbsUp.setPixmap(pixmap)
        self.thumbsUp.setAlignment(QtCore.Qt.AlignCenter)
        self.thumbsUp.setSizePolicy(self.sizePolicy)

    def loadFixationCross(self):
        path = Path(__file__).parent / 'pictograms' / 'fixation_cross.png'
        with open(path, 'rb') as f:
            im = f.read()

        image = QImage()
        image.loadFromData(im)
        image = image.scaledToWidth(self.fixationCrossSize)
        pixmap = QPixmap.fromImage(image)

        self.fixationCross = QLabel()

        self.fixationCross.setPixmap(pixmap)
        self.fixationCross.setAlignment(QtCore.Qt.AlignCenter)
        self.fixationCross.setSizePolicy(self.sizePolicy)

    def initOpeningScreen(self, timeOut=False):
        self.disconnectTimer()

        self.inOpeningScreen = True

        # If all trials are done, increment condition counter and
        # reset trial counter to 1.
        if self.currentTrial > self.nTrials:
            self.conditionOrderIndex += 1
            self.currentTrial = 1

        print(
            f'Trial {self.currentTrial}, Block {self.conditionOrderIndex}, Condition {self.currentConditionIndex}'
        )

        self.spacePushed = False
        self.writeEvent('In starting screen')

        if self.currentTrial == 1:
            if self.conditionOrderIndex == 0:
                self.label = QLabel(
                    "Welcome to the experiment.\n" +
                    "Throughout this experiment, you will be asked to copy the layout on the left side of the screen to the right side of the screen,\n"
                    +
                    "by dragging the images in the lower right part of the screen to their correct positions. You are asked to do this as quickly"
                    + "and as accurately as possible.\n" +
                    "If you make a mistake, the location will briefly turn red. \n"
                    +
                    "Throughout the experiment, the example layout may disappear for brief periods of time. You are asked to keep\n"
                    +
                    "performing the task as quickly and as accurately as possible.\n"
                    +
                    "If you performed a trial correctly, you will see a thumbs up at the bottom of the screen, as shown below \n \n"
                    +
                    "If you have any questions now or anytime during the experiment, please ask them straightaway.\n"
                    +
                    "If you need to take a break, please tell the experimenter so.\n \n"
                    +
                    "When you are ready to start the experiment, please tell the experimenter and we will start calibrating.\n"
                    + "Good luck!")

            elif self.conditionOrderIndex > 0:
                self.label = QLabel(
                    f"End of block {self.conditionOrderIndex}. You may now take a break if you wish to do so.\n"
                    +
                    "If you wish to carry on immediately, let the experimenter know.\n"
                    +
                    "If you have taken a break, please wait for the experimenter to start the calibration procedure."
                )
                self.label.setStyleSheet("color:rgba(0, 0, 255, 200)")

        elif self.currentTrial > 1:
            nextTrial = f'Press space to continue to the next trial ({self.currentTrial} of {self.nTrials}).'
            # addText = f'\nFixation error last trial was {self.mean_error} ({self.sd_error}) degrees.'

            if timeOut:
                self.label = QLabel(
                    f"You timed out. {nextTrial}")  # {addText}")
            else:
                self.label = QLabel(
                    f"End of trial. {nextTrial}")  # {addText}")

        self.label.setFont(QFont("Times", 18))
        self.label.setAlignment(Qt.AlignCenter | Qt.AlignHCenter)

        self.layout.addWidget(QLabel())
        self.layout.addWidget(self.label)

        # Add an empty widget if trial was incorrect, otherwise show a thumbs up
        if timeOut:
            self.layout.addWidget(QLabel())
        else:
            self.layout.addWidget(self.thumbsUp)

        self.installEventFilter(self)

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

    def initTask(self):
        self.inOpeningScreen = False

        self.images = pick_stimuli(self.allImages, self.nStimuli)
        self.grid = example_grid.generate_grid(self.images, self.nrow,
                                               self.ncol)
        self.shuffledImages = sample(self.images, len(self.images))

        self.setConditionTiming(
        )  # Set slightly different timing for each trial

        self.fixationCrossSamples = []
        self.fixationScreen()

    def continueInitTask(self):
        self.inFixationScreen = False

        # Create the actual task layout
        self.createMasterGrid()

        self.layout.addWidget(self.masterGrid)
        self.setLayout(self.layout)

        self.removeEventFilter(self)
        self.writeEvent('Task init')

        self.show()

        self.hourGlass.setVisible(False)
        self.runTimer()

    # =============================================================================
    #    GENERATE FIXATION CROSS. NOTE THAT THIS IS PURELY USED AS AN INDICATION FOR THE EXPERIMENTER
    # =============================================================================
    def stopFixationScreen(self):
        self.fixTimer2.stop()

        self.mean_error, self.sd_error = calculateMeanError(
            self.fixationCrossSamples)
        self.writeEvent(f'Fixation cross error mean: {self.mean_error}')
        self.writeEvent(f'Fixation cross error sd: {self.sd_error}')

        print(f'Mean error = {self.mean_error}, SD error = {self.sd_error}')

        try:
            self.tracker.status_msg(
                f'Mean error = {self.mean_error}, SD error = {self.sd_error}')
        except:
            pass

        self.clearScreen()

        if self.mean_error < self.driftToleranceDeg:
            self.continueInitTask()
        else:
            self.driftWarningScreen()

    def updateFixationScreen(self):
        try:
            samp = self.tracker.sample()

            # Remove outliers that are very far from the center, as they're more likely a different issue than drift
            if (constants.DISPSIZE[0] *
                    .2) < samp[0] < (constants.DISPSIZE[0] * .8):
                if (constants.DISPSIZE[1] *
                        .2) < samp[1] < (constants.DISPSIZE[1] * .8):
                    self.fixationCrossSamples.append(samp)

        except Exception as e:
            if self.inTrainingMode:  # If in traning mode, pretend there is no tracker error
                samp = constants.SCREEN_CENTER
            else:  # Otherwise, return np.nan to indicate an issue
                samp = np.nan

            # samp = (random.gauss(1280, 10), random.gauss(720, 10))  # Used for testing
            self.fixationCrossSamples.append(samp)

    def fixationScreen(self):
        self.inFixationScreen = True
        self.spacePushed = False

        self.layout.addWidget(self.fixationCross)
        self.setLayout(self.layout)
        self.show()

        self.fixTimer2.setInterval(2)
        self.fixTimer2.timeout.connect(self.updateFixationScreen)
        self.fixTimer2.start()

        self.fixTimer.singleShot(self.fixationCrossMs, self.stopFixationScreen)

    def driftWarningScreen(self):
        self.writeEvent('Showing drift warning')

        self.label = QLabel(
            "Warning: fixation error was greater than threshold.\n")  # +
        # "Press 'backspace' to calibrate, 'r' to retry, or 'spacebar' to continue.")

        self.label.setFont(QFont("Times", 18))
        self.label.setStyleSheet("color:rgba(255, 0, 0, 200)")
        self.label.setAlignment(Qt.AlignCenter | Qt.AlignHCenter)

        self.layout.addWidget(self.label)

        self.installEventFilter(self)

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

    # =============================================================================
    #    GENERATE GRIDS
    # =============================================================================
    def createMasterGrid(self):
        self.masterGrid = QGroupBox("Grid", self)
        layout = QGridLayout()

        masterGridRows = 3
        masterGridCols = 6
        gridLocs = [(1, 1), (1, 4), (2, 4)]

        self.emptyGridLayout()
        for row in range(masterGridRows):
            for col in range(masterGridCols):
                if (row, col) not in gridLocs:
                    layout.addWidget(self.emptyGridBox, row, col)

        self.exampleGridLayout()
        layout.addWidget(self.exampleGridBox, gridLocs[0][0], gridLocs[0][1])

        self.copyGridLayout()
        layout.addWidget(self.copyGridBox, gridLocs[1][0], gridLocs[1][1])

        self.resourceGridLayout()
        layout.addWidget(self.resourceGridBox, gridLocs[2][0], gridLocs[2][1])

        self.emptyOutlineLayout()
        layout.addWidget(self.emptyOutline, gridLocs[0][0], gridLocs[0][1])

        self.hourGlassLayout()
        layout.addWidget(self.hourGlass, gridLocs[0][0], gridLocs[0][1])

        self.masterGrid.setLayout(layout)
        self.masterGrid.setTitle('')
        self.masterGrid.setStyleSheet(self.styleStr)

    def hourGlassLayout(self):
        path = Path(__file__).parent / 'pictograms' / 'hourglass.png'
        with open(path, 'rb') as f:
            im = f.read()

        image = QImage()
        image.loadFromData(im)
        image = image.scaledToWidth(75)

        self.hourGlass = QLabel()
        pixmap = QPixmap.fromImage(image)

        self.hourGlass.setPixmap(pixmap)
        self.hourGlass.setAlignment(QtCore.Qt.AlignCenter)
        self.hourGlass.setSizePolicy(self.sizePolicy)

    def emptyOutlineLayout(self):
        self.emptyOutline = QGroupBox("Grid", self)
        layout = QGridLayout()

        self.emptyOutline.setLayout(layout)
        self.emptyOutline.setTitle('')
        self.emptyOutline.setStyleSheet(self.styleStr)

    def emptyGridLayout(self):
        self.emptyGridBox = QGroupBox("Grid", self)
        layout = QGridLayout()

        self.emptyGridBox.setLayout(layout)
        self.emptyGridBox.setTitle('')
        self.emptyGridBox.setStyleSheet(self.styleStr + "; border:0px")

    def exampleGridLayout(self):
        self.exampleGridBox = QGroupBox("Grid", self)
        layout = QGridLayout()

        i = 0
        for x in range(self.ncol):
            for y in range(self.nrow):
                label = QLabel(self)
                label.setFrameStyle(QFrame.Panel)

                if self.grid[x, y]:
                    image = self.images[i]
                    pixmap = QPixmap.fromImage(image.qimage)
                    label.setPixmap(pixmap)
                    label.setAlignment(QtCore.Qt.AlignCenter)
                    label.setSizePolicy(self.sizePolicy)

                    exampleDict = pd.DataFrame(
                        {
                            'x': x,
                            'y': y,
                            'Name': '',
                            'shouldBe': image.name,
                            'Correct': False,
                            'Time': None,
                            'dragDuration': None,
                            'dragDistance': None,
                            'Trial': self.currentTrial,
                            'Condition': self.currentConditionIndex,
                            'visibleTime': self.visibleTime,
                            'cameFromX': None,
                            'cameFromY': None
                        },
                        index=[0])
                    self.correctPlacements = self.correctPlacements.append(
                        exampleDict, ignore_index=True)

                    i += 1

                layout.addWidget(label, y,
                                 x)  # addWidget asks for (row, column)

        self.exampleGridBox.setLayout(layout)
        self.exampleGridBox.setTitle('')
        self.exampleGridBox.setSizePolicy(self.sizePolicy)
        self.exampleGridBox.setStyleSheet(self.styleStr)

    def copyGridLayout(self):
        self.copyGridBox = QGroupBox("Grid", self)
        layout = QGridLayout()

        i = 0
        for x in range(self.ncol):
            for y in range(self.nrow):

                # Pass along the name of the intended images for this location
                if self.grid[x, y]:
                    shouldBe = self.images[i].name
                    i += 1
                else:
                    shouldBe = ''

                label = CustomLabel('', self, x, y, self.currentTrial,
                                    self.currentConditionIndex, shouldBe)
                label.setFrameStyle(QFrame.Panel)
                label.resize(self.imageWidth, self.imageWidth)
                label.setAlignment(QtCore.Qt.AlignCenter)
                label.setSizePolicy(self.sizePolicy)
                layout.addWidget(label, y,
                                 x)  # addWidget asks for (row, column)

        self.copyGridBox.setLayout(layout)
        self.copyGridBox.setTitle('')
        self.copyGridBox.setStyleSheet(self.styleStr)

    def resourceGridLayout(self):
        self.resourceGridBox = QGroupBox("Grid", self)
        layout = QGridLayout()

        i = 0
        row = 0
        col = 0
        for x in range(self.ncol):
            for y in range(self.nrow):
                if self.grid[x, y]:
                    image = self.shuffledImages[i]
                    label = DraggableLabel(self, image)
                    # label.setFrameStyle(QFrame.Panel)  # temp
                    label.setAlignment(QtCore.Qt.AlignCenter)
                    label.setSizePolicy(self.sizePolicy)

                    if i % self.ncol == 0:
                        row += 1
                        col = 0

                    layout.addWidget(label, row,
                                     col)  # addWidget asks for (row, column)
                    i += 1
                    col += 1

        self.resourceGridBox.setLayout(layout)
        self.resourceGridBox.setTitle('')
        self.resourceGridBox.setSizePolicy(self.sizePolicy)
        self.resourceGridBox.setStyleSheet(self.styleStr)
Exemple #59
0
 def _setupUi(self):
     self.setWindowTitle(tr("CSV Options"))
     self.resize(526, 369)
     self.verticalLayout = QVBoxLayout(self)
     msg = tr(
         "Specify which CSV columns correspond to which transaction fields. You must also "
         "uncheck the \"Import\" column for lines that don\'t represent a transaction "
         "(header, footer, comments)."
     )
     self.label = QLabel(msg)
     self.label.setWordWrap(True)
     self.verticalLayout.addWidget(self.label)
     self.gridLayout = QGridLayout()
     self.label_2 = QLabel(tr("Layout:"))
     self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
     self.layoutComboBox = QComboBox(self)
     self.layoutComboBox.setMinimumSize(QtCore.QSize(160, 0))
     self.gridLayout.addWidget(self.layoutComboBox, 0, 1, 1, 1)
     self.label_4 = QLabel(tr("Delimiter:"))
     self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1)
     self.fieldSeparatorEdit = QLineEdit(self)
     self.fieldSeparatorEdit.setMaximumSize(QtCore.QSize(30, 16777215))
     self.gridLayout.addWidget(self.fieldSeparatorEdit, 0, 4, 1, 1)
     self.targetComboBox = QComboBox(self)
     self.gridLayout.addWidget(self.targetComboBox, 1, 1, 1, 1)
     self.label_3 = QLabel(tr("Target:"))
     self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1)
     self.encodingComboBox = QComboBox(self)
     self.gridLayout.addWidget(self.encodingComboBox, 1, 4, 1, 1)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.gridLayout.addItem(spacerItem, 2, 2, 1, 1)
     self.horizontalLayout_2 = QHBoxLayout()
     self.horizontalLayout_2.setSpacing(0)
     spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout_2.addItem(spacerItem1)
     self.rescanButton = QPushButton(tr("Rescan"))
     sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.rescanButton.sizePolicy().hasHeightForWidth())
     self.rescanButton.setSizePolicy(sizePolicy)
     self.horizontalLayout_2.addWidget(self.rescanButton)
     self.gridLayout.addLayout(self.horizontalLayout_2, 2, 3, 1, 2)
     self.label_5 = QLabel(tr("Encoding:"))
     self.gridLayout.addWidget(self.label_5, 1, 3, 1, 1)
     self.verticalLayout.addLayout(self.gridLayout)
     self.tableView = QTableView(self)
     self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.tableView.setShowGrid(False)
     self.tableView.horizontalHeader().setHighlightSections(False)
     self.tableView.verticalHeader().setVisible(False)
     self.tableView.verticalHeader().setDefaultSectionSize(18)
     self.verticalLayout.addWidget(self.tableView)
     self.horizontalLayout = QHBoxLayout()
     spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem2)
     self.cancelButton = QPushButton(tr("Cancel"))
     self.cancelButton.setShortcut("Esc")
     self.horizontalLayout.addWidget(self.cancelButton)
     self.continueButton = QPushButton(tr("Continue Import"))
     self.continueButton.setDefault(True)
     self.horizontalLayout.addWidget(self.continueButton)
     self.verticalLayout.addLayout(self.horizontalLayout)