Beispiel #1
0
 def _build_group_title(self, title: str) -> ItemLayout:
     text_item = self._scene.addText(title, QFont("Verdana", 12))
     group_title = ItemLayout()
     group_title.set_item(text_item)
     return group_title
root_path = path.dirname(path.dirname(path.abspath(__file__)))

try:
    from Utility.history_time import *
    from Utility.history_public import *
except Exception as e:
    sys.path.append(root_path)
    from Utility.history_time import *
    from Utility.history_public import *
finally:
    pass

# ------------------------------------------------------- Fonts --------------------------------------------------------

event_font = QFont()
event_font.setFamily("微软雅黑")
event_font.setPointSize(6)

period_font = QFont()
period_font.setFamily("微软雅黑")
period_font.setPointSize(8)

# ------------------------------------------------------- Colors -------------------------------------------------------

# From: https://www.icoa.cn/a/512.html

AXIS_BACKGROUND_COLORS = [
    QColor(255, 245, 247),
    QColor(254, 67, 101),
    QColor(252, 157, 154),
Beispiel #3
0
                def __init__(self):
                    QDialog.__init__(self)

                    grid = QGridLayout()
                    grid.setSpacing(20)

                    self.setWindowTitle("Opvragen resultaten per boekweek")
                    self.setWindowIcon(QIcon('./images/logos/logo.jpg'))

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

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

                    grid.addWidget(
                        QLabel(
                            'Opvragen resultaten werken extern per boekweek'),
                        0, 2, 1, 3)

                    self.logo = QLabel()
                    self.pixmap = QPixmap('./images/logos/logo.jpg')
                    self.logo.setPixmap(self.pixmap)
                    grid.addWidget(self.logo, 0, 5, 1, 1, Qt.AlignRight)
                    index = 3
                    for item in header:
                        horpos = index % 3
                        verpos = index
                        if index % 3 == 1:
                            verpos = index - 1
                        elif index % 3 == 2:
                            verpos = index - 2
                        self.lbl = QLabel('{:15}'.format(header[index - 3]))

                        self.Gegevens = QLabel()
                        if index - 3 > 2:
                            q1Edit = QLineEdit('{:12.2f}'.format(rpres[index -
                                                                       3]))
                        else:
                            q1Edit = QLineEdit(str(rpres[index - 3]))
                        q1Edit.setAlignment(Qt.AlignRight)
                        q1Edit.setStyleSheet(
                            "QLineEdit { font-size: 10pt; font-family: Arial; color: black }"
                        )
                        q1Edit.setFixedWidth(150)
                        q1Edit.setDisabled(True)
                        grid.addWidget(self.lbl, verpos, horpos + horpos % 3)
                        grid.addWidget(q1Edit, verpos, horpos + horpos % 3 + 1)

                        index += 1

                    terugBtn = QPushButton('Sluiten')
                    terugBtn.clicked.connect(self.accept)

                    grid.addWidget(terugBtn, verpos + 1, 5, 1, 1,
                                   Qt.AlignRight)
                    terugBtn.setFont(QFont("Arial", 10))
                    terugBtn.setFixedWidth(100)
                    terugBtn.setStyleSheet(
                        "color: black;  background-color: gainsboro")

                    grid.addWidget(
                        QLabel(
                            '\u00A9 2017 all rights reserved [email protected]'
                        ), verpos + 2, 2, 1, 2)

                    self.setLayout(grid)
                    self.setGeometry(200, 300, 150, 150)
Beispiel #4
0
 def cambiar_fuente(self):
     indice = self.ui.fcb_fuentes.currentIndex()
     fuente = QFont(self.ui.fcb_fuentes.itemText(indice), 15)
     self.ui.txt_editor.setFont(fuente)
    def initToolbar(self, webview):
        pass
        ###使用QToolBar创建导航栏,并使用QAction创建按钮
        # 添加导航栏
        self.navigation_bar = QToolBar('Navigation')
        # 锁定导航栏
        self.navigation_bar.setMovable(False)
        # 设定图标的大小
        self.navigation_bar.setIconSize(QSize(2, 2))
        # 添加导航栏到窗口中
        self.addToolBar(self.navigation_bar)
        # 添加其它配置
        self.navigation_bar.setObjectName("navigation_bar")
        self.navigation_bar.setCursor(Qt.ArrowCursor)
        # QAction类提供了抽象的用户界面action,这些action可以被放置在窗口部件中
        # 添加前进、后退、停止加载和刷新的按钮
        self.reload_icon = unichr(0xf2f9)
        self.stop_icon = unichr(0xf00d)

        # 后退按钮
        self.back_action = QWidgetAction(self)
        self.back_button = QPushButton(unichr(0xf060), self,
                                       clicked=webview.back,
                                       font=fontawesome("far"),
                                       objectName='back_button')
        self.back_button.setToolTip("后退")
        self.back_button.setCursor(Qt.ArrowCursor)
        self.back_action.setDefaultWidget(self.back_button)

        # 前进按钮
        self.next_action = QWidgetAction(self)
        self.next_button = QPushButton(unichr(0xf061), self,
                                       clicked=webview.forward,
                                       font=fontawesome("far"),
                                       objectName='next_button')
        self.next_button.setToolTip("前进")
        self.next_button.setCursor(Qt.ArrowCursor)
        self.next_action.setDefaultWidget(self.next_button)

        # 刷新与停止按钮
        self.reload_action = QWidgetAction(self)

        self.reload_button = QPushButton(self.reload_icon, self,
                                         clicked=webview.reload,
                                         font=fontawesome("far"),
                                         objectName='reload_button')
        self.reload_button.setToolTip("刷新")
        self.reload_button.setCursor(Qt.ArrowCursor)
        self.reload_action.setDefaultWidget(self.reload_button)

        # 放大按钮
        self.zoom_in_button = QPushButton(unichr(0xf067), self,
                                          clicked=self.zoom_in_func,
                                          font=fontawesome("far"),
                                          objectName='zoom_in_btn')
        self.zoom_in_button.setToolTip("放大")
        self.zoom_in_button.setCursor(Qt.ArrowCursor)

        # 缩小按钮
        self.zoom_out_button = QPushButton(unichr(0xf068), self,
                                           clicked=self.zoom_out_func,
                                           font=fontawesome("far"),
                                           objectName='zoom_out_btn')
        self.zoom_out_button.setToolTip("缩小")
        self.zoom_out_button.setCursor(Qt.ArrowCursor)
        self.sf_label_rate = QLabel()
        self.sf_label_rate.setObjectName("sf_label_rate")
        self.sf_label_rate.setFixedWidth(30)
        self.sf_label_rate.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignVCenter)
        self.sf_label_rate.setProperty("class","qlabel")
        self.sf_label_rate.setText(str(int(self.webview.zoomFactor()*100))+"%")

        # 全屏按钮
        self.full_screen_button = QPushButton(unichr(0xe140), self,
                                           clicked=self.full_screen_func,
                                           font=fontawesome("boot"),
                                           objectName='full_screen_button')
        self.full_screen_button.setToolTip("全屏")
        self.full_screen_button.setCursor(Qt.ArrowCursor)

        # 其它按钮
        self.more_action = QWidgetAction(self)
        self.more_button = QPushButton(unichr(0xe235), self,
                                       clicked=self.moreMenuShow,
                                       font=fontawesome("boot"),
                                       objectName='more_button')
        self.more_button.setToolTip("页面控制及浏览器核心")
        self.more_button.setCursor(Qt.ArrowCursor)
        self.more_action.setDefaultWidget(self.more_button)

        # 首页按钮
        self.index_action = QWidgetAction(self)
        self.index_button = QPushButton(unichr(0xf015), self,
                                        # clicked=self.zoom_out_func,
                                        font=fontawesome("far"),
                                        objectName='index_button')
        self.index_button.setToolTip("主页")
        self.index_button.setCursor(Qt.ArrowCursor)
        self.index_action.setDefaultWidget(self.index_button)

        # self.back_button.triggered.connect(webview.back)
        # self.next_button.triggered.connect(webview.forward)
        # self.reload_button.triggered.connect(webview.reload)
        # self.zoom_in_btn.triggered.connect(self.zoom_in_func)
        # self.zoom_out_btn.triggered.connect(self.zoom_out_func)
        # 将按钮添加到导航栏上
        self.navigation_bar.addAction(self.back_action)
        self.navigation_bar.addAction(self.next_action)
        self.navigation_bar.addAction(self.reload_action)
        self.navigation_bar.addAction(self.index_action)
        # 添加URL地址栏
        self.urlbar = QLineEdit()
        # 让地址栏能响应回车按键信号
        self.urlbar.returnPressed.connect(self.navigate_to_url)
        # self.navigation_bar.addSeparator()
        self.navigation_bar.addWidget(self.urlbar)
        # self.navigation_bar.addSeparator()

        # self.navigation_bar.addAction(self.zoom_in_action)
        # self.navigation_bar.addAction(self.zoom_out_action)
        self.navigation_bar.addAction(self.more_action)
        # 让浏览器相应url地址的变化
        webview.urlChanged.connect(self.renew_urlbar)
        webview.loadProgress.connect(self.processLoad)
        webview.loadStarted.connect(self.loadPage)
        webview.loadFinished.connect(self.loadFinish)
        webview.titleChanged.connect(self.renew_title)
        webview.iconChanged.connect(self.renew_icon)
        self.webBind()
        webview.show()
        self.navigation_bar.setIconSize(QSize(20, 20))
        self.urlbar.setFont(QFont('SansSerif', 13))
Beispiel #6
0
    def create_edit_widgets(self):
        """Create edit widgets"""
        self.FILE_ICON = ''
        self.OLD_URL = None
        #vbox_main
        self.vbox_edit = QVBoxLayout()
        self.setLayout(self.vbox_edit)

        #add main label
        label_font = QFont()
        label_font.setPointSize(14)
        label_font.setBold(True)
        self.label_main = QLabel()
        self.label_main.setFont(label_font)
        self.label_main.setAlignment(Qt.AlignCenter)
        self.vbox_edit.addWidget(self.label_main)

        #add hbox_stream_station
        self.form_layout = QFormLayout()
        self.vbox_edit.addLayout(self.form_layout)
        #add entry
        self.entry_stream = QLineEdit()
        self.entry_stream.setEnabled(False)
        #button_icon
        self.button_icon = QPushButton()
        self.button_icon.setEnabled(False)
        self.button_icon.setCursor(Qt.PointingHandCursor)
        self.button_icon.setFixedSize(32, 32)
        self.button_icon.setIconSize(QSize(28, 28))
        self.button_icon.setFocusPolicy(Qt.NoFocus)
        self.button_icon.clicked.connect(self.press_button_add_icon)
        self.button_icon.setIcon(QIcon(self.parentButton.icon()))
        #add row
        self.form_layout.addRow(self.tr("Change stream url:"),
                                self.entry_stream)
        self.form_layout.addRow(self.tr("Change icon:"), self.button_icon)

        #add stretch
        self.vbox_edit.addStretch()

        #add hbox button unlock and save
        self.hbox_unlock_save = QHBoxLayout()
        self.vbox_edit.addLayout(self.hbox_unlock_save)
        #add button unlock
        self.button_unlock = QPushButton(self.tr("Unlock"))
        self.button_unlock.setEnabled(True)
        self.button_unlock.setCursor(Qt.PointingHandCursor)
        self.button_unlock.setStyleSheet(styles.get_button_style())
        self.button_unlock.setMinimumHeight(30)
        self.button_unlock.clicked.connect(self.press_unlock_button)
        self.hbox_unlock_save.addWidget(self.button_unlock)
        #add button save
        self.button_save = QPushButton(self.tr("Update"))
        self.button_save.setEnabled(False)
        self.button_save.setCursor(Qt.PointingHandCursor)
        self.button_save.setStyleSheet(styles.get_button_style())
        self.button_save.setMinimumHeight(30)
        self.button_save.clicked.connect(self.press_save_button)
        self.hbox_unlock_save.addWidget(self.button_save)

        ###
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowTitle(self.tr("Edit station"))
        self.setModal(True)
        self.setFixedSize(500, 300)
        self.show()
Beispiel #7
0
 def __init__(self, text, help_text):
     QLabel.__init__(self, text)
     self.help_text = help_text
     self.app = QCoreApplication.instance()
     self.font = QFont()
Beispiel #8
0
    def getResults(self):
        if self.imagePath == "":
            return
        tumorStatus = ""
        tumorLocation = ""
        image = cv2.imread(self.imagePath)
        resizedImage = cv2.resize(image, (400, 400))
        gray = cv2.cvtColor(resizedImage, cv2.COLOR_BGR2GRAY)
        ret, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_OTSU)
        ret, markers = cv2.connectedComponents(thresh)
        marker_area = [
            np.sum(markers == m) for m in range(np.max(markers)) if m != 0
        ]
        largest_component = np.argmax(marker_area) + 1
        brain_mask = markers == largest_component
        brain_out = resizedImage.copy()
        brain_out[brain_mask == False] = (0, 0, 0)
        gray = cv2.cvtColor(brain_out, cv2.COLOR_BGR2GRAY)
        median = cv2.medianBlur(brain_out, 3)
        data = median.reshape(median.shape[0] * median.shape[1],
                              median.shape[2])
        data = np.float32(data)
        criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10,
                    1.0)
        attempts = 10
        ret, label, center = cv2.kmeans(data, 3, None, criteria, attempts,
                                        cv2.KMEANS_PP_CENTERS)
        center = np.uint8(center)
        res = center[label.flatten()]
        segmented = res.reshape(median.shape[0], median.shape[1],
                                median.shape[2])
        segmentedImage = self.getQImage(segmented)
        imageToPixmap = QPixmap(QPixmap.fromImage(segmentedImage))
        self.segmentedImage.setPixmap(QPixmap(imageToPixmap))

        area = 0
        rows, cols, dims = segmented.shape
        pixels = list()
        reduced_pixels = list()
        for j in range(rows):
            for k in range(cols):
                pixels.append(segmented[j, k][0])
                pixels.append(segmented[j, k][1])
                pixels.append(segmented[j, k][2])

        pix_array = np.array(pixels)
        reduced_pixels = np.unique(pix_array)
        pixel = int(sum(reduced_pixels) / (len(reduced_pixels) - 1))

        if (pixel >= 120):
            ret, thresh = cv2.threshold(segmented, pixel, 255,
                                        cv2.THRESH_BINARY)
        else:
            ret, thresh = cv2.threshold(segmented, 120, 255, cv2.THRESH_BINARY)

        kernel = np.ones((5, 5), np.uint8)
        erode = cv2.erode(thresh, kernel)
        erode = cv2.cvtColor(erode, cv2.COLOR_BGR2GRAY)
        contours, hierarchy = cv2.findContours(erode, cv2.RETR_TREE,
                                               cv2.CHAIN_APPROX_SIMPLE)

        x, y, w, h = 0, 0, erode.shape[1] // 2, erode.shape[0]
        left = erode[y:y + h, x:x + w]
        right = erode[y:y + h, x + w:x + w + w]
        left_pixels = cv2.countNonZero(left)
        right_pixels = cv2.countNonZero(right)
        ratio = -1
        gray = cv2.cvtColor(resizedImage, cv2.COLOR_BGR2GRAY)
        if len(contours) > 0:
            contour = max(contours, key=cv2.contourArea)
            area = cv2.contourArea(contour)
            cv2.drawContours(segmented, contours, -1, (0, 0, 255), 3)
            contourImage = self.getQImage(segmented)
            imageToPixmap = QPixmap(QPixmap.fromImage(contourImage))
            if area > 0:
                if left_pixels == 0 and right_pixels > 0:
                    tumorStatus = "Yes"
                    tumorLocation = "Right"
                elif right_pixels == 0 and left_pixels > 0:
                    tumorStatus = "Yes"
                    tumorLocation = "Left"
                elif right_pixels > left_pixels:
                    ratio = float(right_pixels / left_pixels)
                    if ratio >= 1.5:
                        tumorStatus = "Yes"
                        tumorLocation = "Right"
                    else:
                        tumorStatus = "No"
                else:
                    ratio = float(left_pixels / right_pixels)
                    if ratio >= 1.5:
                        tumorStatus = "Yes"
                        tumorLocation = "Left"
                    else:
                        tumorStatus = "No"
            else:
                tumorStatus = "No"
        else:
            tumorStatus = "No"

        fontStyle = QFont("Arial", 10, QFont.Bold)
        self.tumorInfo.setFont(fontStyle)
        if tumorStatus == "No":
            tumorInfoStr = "Tumor Status: " + tumorStatus
            self.tumorInfo.setStyleSheet("QLabel { color : #39ff14; }")
            self.tumorInfo.setText(tumorInfoStr)
        else:
            self.contourImage.setPixmap(QPixmap(imageToPixmap))
            tumorInfoStr = "Tumor Status: " + tumorStatus + "\nTumor Location: " + tumorLocation
            self.tumorInfo.setStyleSheet("QLabel { color : #ff073a; }")
            self.tumorInfo.setText(tumorInfoStr)
    def setupUi(self, MainWindow):
        resolution = QDesktopWidget().screenGeometry(self)
        # MainWindow.setGeometry(QRect(0,0,0,0))
        MainWindow.setFixedSize(resolution.size().width()*0.99, resolution.size().height()*0.90)#1200 800
        # self.setWindowState(Qt.WindowMaximized)
        print("resol : ", MainWindow.size())

        #메인 화면 색상py
        self.setStyleSheet("color: black;"
                        "background-color: white;")

        font = QFont()
        font.setFamily("NanumGothic")
        MainWindow.setFont(font)
        self.centralwidget = QWidget(MainWindow)
        self.label = QLabel(self.centralwidget)
        self.label.setGeometry(QRect(20, 20, 130, 35))
        font = QFont()
        font.setFamily("NanumGothic")
        font.setPointSize(18)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.button_add = QPushButton(self.centralwidget)
        self.button_add.setGeometry(QRect(MainWindow.size().width()*0.05, MainWindow.size().height() - 80, 131, 34))
        #버튼 스타일 변경
        self.button_add.setStyleSheet(staticValues.blueButtonStyleSheet)
        self.button_add.setFont(staticValues.buttonFont)

        self.button_modi = QPushButton(self.centralwidget)
        self.button_modi.setGeometry(QRect(MainWindow.size().width()*0.20, MainWindow.size().height() - 80, 131, 34))
        self.button_modi.setStyleSheet(staticValues.blueButtonStyleSheet)
        self.button_modi.setFont(staticValues.buttonFont)

        self.button_del = QPushButton(self.centralwidget)
        self.button_del.setGeometry(QRect(MainWindow.size().width()*0.35, MainWindow.size().height() - 80, 131, 34))
        self.button_del.setStyleSheet(staticValues.redButtonStyleSheet)
        self.button_del.setFont(staticValues.buttonFont)

        self.button_upload = QPushButton(self.centralwidget)
        self.button_upload.setGeometry(QRect(MainWindow.size().width()*0.7, MainWindow.size().height() - 80, 131, 34))
        self.button_upload.setStyleSheet(staticValues.grayButtonStyleSheet)
        self.button_upload.setFont(staticValues.buttonFont)

        self.tabWidget = QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QRect(10, 70, MainWindow.size().width()-15, MainWindow.size().height() - 180))
        self.tab = QWidget()
        self.tab.layout = QVBoxLayout()
        self.tab2 = QWidget()
        self.tab2.layout = QVBoxLayout()
        self.tabWidget.addTab(self.tab, "회원 목록")
        self.tableWidget = QTableWidget(self.tab)
        self.tableWidget.setGeometry(QRect(0, 0, self.tabWidget.size().width()-5, self.tabWidget.size().height()-25))
        self.tableWidget.setColumnCount(13)
        self.tableWidget.setRowCount(0)
        self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.tableWidget.setHorizontalHeaderLabels(["회원 ID", "단톡방", "코인명", "구매", "입금", "판매", "출근"
        , "보유잔량", "총구매금액", "총판매금액", "수익", "평단가", "지갑주소"])
        self.tableWidget2 = QTableWidget(self.tab)
        self.tableWidget2.setGeometry(QRect(0, 0, self.tabWidget.size().width()-5, self.tabWidget.size().height()-25))
        self.tableWidget2.setColumnCount(3)
        self.tableWidget2.setRowCount(0)
        self.tableWidget2.setSelectionBehavior(QAbstractItemView.SelectRows)
        
        
        self.edit_search = QLineEdit(self.centralwidget)
        self.edit_search.setGeometry(QRect(MainWindow.size().width()-280, 35, 200, 30))
        self.edit_search.setStyleSheet(staticValues.solidStyleSheet)
        

        self.button_search = QPushButton(self.centralwidget)
        self.button_search.setGeometry(QRect(MainWindow.size().width()-80, 35, 70, 30))
        self.button_search.setStyleSheet(staticValues.grayButtonStyleSheet)
        self.button_search.setFont(staticValues.buttonFont)

        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QMetaObject.connectSlotsByName(MainWindow)
Beispiel #10
0
 def __init__(self):
     super().__init__()
     self.setFixedWidth(300)
     self.setFont(QFont("Times", 14))
Beispiel #11
0
    def __init__(self, parent=None):
        super(EditorBase, self).__init__(parent)
        # don't allow editing by default
        self.setReadOnly(True)
        # Set the default font
        self.font = QFont()
        self.font.setFamily('Courier')
        self.font.setFixedPitch(True)
        self.font.setPointSize(12)
        self.setFont(self.font)
        self._lastUserLine = 0

        # Margin 0 is used for line numbers
        self.setMarginsFont(self.font)
        self.set_margin_width(7)
        self.setMarginLineNumbers(0, True)
        self.setMarginsBackgroundColor(QColor("#cccccc"))

        # Clickable margin for showing markers
        self.marginClicked.connect(self.on_margin_clicked)

        self.setMarginMarkerMask(0, 0b1111)
        self.setMarginSensitivity(0, True)
        # setting marker margin width to zero make the marker highlight line
        self.setMarginWidth(1, 5)


        # Gcode highlight line
        self.currentHandle = self.markerDefine(QsciScintilla.Background,
                          self.CURRENT_MARKER_NUM)
        self.setMarkerBackgroundColor(QColor("yellow"),
                                      self.CURRENT_MARKER_NUM)

        # user Hightlight line
        self.userHandle = self.markerDefine(QsciScintilla.Background,
                          self.USER_MARKER_NUM)
        self.setMarkerBackgroundColor(QColor("red"),
                                      self.USER_MARKER_NUM)

        # Brace matching: enable for a brace immediately before or after
        # the current position
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self.setCaretLineVisible(False)
        self.SendScintilla(QsciScintilla.SCI_GETCARETLINEVISIBLEALWAYS, True)
        self.setCaretLineBackgroundColor(QColor("#ffe4e4"))
        self.ensureLineVisible(True)

        # Set custom gcode lexer
        self.set_gcode_lexer()

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented
        # here: http://www.scintilla.org/ScintillaDoc.html)
        #self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTH,700)
        self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTHTRACKING)

        # default gray background
        self.set_background_color('#C0C0C0')
        self._stylebackgroundColor = '#C0C0C0'

        # not too small
        self.setMinimumSize(200, 100)
        self.filepath = None
Beispiel #12
0
    def initUI(self):
        self.setGeometry(0, 0, 1000, 800)
        self.setStyleSheet('background-color:rgb(0, 0, 0)')
        self.setWindowTitle("*****가야금을 연주해보자******")

        #Title text frame
        self.titleFrame = QFrame(self)
        self.titleFrame.setGeometry(QRect(0, 0, 800, 150))
        self.titleFrameLayout = QVBoxLayout(self.titleFrame)

        #set Title font
        self.font = QFont()
        self.font.setFamily("Source Code Pro")
        self.font.setPointSize(35)
        # self.font.setBold(True)
        # self.font.setItalic(True)

        self.l2 = QLabel(self)
        self.l2.setText("Press a Key\nTo Start Playing!")

        self.l2.setFont(self.font)
        self.l2.setStyleSheet('color : white')
        self.titleFrameLayout.addWidget(self.l2, 0, Qt.AlignHCenter)

        #set frame
        self.frame1 = QFrame(self)
        self.frame1.setGeometry(QRect(0, 150, 250, 650))
        # self.frame1.setStyleSheet('background-color:white')
        self.frame1Layout = QVBoxLayout(self.frame1)

        #add buttons for keys
        self.key1 = MyButton(1)
        self.key1.setText("Eb1  (1)")
        self.frame1Layout.addWidget(self.key1, 0, Qt.AlignHCenter)

        self.key2 = MyButton(2)
        self.key2.setText("F1    (2)")
        self.frame1Layout.addWidget(self.key2, 0, Qt.AlignHCenter)

        self.key3 = MyButton(3)
        self.key3.setText("Ab1  (3)")
        self.frame1Layout.addWidget(self.key3, 0, Qt.AlignHCenter)

        self.key4 = MyButton(4)
        self.key4.setText("Bb1  (4)")
        self.frame1Layout.addWidget(self.key4, 0, Qt.AlignHCenter)

        self.key5 = MyButton(5)
        self.key5.setText("Cb1  (5)")
        self.frame1Layout.addWidget(self.key5, 0, Qt.AlignHCenter)

        self.key6 = MyButton(6)
        self.key6.setText("Eb1  (6)")
        self.frame1Layout.addWidget(self.key6, 0, Qt.AlignHCenter)

        self.key7 = MyButton(7)
        self.key7.setText("F2    (7)")
        self.frame1Layout.addWidget(self.key7, 0, Qt.AlignHCenter)

        self.key8 = MyButton(8)
        self.key8.setText("Ab2  (8)")
        self.frame1Layout.addWidget(self.key8, 0, Qt.AlignHCenter)

        self.key9 = MyButton(9)
        self.key9.setText("Bb2  (9)")
        self.frame1Layout.addWidget(self.key9, 0, Qt.AlignHCenter)

        self.key10 = MyButton(10)
        self.key10.setText("C2    (0)")
        self.frame1Layout.addWidget(self.key10, 0, Qt.AlignHCenter)

        self.key11 = MyButton(11)
        self.key11.setText("Eb3   (-)")
        self.frame1Layout.addWidget(self.key11, 0, Qt.AlignHCenter)

        self.key12 = MyButton(12)
        self.key12.setText("F3    (+)")
        self.frame1Layout.addWidget(self.key12, 0, Qt.AlignHCenter)

        self.volumeUI()
Beispiel #13
0
        def __init__(self, parent=None):
                QWidget.__init__(self, parent)

                self.setWindowTitle("Pre Processing")
                self.setMinimumSize(480, 360) 
                self.showMaximized()
                font = QFont()
                font.setFamily("MS Shell Dlg 2")
                self.setFont(font)
                self.setStyleSheet("background-color: rgb(255, 251, 252);\n"
        "border:5px;\n"
        "")     
                self.centralwidget = QWidget(self)
                self.centralwidget.setGeometry(0, 0, 1280, 960)
                self.centralwidget.setObjectName("centralwidge t")
        #         self.centralwidget.setStyleSheet("border-radius:0px;\n"
        # "background-color:rgb(255, 0, 0);\n"
        # "font-size:32px;\n"
        # "color:#fff;")


                self.setCentralWidget(self.centralwidget)
                self.box = QVBoxLayout(self.centralwidget) 

                scroll = QScrollArea()
                content_widget = QWidget()
                scroll.setWidget(content_widget)
                scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
                scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
                scroll.setWidgetResizable(True) 

                lay = QVBoxLayout(content_widget)
                self.groupBox = QGroupBox()
                self.groupBox.setFont(QFont("Sanserif", 13))
                gridLayout = QGridLayout(self)

                self.body = QtWidgets.QFrame(self.centralwidget)
                self.body.setLocale(QtCore.QLocale(QtCore.QLocale.Thai, QtCore.QLocale.Thailand))
                self.body.setFrameShape(QtWidgets.QFrame.StyledPanel)
                self.body.setFrameShadow(QtWidgets.QFrame.Raised)
                self.body.setProperty("Color", QtGui.QColor(0, 0, 0))
                self.body.setObjectName("body")

                subBody_gridLayout = QGridLayout(self.body)
                self.groupBox_cal = QtWidgets.QGroupBox(self.body)
                self.groupBox_cal.setStyleSheet("border-radius: 5px;\n"
        "background-color:transparent;\n"
        "border: 2px solid black")
                self.groupBox_cal.setObjectName("groupBox")

                sub_groupbox_cal = QGridLayout(self.groupBox_cal)

                self.Label = QtWidgets.QLabel()#Topic_Cal
                self.Label.setAutoFillBackground(False)
                self.Label.setStyleSheet("border-radius: 0px;\n"
        "border: 0px solid black;\n font-size:14pt bold;\n background-color: transparent;");
                self.Label.setAlignment(QtCore.Qt.AlignCenter)

                self.widget_4 = QtWidgets.QWidget(self.groupBox_cal) #result1W
                self.widget_4.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border: none")
                self.widget_4.setObjectName("widget_4")
                
                sub_GridCal_1 = QGridLayout(self.widget_4)

                self.label_5 = QtWidgets.QLabel(self.widget_4)#result1L
                self.label_5.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.label_5.setObjectName("label_5")
                # self.label_5.setText("Result1")
                sub_GridCal_1.addWidget( self.label_5,0,0)

                self.widget_5 = QtWidgets.QWidget(self.widget_4)#caliW1
                self.widget_5.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_5.setObjectName("widget_5")
                sub_GridCal_1.addWidget(self.widget_5,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_5)
                self.label_RAW = QtWidgets.QLabel(self.widget_5)#browse file1
                self.label_RAW.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_RAW.setAlignment(QtCore.Qt.AlignCenter)
                self.label_RAW.setObjectName("label_RAW")
                sub_GridCal_1_1.addWidget(self.label_RAW,0,0,1,3)

                self.Topic_RAW = QtWidgets.QLabel(self.widget_4)
                self.Topic_RAW.setGeometry(QtCore.QRect(10, 5, 300, 20)) #caliHeadL1
                self.Topic_RAW.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_RAW.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_RAW.setObjectName("Topic_RAW")
                sub_GridCal_1.addWidget(self.Topic_RAW, 1, 0, 1, 3)
            
                self.widget_7 = QtWidgets.QWidget(self.groupBox_cal)
                self.widget_7.setGeometry(QtCore.QRect(80, 250, 450, 120)) #result2W
                self.widget_7.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border: none")
                self.widget_7.setObjectName("widget_7")

                sub_GridCal_1 = QGridLayout(self.widget_7)
                self.label_6 = QtWidgets.QLabel(self.widget_7)#result2L
                self.label_6.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.label_6.setObjectName("label_6")
                sub_GridCal_1.addWidget( self.label_6,0,0)

                self.widget_8 = QtWidgets.QWidget(self.widget_7)#caliW2
                self.widget_8.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_8.setObjectName("widget_8")
                sub_GridCal_1.addWidget(self.widget_8,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_8)
                self.label_SNV = QtWidgets.QLabel(self.widget_8)#browse file2
                self.label_SNV.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_SNV.setAlignment(QtCore.Qt.AlignCenter)
                self.label_SNV.setObjectName("label_SNV")
                sub_GridCal_1_1.addWidget(self.label_SNV,0,0,1,3)

                self.Topic_SNV = QtWidgets.QLabel(self.widget_7)
                self.Topic_SNV.setGeometry(QtCore.QRect(10, 5, 300, 20)) #caliHeadL2
                self.Topic_SNV.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_SNV.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_SNV.setObjectName("Topic_SNV")
                sub_GridCal_1.addWidget(self.Topic_SNV, 1, 0, 1, 3)
                

                self.widget_9 = QtWidgets.QWidget(self.groupBox_cal)
                self.widget_9.setGeometry(QtCore.QRect(80, 400, 450, 120)) #result3W
                self.widget_9.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border:none")
                self.widget_9.setObjectName("widget_9")


                sub_GridCal_1 = QGridLayout(self.widget_9)
                self.label_7 = QtWidgets.QLabel(self.widget_9)#result3L
                self.label_7.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.label_7.setObjectName("label_7")
                sub_GridCal_1.addWidget( self.label_7,0,0)

                self.widget_22 = QtWidgets.QWidget(self.widget_9)#caliW3
                self.widget_22.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_22.setObjectName("widget_22")
                sub_GridCal_1.addWidget(self.widget_22,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_22)
                self.label_MSC = QtWidgets.QLabel(self.widget_22)#browse file3
                self.label_MSC.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_MSC.setAlignment(QtCore.Qt.AlignCenter)
                self.label_MSC.setObjectName("label_MSC")
                sub_GridCal_1_1.addWidget(self.label_MSC,0,0,1,3)

                self.Topic_MSC = QtWidgets.QLabel(self.widget_9)
                self.Topic_MSC.setGeometry(QtCore.QRect(10, 5, 300, 20)) #caliHeadL3
                self.Topic_MSC.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_MSC.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_MSC.setObjectName("Topic_MSC")
                sub_GridCal_1.addWidget(self.Topic_MSC, 1, 0, 1, 3)
                


                self.widget_28 = QtWidgets.QWidget(self.groupBox_cal)
                self.widget_28.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border:none")
                self.widget_28.setObjectName("widget_28")

                sub_GridCal_1 = QGridLayout(self.widget_28)
                self.label_8 = QtWidgets.QLabel(self.widget_28)
                self.label_8.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.label_8.setObjectName("label_8")
                sub_GridCal_1.addWidget( self.label_8,0,0)

                self.widget_29 = QtWidgets.QWidget(self.widget_28)
                self.widget_29.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_29.setObjectName("widget_29")
                sub_GridCal_1.addWidget(self.widget_29,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_29)
                self.label_1stDeri = QtWidgets.QLabel(self.widget_29)#result1
                self.label_1stDeri.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_1stDeri.setAlignment(QtCore.Qt.AlignCenter)
                self.label_1stDeri.setObjectName("label_1stDeri")
                sub_GridCal_1_1.addWidget(self.label_1stDeri,0,0,1,3)

                self.Topic_1stDerivative = QtWidgets.QLabel(self.widget_28)
                self.Topic_1stDerivative.setGeometry(QtCore.QRect(10, 5, 300, 20))
                self.Topic_1stDerivative.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_1stDerivative.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_1stDerivative.setObjectName("Topic_1stDerivative")
                sub_GridCal_1.addWidget(self.Topic_1stDerivative, 1, 0, 1, 3)
                
                self.label_22 = QtWidgets.QLabel(self.widget_28)
                self.label_22.setGeometry(QtCore.QRect(3, 5, 100, 20)) 
                self.label_22.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.label_22.setAlignment(QtCore.Qt.AlignCenter)
                self.label_22.setObjectName("label_22")
                sub_GridCal_1.addWidget(self.label_22, 1, 3 ,1 ,1)

                self.widget_30 = QtWidgets.QWidget(self.widget_28)#grab_1
                self.widget_30.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.widget_30.setObjectName("widget_30")
                sub_GridCal_1.addWidget(self.widget_30,2,3,1,1)

                sub_GridCal_4_1 = QGridLayout(self.widget_30)
                self.spinBox_7 = QtWidgets.QSpinBox(self.widget_30) #grab_1
                self.spinBox_7.setObjectName("spinBox_7")
                sub_GridCal_4_1.addWidget(self.spinBox_7, 0,0)
                self.spinBox_7.setMaximum(1000000)

                self.Seg_1st = QtWidgets.QLabel(self.widget_28)
                self.Seg_1st.setGeometry(QtCore.QRect(3, 5, 100, 20)) #grab_1
                self.Seg_1st.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Seg_1st.setAlignment(QtCore.Qt.AlignCenter)
                self.Seg_1st.setObjectName("Seg_1st")
                sub_GridCal_1.addWidget(self.Seg_1st, 1, 4 ,1 ,1)

                self.Seg_1st_W = QtWidgets.QWidget(self.widget_28)#spinBox_Seg_1st
                self.Seg_1st_W.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.Seg_1st_W.setObjectName("Seg_1st_W")
                sub_GridCal_1.addWidget(self.Seg_1st_W,2,4,1,1)

                sub_GridCal_4_2 = QGridLayout(self.Seg_1st_W)
                self.spinBox_Seg_1st = QtWidgets.QSpinBox(self.widget_30) #spinBox_Seg_1st
                self.spinBox_Seg_1st.setObjectName("spinBox_Seg_1st ")
                sub_GridCal_4_2.addWidget(self.spinBox_Seg_1st , 0,0)
                self.spinBox_Seg_1st.setMaximum(1000000)


                self.widget_35 = QtWidgets.QWidget(self.groupBox_cal)#2
                self.widget_35.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border:none")
                self.widget_35.setObjectName("widget_35")

                sub_GridCal_1 = QGridLayout(self.widget_35)
                self.label_9 = QtWidgets.QLabel(self.widget_35)#2
                self.label_9.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.label_9.setObjectName("label_8")

                sub_GridCal_1.addWidget( self.label_9,0,0)
                self.widget_36 = QtWidgets.QWidget(self.widget_35)#2
                self.widget_36.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_36.setObjectName("widget_36")
                sub_GridCal_1.addWidget(self.widget_36,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_36)
                self.label_2ndDeri = QtWidgets.QLabel(self.widget_36)#result 2
                self.label_2ndDeri.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_2ndDeri.setAlignment(QtCore.Qt.AlignCenter)
                self.label_2ndDeri.setObjectName("label_2ndDeri")
                sub_GridCal_1_1.addWidget(self.label_2ndDeri,0,0,1,3)

                self.Topic_2ndDerivative = QtWidgets.QLabel(self.widget_35)
                self.Topic_2ndDerivative.setGeometry(QtCore.QRect(10, 5, 300, 20)) #2
                self.Topic_2ndDerivative.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_2ndDerivative.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_2ndDerivative.setObjectName("Topic_2ndDerivative")
                sub_GridCal_1.addWidget(self.Topic_2ndDerivative, 1, 0, 1, 3)
                
                self.label_24 = QtWidgets.QLabel(self.widget_35)
                self.label_24.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.label_24.setAlignment(QtCore.Qt.AlignCenter)
                self.label_24.setObjectName("label_24")
                sub_GridCal_1.addWidget(self.label_24, 1, 3 ,1 ,1)

                self.widget_41 = QtWidgets.QWidget(self.widget_35)#grab2
                self.widget_41.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.widget_41.setObjectName("widget_41")
                sub_GridCal_1.addWidget(self.widget_41,2,3,1,1)
                
                sub_GridCal_5_1 = QGridLayout(self.widget_41)
                self.spinBox_8 = QtWidgets.QSpinBox(self.widget_41)#grab2
                self.spinBox_8.setObjectName("spinBox_8")
                sub_GridCal_5_1.addWidget(self.spinBox_8, 0,0)
                self.spinBox_8.setMaximum(1000000)

                self.Seg_2nd = QtWidgets.QLabel(self.widget_35)
                self.Seg_2nd.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Seg_2nd.setAlignment(QtCore.Qt.AlignCenter)
                self.Seg_2nd.setObjectName("Seg_2nd")
                sub_GridCal_1.addWidget(self.Seg_2nd, 1, 4 ,1 ,1)

                self.Seg_2nd_W = QtWidgets.QWidget(self.widget_35)#Seg_2nd_W
                self.Seg_2nd_W.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.Seg_2nd_W.setObjectName("Seg_2nd_W")
                sub_GridCal_1.addWidget(self.Seg_2nd_W,2,4,1,1)
                
                sub_GridCal_5_2 = QGridLayout(self.Seg_2nd_W)
                self.spinBox_Seg_2nd = QtWidgets.QSpinBox(self.Seg_2nd_W)#Seg_2nd_W
                self.spinBox_Seg_2nd.setObjectName("spinBox_Seg_2nd")
                sub_GridCal_5_2.addWidget(self.spinBox_Seg_2nd, 0,0)
                self.spinBox_Seg_2nd.setMaximum(1000000)

                self.Smoothing = QtWidgets.QWidget(self.groupBox_cal)#Smoothing
                self.Smoothing.setStyleSheet("background-color:rgb(158, 158, 158);\n"
        "border:none")
                self.Smoothing.setObjectName("Smoothing")

                sub_GridCal_6 = QGridLayout(self.Smoothing)
                self.tmp = QtWidgets.QLabel(self.Smoothing)#Smoothing
                self.tmp.setStyleSheet("align:\"center\";\n" "font-size:10pt;\n" "color:#fff")
                self.tmp.setObjectName("tmp")

                sub_GridCal_6.addWidget(self.tmp,0,0)

                self.widget_Smoothing = QtWidgets.QWidget(self.Smoothing)#Smoothing
                self.widget_Smoothing.setStyleSheet("background-color: rgb(255, 255, 255);\n"
        "border-radius: 0px;")
                self.widget_Smoothing.setObjectName("widget_Smoothing")
                sub_GridCal_6.addWidget(self.widget_Smoothing,2,0,1,3)

                sub_GridCal_1_1 = QGridLayout(self.widget_Smoothing)
                self.label_Smoothing = QtWidgets.QLabel(self.widget_Smoothing)#label_Smoothing
                self.label_Smoothing.setStyleSheet("background-color: rgb(255, 255, 255);\n""align:\"center\";\n" "font-size:5pt;\n" "color:#000;")
                self.label_Smoothing.setAlignment(QtCore.Qt.AlignCenter)
                self.label_Smoothing.setObjectName("label_2ndDeri")
                sub_GridCal_1_1.addWidget(self.label_Smoothing,0,0,1,3)

                self.Topic_Smoothing = QtWidgets.QLabel(self.Smoothing)
                self.Topic_Smoothing.setGeometry(QtCore.QRect(10, 5, 300, 20)) #2
                self.Topic_Smoothing.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Topic_Smoothing.setAlignment(QtCore.Qt.AlignCenter)
                self.Topic_Smoothing.setObjectName("Topic_Smoothing")
                sub_GridCal_6.addWidget(self.Topic_Smoothing, 1, 0, 1, 3)
                
                self.grab_Smoothing = QtWidgets.QLabel(self.Smoothing)
                self.grab_Smoothing.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.grab_Smoothing.setAlignment(QtCore.Qt.AlignCenter)
                self.grab_Smoothing.setObjectName("grab_Smoothing")
                sub_GridCal_6.addWidget(self.grab_Smoothing, 1, 3 ,1 ,1)

                self.grab_Smoothing_w = QtWidgets.QWidget(self.Smoothing)#grab2
                self.grab_Smoothing_w.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.grab_Smoothing_w.setObjectName("grab_Smoothing_w")
                sub_GridCal_6.addWidget(self.grab_Smoothing_w,2,3,1,1)
                
                sub_GridCal_6_1 = QGridLayout(self.grab_Smoothing_w)
                self.spinBox_grab_Smoothing_w = QtWidgets.QSpinBox(self.grab_Smoothing_w)#grab2
                self.spinBox_grab_Smoothing_w.setObjectName("grab_Smoothing_w")
                sub_GridCal_6_1.addWidget(self.spinBox_grab_Smoothing_w, 0,0)
                self.spinBox_grab_Smoothing_w.setMaximum(1000000)

                self.Seg_Smoothing = QtWidgets.QLabel(self.Smoothing)
                self.Seg_Smoothing.setStyleSheet("background-color: rgb(236, 236, 236);\n"
        "border-radius:15px 50px 30px 5px;\n" "align:\"center\";\n"
        "font-size:8pt;")
                self.Seg_Smoothing.setAlignment(QtCore.Qt.AlignCenter)
                self.Seg_Smoothing.setObjectName("Seg_Smoothing")
                sub_GridCal_6.addWidget(self.Seg_Smoothing, 1, 4 ,1 ,1)

                self.Seg_Smoothing_W = QtWidgets.QWidget(self.widget_35)#Seg_Smoothing
                self.Seg_Smoothing_W.setStyleSheet("border-radius: 0px;\n"
        "background-color: rgb(255, 255, 255);")
                self.Seg_Smoothing_W.setObjectName("Seg_Smoothing_W")
                sub_GridCal_6.addWidget(self.Seg_Smoothing_W,2,4,1,1)
                
                sub_GridCal_6_2 = QGridLayout(self.Seg_Smoothing_W)
                self.spinBox_Seg_Smoothing = QtWidgets.QSpinBox(self.Seg_Smoothing_W)#Seg_Smoothing
                self.spinBox_Seg_Smoothing.setObjectName("spinBox_Seg_Smoothing")
                sub_GridCal_6_2.addWidget(self.spinBox_Seg_Smoothing, 0,0)
                self.spinBox_Seg_Smoothing.setMaximum(1000000)

                sub_groupbox_cal.addWidget(self.Label , 0 , 0 , 1 , 6)
                sub_groupbox_cal.addWidget(self.widget_4 , 1 , 1 , 1 , 4)
                sub_groupbox_cal.addWidget(self.widget_7 , 2 , 1 , 1 , 4)
                sub_groupbox_cal.addWidget(self.widget_9 , 3 , 1 , 1 , 4)
                sub_groupbox_cal.addWidget(self.widget_28 , 4 , 1 , 1 , 4)
                sub_groupbox_cal.addWidget(self.widget_35 , 5 , 1 , 1 , 4)
                sub_groupbox_cal.addWidget(self.Smoothing , 6 , 1 , 1 , 4)


                self.groupBox_Spec = QtWidgets.QGroupBox(self.body)
                self.groupBox_Spec.setStyleSheet("border-radius: 5px;\n"
        "border: 2px solid black")
                self.groupBox_Spec.setObjectName("groupBox_Spec")

                sub_GridSpec = QGridLayout(self.groupBox_Spec)

                self.groupBox_Spec_integration = QtWidgets.QGroupBox(self.groupBox_Spec)
                self.groupBox_Spec_integration.setStyleSheet("border-radius: 0px;\n"
        "border: 0px solid black;\n background-color: transparent;")

                sub_groupBox_Spec_integration = QGridLayout(self.groupBox_Spec_integration)

                self.Label_STEP = QtWidgets.QLabel(self.groupBox_Spec_integration)
                self.Label_STEP.setStyleSheet("color:black;\n"
                "border: none;\n" "font-size:14pt bold;\n")

                self.widget_6 = QtWidgets.QWidget(self.groupBox_Spec_integration)
                self.widget_6.setStyleSheet("\n"
        "background-color: rgb(153, 153, 153);\n"
        "border:none;\n")
                self.widget_6.setObjectName("widget_6")

                integration = QGridLayout(self.widget_6)

                self.label_step1 = QtWidgets.QLabel()
                self.label_step1.setStyleSheet("align:\"center\";\n"
        "font-size: 10pt;")
                self.label_step1.setObjectName("label_step1")

                self.comboBox = QtWidgets.QComboBox(self.widget_6)
                self.comboBox.setObjectName("comboBox")
                self.comboBox.addItem("")
                self.comboBox.addItem("")
                self.comboBox.addItem("")
                self.comboBox.addItem("")
                self.comboBox.addItem("")
                self.comboBox.addItem("")
                self.comboBox.addItem("")

                self.comboBox.setStyleSheet("\n""background-color: rgb(255, 255, 255);\n"
        "border:none;\n align: \"center\";\n""font-size: 10pt;\n")

                self.label_step2 = QtWidgets.QLabel()
                self.label_step2.setStyleSheet("align:\"center\";\n"
        "font-size: 10pt;")
                self.label_step2.setObjectName("label_step2")
                self.comboBox2 = QtWidgets.QComboBox(self.widget_6)
                self.comboBox2.setObjectName("comboBox2")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")
                self.comboBox2.addItem("")

                self.comboBox2.setStyleSheet("\n""background-color: rgb(255, 255, 255);\n"
        "border:none;\n align: \"center\";\n""font-size: 10pt;\n")


                self.label_step3 = QtWidgets.QLabel()
                self.label_step3.setStyleSheet("align:\"center\";\n"
        "font-size: 10pt;")
                self.label_step3.setObjectName("label_step3")
                self.comboBox3 = QtWidgets.QComboBox(self.widget_6)
                self.comboBox3.setObjectName("comboBox2")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")
                self.comboBox3.addItem("")

                self.comboBox3.setStyleSheet("\n""background-color: rgb(255, 255, 255);\n"
        "border:none;\n align: \"center\";\n""font-size: 10pt;\n")


                integration.addWidget(self.label_step1,0,0)
                integration.addWidget(self.comboBox ,0,1)
                integration.addWidget(self.label_step2,1,0)
                integration.addWidget(self.comboBox2 ,1,1)
                integration.addWidget(self.label_step3,2,0)
                integration.addWidget(self.comboBox3 ,2,1)

                self.Export = QtWidgets.QPushButton(self.groupBox_Spec_integration)
                self.Export.setStyleSheet("border-radius:30px;\n"
        "background-color:rgb(0, 170, 0);\n"
        "font-size:24px;\n"
        "color:#fff;")
                self.Export.setObjectName("Export")
                self.Export.setText("Export")
                sub_groupBox_Spec_integration.addWidget(self.Label_STEP,0,0)
                sub_groupBox_Spec_integration.addWidget(self.widget_6,1,0)
                sub_groupBox_Spec_integration.addWidget(QtWidgets.QLabel(""),2,0)
                sub_groupBox_Spec_integration.addWidget(self.Export,3,0)



                self.groupBox_Spec_Wave = QtWidgets.QGroupBox(self.groupBox_Spec)
                self.groupBox_Spec_Wave.setStyleSheet("border-radius: 0px;\n"
        "border: 0px solid black;\nbackground-color: transparent;")
                sub_groupBox_Spec_Wave  = QGridLayout(self.groupBox_Spec_Wave)

                self.Label_Wave = QtWidgets.QLabel(self.groupBox_Spec_Wave)
                self.Label_Wave.setStyleSheet("color:black;\n"
                "border: none;\n" "font-size:14pt bold;\n")
                self.Label_Wave.setObjectName("Label_Wave")

                self.widget_name = QtWidgets.QLineEdit(self.groupBox_Spec_Wave)
                self.widget_name.setStyleSheet("\n"
        "background-color: rgb(255, 255, 255);\n"
        "border: 2px solid black;\n font-size:14pt bold;\n")
                self.widget_name.setObjectName("widget_name")
                self.widget_name.move(0, 200)
                self.widget_name.resize(295,40)

                sub_groupBox_Spec_Wave.addWidget(self.Label_Wave,0,0)
                # sub_groupBox_Spec_Wave.addWidget(self.widget_name,1,0)

                # sub_groupBox_Spec_Wave(200)
                sub_GridSpec.addWidget(self.groupBox_Spec_integration,0,0)
                sub_GridSpec.addWidget(self.groupBox_Spec_Wave,1,0)
                # sub_GridSpec.addWidget(self.widget_name,3,0)


                subBody_gridLayout.addWidget(self.groupBox_cal,0,0,1,3)
                subBody_gridLayout.addWidget(self.groupBox_Spec,0,3,1,1)

                gridLayout.addWidget(self.body,0, 0, 5, 6)

                self.frame = QtWidgets.QFrame(self.centralwidget)
                self.frame.setLocale(QtCore.QLocale(QtCore.QLocale.Thai, QtCore.QLocale.Thailand))
                self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
                self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
                self.frame.setProperty("Color", QtGui.QColor(0, 0, 0))
                self.frame.setObjectName("frame")

                sub_gridLayout = QGridLayout(self.frame)
                self.pushButton_4 = QtWidgets.QPushButton(self.frame)
                self.pushButton_4.setStyleSheet("border-radius:30px;\n"
        "background-color:rgb(0, 170, 0);\n"
        "font-size:24px;\n"
        "color:#fff;")
                self.pushButton_4.setObjectName("pushButton_4")
                self.pushButton_3 = QtWidgets.QPushButton(self.frame)
                self.pushButton_3.setStyleSheet("border-radius:30px;\n"
        "background-color:#aa0000;\n"
        "font-size:24px;\n"
        "color:#fff;")
                self.pushButton_3.setObjectName("pushButton_3")

                self.pushButton_4.setFixedHeight(80)
                self.pushButton_3.setFixedHeight(80)

                sub_gridLayout.addWidget(QtWidgets.QLabel(self.body),0,0)
                sub_gridLayout.addWidget(self.pushButton_4,0,1)
                sub_gridLayout.addWidget(QtWidgets.QLabel(self.body),0,2)
                sub_gridLayout.addWidget(self.pushButton_3,0,3)
                sub_gridLayout.addWidget(QtWidgets.QLabel(self.body),0,4)

                gridLayout.addWidget(self.frame,5, 0, 1, 6)

                

                self.groupBox.setLayout(gridLayout)
                lay.addWidget(self.groupBox)
                # lay.addStretch()
                self.Label_STEP.setAlignment(QtCore.Qt.AlignCenter)
                self.Label_Wave.setAlignment(QtCore.Qt.AlignCenter)
                # scroll.setFixedHeight(960)
                # scroll.setFixedWidth(1280)
                self.box.addWidget(scroll)
                self.pushButton_3.clicked.connect(self.close)
                # self.retranslateUi(MainWindow)

        
        
        # # def setIcon(self):
        # #         appIcon = QIcon("icon.png")
        # #         MainWindow.setWindowIcon(appIcon)
        # def retranslateUi(self, MainWindow):
        #     _translate = QtCore.QCoreApplication.translate
                self.Label.setText("Pre-Processing")
                self.Topic_RAW.setText("RAW")
                self.label_RAW.setText("...")
                self.Topic_SNV.setText("SNV")
                self.label_SNV.setText("...")
                self.Topic_MSC.setText("MSC")
                self.label_MSC.setText("...")
                self.Topic_2ndDerivative.setText("2nd Derivative")
                self.label_2ndDeri.setText("...")
                self.label_1stDeri.setText("...")
                self.label_Smoothing.setText("...")

                self.grab_Smoothing.setText("Gab")
                self.Seg_Smoothing.setText("Segment")
                self.Topic_Smoothing.setText("Smoothing size")

                self.label_24.setText("Gab")
                self.Seg_2nd.setText("Segment")
                self.Topic_1stDerivative.setText("1st Derivative")
                self.label_22.setText("Gab")
                self.Seg_1st.setText("Segment")

                self.Label_STEP.setText("CALCULATION STEP")
                self.label_step1.setText("Step 1")
                self.comboBox.setItemText(0, "---select---")
                self.comboBox.setItemText(1, "RAW")
                self.comboBox.setItemText(2, "SNV")
                self.comboBox.setItemText(3, "MSC")
                self.comboBox.setItemText(4, "1st Derivative")
                self.comboBox.setItemText(5,"2nd Derivative")
                self.comboBox.setItemText(6,"Smoothing Size")
                self.label_step2.setText("Step 2")
                self.comboBox2.setItemText(0,"---select---")
                self.comboBox2.setItemText(1,"RAW")
                self.comboBox2.setItemText(2,"SNV")
                self.comboBox2.setItemText(3,"MSC")
                self.comboBox2.setItemText(4,"1st Derivative")
                self.comboBox2.setItemText(5,"2nd Derivative")
                self.comboBox2.setItemText(6,"Smoothing Size")

                self.label_step3.setText("Step 3")
                self.comboBox3.setItemText(0,"---select---")
                self.comboBox3.setItemText(1, "RAW")
                self.comboBox3.setItemText(2,"SNV")
                self.comboBox3.setItemText(3, "MSC")
                self.comboBox3.setItemText(4,"1st Derivative")
                self.comboBox3.setItemText(5,"2nd Derivative")
                self.comboBox3.setItemText(6,"Smoothing Size")


                self.Label_Wave.setText("Username")
                self.widget_name.setText("Type your name...")
                self.pushButton_3.setText("CANCEL")
                self.pushButton_4.setText("APPLY")
Beispiel #14
0
        def __init__(self):
            QDialog.__init__(self)

            grid = QGridLayout()
            grid.setSpacing(12)

            self.setWindowTitle("Invoeren Loontabel")
            self.setWindowIcon(QIcon('./images/logos/logo.jpg'))

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

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

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

            grid.addWidget(QLabel('        Invoeren Loonschalen'), 0, 0, 1, 3,
                           Qt.AlignCenter)

            self.Loontabelnummer = QLabel()
            q1Edit = QLineEdit(str(mloonnr))
            q1Edit.setAlignment(Qt.AlignRight)
            q1Edit.setStyleSheet("color: black")
            q1Edit.setFixedWidth(100)
            q1Edit.setDisabled(True)
            q1Edit.setFont(QFont("Arial", 10))

            self.Omschrijving = QLabel()
            q2Edit = QLineEdit()
            q2Edit.setFixedWidth(320)
            q2Edit.setFont(QFont("Arial", 10))
            q2Edit.textChanged.connect(self.q2Changed)

            self.Maandloon = QLabel()
            q3Edit = QLineEdit()
            q3Edit.setFixedWidth(100)
            q3Edit.setFont(QFont("Arial", 10))
            q3Edit.textChanged.connect(self.q3Changed)
            reg_ex = QRegExp("^[0-9]*\.?[0-9]+$")
            input_validator = QRegExpValidator(reg_ex, q3Edit)
            q3Edit.setValidator(input_validator)

            self.Tabelloon = QLabel()
            q4Edit = QLineEdit()
            q4Edit.setFixedWidth(100)
            q4Edit.setFont(QFont("Arial", 10))
            q4Edit.textChanged.connect(self.q4Changed)
            reg_ex = QRegExp("^[0-9]*\.?[0-9]+$")
            input_validator = QRegExpValidator(reg_ex, q4Edit)
            q4Edit.setValidator(input_validator)

            self.Reisuurloon = QLabel()
            q6Edit = QLineEdit()
            q6Edit.setFixedWidth(100)
            q6Edit.setFont(QFont("Arial", 10))
            q6Edit.textChanged.connect(self.q6Changed)
            reg_ex = QRegExp("^[0-9]*\.?[0-9]+$")
            input_validator = QRegExpValidator(reg_ex, q6Edit)
            q6Edit.setValidator(input_validator)

            lbl1 = QLabel('Loontabelnummer')
            grid.addWidget(lbl1, 1, 0)
            grid.addWidget(q1Edit, 1, 1)

            lbl2 = QLabel('Functieomschrijving')
            grid.addWidget(lbl2, 2, 0)
            grid.addWidget(q2Edit, 2, 1, 1, 2)

            lbl3 = QLabel('Maandloon')
            grid.addWidget(lbl3, 3, 0)
            grid.addWidget(q3Edit, 3, 1)

            lbl5 = QLabel('Tabeluurloon')
            grid.addWidget(lbl5, 4, 0)
            grid.addWidget(q4Edit, 4, 1)

            lbl7 = QLabel('Reisuurloon')
            grid.addWidget(lbl7, 5, 0)
            grid.addWidget(q6Edit, 5, 1)

            lbl8 = QLabel('Wijzigingsdatum')
            lbl9 = QLabel(mboekd)
            grid.addWidget(lbl8, 6, 0)
            grid.addWidget(lbl9, 6, 1)

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

            grid.addWidget(wijzig, 7, 1, 1, 2, Qt.AlignRight)
            wijzig.setFont(QFont("Arial", 10))
            wijzig.setFixedWidth(100)

            sluit = QPushButton('Sluit')
            sluit.clicked.connect(lambda: windowSluit(self, m_email))

            grid.addWidget(sluit, 7, 1, 1, 2, Qt.AlignCenter)
            sluit.setFont(QFont("Arial", 10))
            sluit.setFixedWidth(100)

            grid.addWidget(
                QLabel('\u00A9 2017 all rights reserved [email protected]'),
                8, 0, 1, 3, Qt.AlignCenter)

            self.setLayout(grid)
            self.setGeometry(100, 50, 150, 150)
Beispiel #15
0
    def __init__(self, main, op):
        """
        Class for edit category, actor, character, box, media and keyword
        according given op.

        :param main: Reference for main windows.
        :param op: String representing the class to be edited.
        """
        super(EditOthers, self).__init__()

        self.main = main
        self.op = op
        self.session = DB.get_session()
        self.cls = None
        self.obj = None

        self.name = ''
        if self.op == 'category':
            self.cls = Category
            self.name = texts.category_s
        elif self.op == 'actor':
            self.cls = Actor
            self.name = texts.actor_s
        elif self.op == 'character':
            self.cls = Character
            self.name = texts.character_s
        elif self.op == 'box':
            self.cls = Box
            self.name = texts.box
        elif self.op == 'media':
            self.cls = Media
            self.name = texts.media_s
        elif self.op == 'keyword':
            self.cls = Keyword
            self.name = texts.keyword

        self.window_title = texts.edit + ' ' + self.name
        self.setWindowTitle(self.window_title)
        self.setGeometry(0, 0, 511, 205)

        self.subwindow = QWidget()
        p = self.palette()
        p.setColor(self.backgroundRole(), QColor(230, 230, 250))
        self.setPalette(p)
        self.setWidget(self.subwindow)

        font = QFont()
        font.setPointSize(11)

        # Vbox Main
        self.vbox_main = QVBoxLayout(self.subwindow)
        self.vbox_main.setContentsMargins(20, 20, 20, 20)
        self.vbox_main.setSpacing(10)

        # Select Label and Combobox
        objs = db_select_all(self.session, self.cls)
        text = texts.select + ' ' + self.name
        self.lb_select = QLabel(text)
        self.lb_select.setFont(font)
        self.lb_select.setFixedHeight(25)
        self.cb_select = cb_create('')
        self.cb_select.setFont(font)
        self.cb_select.setFixedHeight(30)
        populate_combobox(self.cb_select, objs)
        self.cb_select.setEditable(False)
        self.vbox_main.addWidget(self.lb_select)
        self.vbox_main.addWidget(self.cb_select)

        # PB Select
        self.pb_select = pb_create(texts.pb_leave)
        self.pb_select.setFixedHeight(40)
        self.pb_select.setEnabled(True)
        self.pb_select.setHidden(False)
        self.pb_select.clicked.connect(self.close)

        self.pb_help_1 = pb_create(texts.pb_help)
        self.pb_help_1.setFixedHeight(40)
        self.pb_help_1.setEnabled(True)
        self.pb_help_1.setHidden(False)
        self.pb_help_1.clicked.connect(self.help)
        self.pb_help_1.setShortcut('Ctrl+H')

        self.hbox_select = QHBoxLayout()
        spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                             QSizePolicy.Minimum)
        self.hbox_select.addItem(spacer)
        self.hbox_select.addWidget(self.pb_select)
        self.hbox_select.addWidget(self.pb_help_1)
        self.hbox_select.addItem(spacer)
        self.vbox_main.addLayout(self.hbox_select)

        # Title
        text = texts.actual_value + ' ' + self.name
        self.lb = QLabel(text)
        self.lb.setFont(font)
        self.lb.setFixedHeight(25)
        self.le = le_create()
        self.le.setFont(font)
        self.lb.setEnabled(False)
        self.lb.setHidden(True)
        self.le.setEnabled(False)
        self.le.setHidden(True)
        self.vbox_main.addWidget(self.lb)
        self.vbox_main.addWidget(self.le)

        # Buttons
        self.pb_save = pb_create(texts.pb_save)
        self.pb_save.setShortcut('Ctrl+S')
        self.pb_save.clicked.connect(self.edit_object)
        self.pb_save.setMaximumHeight(40)

        self.pb_help_2 = pb_create(texts.pb_help)
        self.pb_help_2.clicked.connect(self.help)
        self.pb_help_2.setShortcut('Ctrl+H')
        self.pb_help_2.setMaximumHeight(40)

        self.pb_leave = pb_create(texts.pb_leave)
        self.pb_leave.clicked.connect(self.close)
        self.pb_leave.setShortcut('Ctrl+Q')
        self.pb_leave.setMaximumHeight(40)

        self.hb_pb = hbox_create([self.pb_save, self.pb_help_2, self.pb_leave])

        self.pb_save.setEnabled(False)
        self.pb_save.setHidden(True)
        self.pb_help_2.setEnabled(False)
        self.pb_help_2.setHidden(True)
        self.pb_leave.setEnabled(False)
        self.pb_leave.setHidden(True)

        self.vbox_main.addLayout(self.hb_pb)

        self.cb_select.currentIndexChanged.connect(self.obj_selected)
Beispiel #16
0
    def __init__(self, *args, **kwargs):
        super(TitleBarUI, self).__init__(*args, **kwargs)
        self._mouse_pos = None  # 方向记录

        main_layout = QHBoxLayout()

        self.title_icon = QLabel(self)  # 图标
        self.title_icon.setPixmap(QPixmap("media/logo.png"))
        self.title_icon.setScaledContents(True)
        main_layout.addWidget(self.title_icon, alignment=Qt.AlignLeft)

        self.title_text = QLabel(WINDOW_TITLE, self)
        main_layout.addWidget(self.title_text, alignment=Qt.AlignLeft)

        main_layout.addStretch()  # 撑开按钮与标题图标的

        # 最大、小、隐藏按钮
        font = QFont()
        font.setFamily('Webdings')

        self.minimum_button = QPushButton('0', self)
        self.minimum_button.setFont(font)
        self.minimum_button.clicked.connect(self.window_shown_minimum)
        self.minimum_button.setFocusPolicy(Qt.NoFocus)
        main_layout.addWidget(self.minimum_button,
                              alignment=Qt.AlignRight | Qt.AlignTop)

        self.maximum_button = QPushButton('1', self)
        self.maximum_button.setFont(font)
        self.maximum_button.clicked.connect(self.window_shown_maximum)
        self.maximum_button.setFocusPolicy(Qt.NoFocus)
        main_layout.addWidget(self.maximum_button,
                              alignment=Qt.AlignRight | Qt.AlignTop)

        self.close_button = QPushButton('r', self)
        self.close_button.setFont(font)
        self.close_button.clicked.connect(self.window_closed)
        self.close_button.setFocusPolicy(Qt.NoFocus)
        main_layout.addWidget(self.close_button,
                              alignment=Qt.AlignRight | Qt.AlignTop)

        self.menu_bar_layout = QHBoxLayout()
        self.menu_bar = QMenuBar(self)

        main_layout.addLayout(self.menu_bar_layout)

        self.setLayout(main_layout)

        # 样式,相关属性,大小设置
        main_layout.setContentsMargins(QMargins(2, 0, 0, 0))
        main_layout.setSpacing(0)
        self.setFixedHeight(TITLE_BAR_HEIGHT)
        self.title_icon.setFixedSize(TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT)
        self.title_icon.setMargin(4)
        self.title_text.setMargin(3)
        self.minimum_button.setFixedSize(TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT)
        self.maximum_button.setFixedSize(TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT)
        self.close_button.setFixedSize(TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT)
        self.minimum_button.setObjectName('minimumButton')
        self.maximum_button.setObjectName('maximumButton')
        self.close_button.setObjectName('closeButton')
        self.setAttribute(Qt.WA_StyledBackground, True)
        self.setObjectName('titleBar')
        self.title_text.setObjectName('titleText')
        self.setStyleSheet(
            "#titleBar{background-color:rgb(34,102,175);border-top-left-radius:5px;border-top-right-radius:5px;}"
            "#titleText{color:rgb(245,245,245)}"
            "#minimumButton,#maximumButton{border:none;background-color:rgb(34,102,175);}"
            "#closeButton{border:none;background-color:rgb(34,102,175);border-top-right-radius:5px;}"
            "#minimumButton:hover,#maximumButton:hover{background-color:rgb(33,165,229)}"
            "#closeButton:hover{background-color:rgb(200,49,61);border-top-right-radius:5px;}"
            "#minimumButton:pressed,#maximumButton:pressed{background-color:rgb(37,39,41)}"
            "#closeButton:pressed{color:white;background-color:rgb(161,73,92);border-top-right-radius:5px;}"
        )
    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 15))
        self.setFont(QFont('cairo', 12))
        self.setToolTip(self.__lang_strings['mainWindow']['toolTip'])
        #print(type(self.__lang_strings['mainWindow']['width']))

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

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

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

        combo = QComboBox(self)
        combo.addItem(self.__models_set[0])
        combo.addItem(self.__models_set[1])
        combo.addItem(self.__models_set[2])
        '''
        combo.addItem("Desision Tree")
        combo.addItem("Tokenizer")
        combo.addItem("RNN (Recurrent Neural Network)")
        combo.addItem("CNN (Convolutional Neural Network)")
        '''         
        self.resultEdit = QTextEdit()
        self.inputTextEdit = QTextEdit()
        review = QLabel(self.__lang_strings['textLabels']['review'])
        resultLbl = QLabel(self.__lang_strings['textLabels']['result'])
        #Creating layout
        hboxCombo = QHBoxLayout()
        hboxCombo.addStretch(1)
        hboxCombo.addWidget(combo)
        hboxCombo.addWidget(loadModelBtn)
        combo.activated[str].connect(self.onActivated) 
        
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(btn)
        hbox.addWidget(qbtn)
        
        vbox = QVBoxLayout()
        vbox.addLayout(hboxCombo)
        vbox.addWidget(review)
        vbox.addWidget(self.inputTextEdit)
        vbox.addWidget(resultLbl)
        vbox.addWidget(self.resultEdit)
        #vbox.addStretch(1)
        vbox.addLayout(hbox)
        
        self.centralWidget().setLayout(vbox) 
        
        
        self.setGeometry(300, 300, self.__lang_strings['mainWindow']['width'],
        self.__lang_strings['mainWindow']['height'])
        self.show()
        '''
Beispiel #18
0
    def add_hook(self, emulator, instruction):
        # check if the previous hook is waiting for a register result
        if self._require_register_result is not None:
            res = '%s = %s' % (
                self._require_register_result[1],
                hex(emulator.uc.reg_read(self._require_register_result[0])))
            self.setItem(self.rowCount() - 1, 4,
                         NotEditableTableWidgetItem(res))
            # invalidate
            self._require_register_result = None

        # check if the code jumped
        if self._last_instruction_address > 0:
            if instruction.address > self._last_instruction_address + self.app.get_dwarf().pointer_size or\
                    instruction.address < self._last_instruction_address:
                # insert an empty line
                self.insertRow(self.rowCount())
        self._last_instruction_address = instruction.address

        row = self.rowCount()
        self.insertRow(row)

        address = instruction.address
        if instruction.thumb:
            address = address | 1
        w = MemoryAddressWidget('0x%x' % address)
        w.setFlags(Qt.NoItemFlags)
        w.setForeground(Qt.red)
        self.setItem(row, 0, w)

        w = NotEditableTableWidgetItem(
            binascii.hexlify(instruction.bytes).decode('utf8'))
        w.setFlags(Qt.NoItemFlags)
        w.setForeground(Qt.darkYellow)
        self.setItem(row, 1, w)

        if instruction.is_jump and instruction.jump_address != 0:
            w = MemoryAddressWidget(instruction.op_str)
            w.set_address(instruction.jump_address)
        else:
            w = NotEditableTableWidgetItem(instruction.op_str)
            w.setFlags(Qt.NoItemFlags)
            w.setForeground(Qt.lightGray)
        self.setItem(row, 3, w)

        w = NotEditableTableWidgetItem(instruction.mnemonic.upper())
        w.setFlags(Qt.NoItemFlags)
        w.setForeground(Qt.white)
        w.setTextAlignment(Qt.AlignCenter)
        w.setFont(QFont(None, 11, QFont.Bold))
        self.setItem(row, 2, w)

        # implicit regs read are notified later through mem access
        if len(instruction.regs_read) == 0:
            if len(instruction.operands) > 0:
                for i in instruction.operands:
                    if i.type == CS_OP_REG:
                        self._require_register_result = [
                            i.value.reg,
                            instruction.reg_name(i.value.reg)
                        ]
                        break

        if instruction.symbol_name is not None:
            w = NotEditableTableWidgetItem(
                '%s (%s)' %
                (instruction.symbol_name, instruction.symbol_module))
            w.setFlags(Qt.NoItemFlags)
            w.setForeground(Qt.lightGray)
            self.setItem(row, 4, w)

        self.scrollToBottom()
Beispiel #19
0
    def initUI(self):
        self.resize(800, 600)
        self.setWindowIcon(QIcon('./images/icon.png'))
        self.setWindowTitle('myOCR——启动界面')

        self.titleLabel = QLabel(self)
        pixmap = QPixmap('./images/title.png')
        self.titleLabel.setPixmap(pixmap)
        self.h1box = QHBoxLayout()
        self.h1box.addStretch(1)
        self.h1box.addWidget(self.titleLabel)
        self.h1box.addStretch(1)

        self.basicbtn = QPushButton(self)
        self.basicbtn.setText("普通文字识别")
        self.basicbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.basicbtn.setFixedSize(180, 45)
        self.basicbtn.clicked.connect(self.basicrecognizedialog)
        self.idcardbtn = QPushButton(self)
        self.idcardbtn.setText("身份证识别")
        self.idcardbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.idcardbtn.setFixedSize(180, 45)
        self.idcardbtn.clicked.connect(self.idcardrecognizedialog)
        self.bankcardbtn = QPushButton(self)
        self.bankcardbtn.setText("银行卡识别")
        self.bankcardbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.bankcardbtn.setFixedSize(180, 45)
        self.bankcardbtn.clicked.connect(self.bankcardrecognizedialog)
        self.h2box = QHBoxLayout()
        self.h2box.addStretch(1)
        self.h2box.addWidget(self.basicbtn)
        self.h2box.addStretch(1)
        self.h2box.addWidget(self.idcardbtn)
        self.h2box.addStretch(1)
        self.h2box.addWidget(self.bankcardbtn)
        self.h2box.addStretch(1)

        self.drivecardbtn = QPushButton(self)
        self.drivecardbtn.setText("驾驶证识别")
        self.drivecardbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.drivecardbtn.setFixedSize(180, 45)
        self.drivecardbtn.clicked.connect(self.drivecardrecognizedialog)
        self.carcardbtn = QPushButton(self)
        self.carcardbtn.setText("行驶证识别")
        self.carcardbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.carcardbtn.setFixedSize(180, 45)
        self.carcardbtn.clicked.connect(self.carcardrecognizedialog)
        self.platecardbtn = QPushButton(self)
        self.platecardbtn.setText("车牌识别")
        self.platecardbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.platecardbtn.setFixedSize(180, 45)
        self.platecardbtn.clicked.connect(self.platecardrecognize)
        self.h3box = QHBoxLayout()
        self.h3box.addStretch(1)
        self.h3box.addWidget(self.drivecardbtn)
        self.h3box.addStretch(1)
        self.h3box.addWidget(self.carcardbtn)
        self.h3box.addStretch(1)
        self.h3box.addWidget(self.platecardbtn)
        self.h3box.addStretch(1)

        self.hbtn = QPushButton(self)
        self.hbtn.setText("我的识别历史")
        self.hbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.hbtn.clicked.connect(self.myhistorydialog)
        self.hbtn.setFixedSize(160, 40)
        self.abtn = QPushButton(self)
        self.abtn.setText("关    于")
        self.abtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.abtn.clicked.connect(self.aboutdialog)
        self.abtn.setFixedSize(160, 40)
        self.qbtn = QPushButton(self)
        self.qbtn.setText("退    出")
        self.qbtn.setFont(QFont("苏新诗柳楷繁", 15))
        self.qbtn.clicked.connect(QCoreApplication.instance().quit)
        self.qbtn.setFixedSize(160, 40)
        self.hbbox = QHBoxLayout()
        self.hbbox.addStretch(1)
        self.hbbox.addWidget(self.hbtn)
        self.hbbox.addStretch(1)
        self.hbbox.addWidget(self.abtn)
        self.hbbox.addStretch(1)
        self.hbbox.addWidget(self.qbtn)
        self.hbbox.addStretch(1)

        self.vbox = QVBoxLayout()
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.h1box)
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.h2box)
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.h3box)
        self.vbox.addStretch(1)
        self.vbox.addLayout(self.hbbox)
        self.vbox.addStretch(1)
        self.setLayout(self.vbox)
Beispiel #20
0
    def init_window(self):
        self.setFixedSize(800, 500)
        self.title = "PDF-Compressor is an Open Source Project by IT'S FOSS"
        self.top = 100
        self.left = 100
        self.width = 800
        self.height = 500

        self.setWindowIcon(QtGui.QIcon("its.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.left, self.width, self.height)

        self.button = QPushButton('Select File', self)
        self.button.clicked.connect(self.select_pdf)
        self.button.move(200, 250)

        self.button2 = QPushButton('Compress', self)
        self.button2.clicked.connect(lambda:self.compress(self.groupButton.checkedId()))
        self.button2.move(500, 250)
        self.button2.setEnabled(False)
        self.button2.setStyleSheet("background-color: #808080; ")

        self.radio1 = QRadioButton('Low Compression', self)
        self.radio1.move(330, 180)
        self.radio1.resize(200, 20)
        self.radio1.setChecked(True)

        self.radio2 = QRadioButton('Medium Compression', self)
        self.radio2.move(330, 210)
        self.radio2.resize(200, 20)

        self.radio3 = QRadioButton('High Compression', self)
        self.radio3.move(330, 240)
        self.radio3.resize(200, 20)

        self.groupButton = QButtonGroup()
        self.groupButton.addButton(self.radio1, 1)
        self.groupButton.addButton(self.radio2, 2)
        self.groupButton.addButton(self.radio3, 3)

        self.image = QLabel(self)
        self.image.setPixmap(QtGui.QPixmap("pdff.png"))
        self.image.resize(100, 100)
        self.image.move(230, 150)
        self.image.show()

        self.image2 = QLabel(self)
        self.image2.setPixmap(QtGui.QPixmap("inboxx.png"))
        self.image2.resize(100, 100)
        self.image2.move(525, 150)
        self.image2.show()

        self.image3 = QLabel(self)
        self.image3.setPixmap(QtGui.QPixmap("its.png"))
        self.image3.resize(50, 50)
        self.image3.move(180, 385)
        self.image3.show()

        self.label = QLabel(self)
        self.label.setText("PDF-Compressor is an Open Source Project by It's FOSS")
        self.label.move(250, 400)
        self.label.resize(400, 20)

        self.label1 = QLabel(self)
        self.label1.setText("")
        self.label1.setStyleSheet("color: green; ")
        self.label1.move(320, 350)
        self.label1.resize(400, 20)

        self.label2 = QLabel(self)
        self.label2.setText("")
        self.label2.setStyleSheet("color: red; ")
        self.label2.move(320, 350)
        self.label2.resize(400, 20)

        self.label3 = QLabel(self)
        self.label3.setText("")
        self.label3.setStyleSheet("color: green; ")
        self.label3.move(320, 350)
        self.label3.resize(400, 40)

        self.label4 = QLabel(self)
        self.label4.setText("")
        self.label4.setStyleSheet("color: red; ")
        self.label4.move(320, 350)
        self.label4.resize(400, 40)

        self.font = QFont("Arial", 8)
        self.font.setBold(True)

        self.show()
Beispiel #21
0
 def __initStatusLabel(self, status):
     f = QFont('DejaVu Sans Mono', 10)
     self.statusLabels[status] = QLabel('')
     self.statusLabels[status].setFont(f)
     self.statusLayout.addWidget(self.statusLabels[status])
LOAD_SAMPLE = str(Path.home()) + "/mantidimaging-data/ISIS/IMAT/IMAT00010675/Tomo/IMAT_Flower_Tomo_000000.tif"
LOAD_SAMPLE_MISSING_MESSAGE = """Data not present, please clone to your home directory e.g.
git clone https://github.com/mantidproject/mantidimaging-data.git"""

NEXUS_SAMPLE = str(
    Path.home()) + "/mantidimaging-data/Diamond/i13/AKingUVA_7050wSSwire_InSitu_95RH_2MMgCl2_p4ul_p4h/24737.nxs"

APPLITOOLS_IMAGE_DIR = os.getenv("APPLITOOLS_IMAGE_DIR")
if APPLITOOLS_IMAGE_DIR is None:
    APPLITOOLS_IMAGE_DIR = mkdtemp(prefix="mantid_image_eyes_")
else:
    if not os.path.isdir(APPLITOOLS_IMAGE_DIR):
        raise ValueError(f"Directory does not exist: APPLITOOLS_IMAGE_DIR = {APPLITOOLS_IMAGE_DIR}")

QApplication.setFont(QFont("Sans Serif", 10))


@unittest.skipIf(API_KEY_PRESENT is None, "API Key is not defined in the environment, so Eyes tests are skipped.")
@unittest.skipUnless(os.path.exists(LOAD_SAMPLE), LOAD_SAMPLE_MISSING_MESSAGE)
@start_qapplication
class BaseEyesTest(unittest.TestCase):
    eyes_manager: EyesManager

    @classmethod
    def setUpClass(cls) -> None:
        cls.eyes_manager = EyesManager("Mantid Imaging", test_name=TEST_NAME)
        cls.eyes_manager.set_batch(APPLITOOLS_BATCH_ID)

    def setUp(self):
        self.eyes_manager.set_match_level(MatchLevel.CONTENT)
        # reset timer
        self.timer.stop()
        self.timer.disconnect()

        # reset client parameters
        self.seq = 0
        self.client_rtp_port = None
        self.client_rtcp_port = None
        self.client_session_id = None
        self.url = None
        self.media_duration = 0
        self.current_time = 0
        self.init_end_time_label()
        self.set_play_time()

        # reset UI
        self.progressSlider.setDisabled(True)

        # reset cache file
        self.file = None


if __name__ == "__main__":

    app = QApplication(sys.argv)
    font = QFont('Microsoft YaHei', 10)
    app.setFont(font)
    player = Player()
    player.show()
    sys.exit(app.exec_())
Beispiel #24
0
def setThemeEditorDatas(editor, themeDatas, pixmap, screenRect):
    textRect = themeTextRect(themeDatas, screenRect)
    x, y, width, height = themeEditorGeometry(themeDatas, textRect)
    editor.setGeometry(x, y, width, height)

    # p = editor.palette()
    ##p.setBrush(QPalette.Base, QBrush(pixmap.copy(x, y, width, height)))
    # p.setBrush(QPalette.Base, QColor(Qt.transparent))
    # p.setColor(QPalette.Text, QColor(themeDatas["Text/Color"]))
    # p.setColor(QPalette.Highlight, QColor(themeDatas["Text/Color"]))
    # p.setColor(QPalette.HighlightedText, Qt.black if qGray(QColor(themeDatas["Text/Color"]).rgb()) > 127 else Qt.white)
    # editor.setPalette(p)

    editor.setAttribute(Qt.WA_NoSystemBackground, True)

    bf = getThemeBlockFormat(themeDatas)
    editor.setDefaultBlockFormat(bf)

    # b = editor.document().firstBlock()
    # cursor = editor.textCursor()
    # cursor.setBlockFormat(bf)
    # while b.isValid():
    # bf2 = b.blockFormat()
    # bf2.merge(bf)
    # cursor.setPosition(b.position())
    ##cursor.setPosition(b.position(), QTextCursor.KeepAnchor)
    # cursor.setBlockFormat(bf2)
    # b = b.next()

    editor.setTabStopWidth(themeDatas["Spacings/TabWidth"])
    editor.document().setIndentWidth(themeDatas["Spacings/TabWidth"])

    editor.highlighter.setMisspelledColor(QColor(
        themeDatas["Text/Misspelled"]))

    cf = QTextCharFormat()
    # f = QFont()
    # f.fromString(themeDatas["Text/Font"])
    # cf.setFont(f)
    editor.highlighter.setDefaultCharFormat(cf)
    f = QFont()
    f.fromString(themeDatas["Text/Font"])
    # editor.setFont(f)

    editor.setStyleSheet("""
        background: transparent;
        color: {foreground};
        font-family: {ff};
        font-size: {fs};
        selection-color: {sc};
        selection-background-color: {sbc};
        """.format(
        foreground=themeDatas["Text/Color"],
        ff=f.family(),
        fs="{}pt".format(str(f.pointSize())),
        sc="black"
        if qGray(QColor(themeDatas["Text/Color"]).rgb()) > 127 else "white",
        sbc=themeDatas["Text/Color"],
    ))

    editor._fromTheme = True
    editor._themeData = themeDatas
    editor.highlighter.updateColorScheme()
Beispiel #25
0
    def add_io(self, vbox):
        if self.tx.locktime > 0:
            vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime))

        vbox.addWidget(QLabel(_("Inputs") + ' (%d)' % len(self.tx.inputs())))
        ext = QTextCharFormat()
        rec = QTextCharFormat()
        rec.setBackground(QBrush(ColorScheme.GREEN.as_color(background=True)))
        rec.setToolTip(_("Wallet receive address"))
        chg = QTextCharFormat()
        chg.setBackground(QBrush(ColorScheme.YELLOW.as_color(background=True)))
        chg.setToolTip(_("Wallet change address"))
        twofactor = QTextCharFormat()
        twofactor.setBackground(
            QBrush(ColorScheme.BLUE.as_color(background=True)))
        twofactor.setToolTip(
            _("TrustedCoin (2FA) fee for the next batch of transactions"))

        def text_format(addr):
            if self.wallet.is_mine(addr):
                return chg if self.wallet.is_change(addr) else rec
            elif self.wallet.is_billing_address(addr):
                return twofactor
            return ext

        def format_amount(amt):
            return self.main_window.format_amount(amt, whitespaces=True)

        i_text = QTextEditWithDefaultSize()
        i_text.setFont(QFont(MONOSPACE_FONT))
        i_text.setReadOnly(True)
        cursor = i_text.textCursor()
        for x in self.tx.inputs():
            if x['type'] == 'coinbase':
                cursor.insertText('coinbase')
            else:
                prevout_hash = x.get('prevout_hash')
                prevout_n = x.get('prevout_n')
                cursor.insertText(prevout_hash + ":%-4d " % prevout_n, ext)
                addr = self.wallet.get_txin_address(x)
                if addr is None:
                    addr = ''
                cursor.insertText(addr, text_format(addr))
                if x.get('value'):
                    cursor.insertText(format_amount(x['value']), ext)
            cursor.insertBlock()

        vbox.addWidget(i_text)
        vbox.addWidget(QLabel(_("Outputs") + ' (%d)' % len(self.tx.outputs())))
        o_text = QTextEditWithDefaultSize()
        o_text.setFont(QFont(MONOSPACE_FONT))
        o_text.setReadOnly(True)
        cursor = o_text.textCursor()
        for o in self.tx.get_outputs_for_UI():
            addr, v = o.address, o.value
            cursor.insertText(addr, text_format(addr))
            if v is not None:
                cursor.insertText('\t', ext)
                cursor.insertText(format_amount(v), ext)
            cursor.insertBlock()
        vbox.addWidget(o_text)
Beispiel #26
0
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 09:32:49 2020

@author: Kornkawin
"""

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QFont

# If you want to set font by yourself.
font = QFont("Times", 12)


class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setGeometry(150, 250, 550, 250)
        self.setWindowTitle("Using Text Editor")
        self.UI()

    def UI(self):
        self.editor = QTextEdit(self)
        self.editor.move(150, 80)
        # If you don't want to accept rich text in editor.
        #        self.editor.setAcceptRichText(False)

        button = QPushButton("Send", self)
        button.move(330, 280)
        button.clicked.connect(self.getValue)
Beispiel #27
0
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def closeEvent(self, event):
        reply = QMessageBox.question(self, '确认退出', '你确定要退出么?', QMessageBox.Yes,
                                     QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()

    def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            reply = QMessageBox.question(self, '确认退出', '你确定要退出么?',
                                         QMessageBox.Yes, QMessageBox.No)
            if reply == QMessageBox.Yes:
                self.close()
            else:
                event.ignore()


if __name__ == '__main__':

    app = QApplication(sys.argv)
    ex = wid()
    QToolTip.setFont(QFont('SansSerif', 10))
    ex.show()

    sys.exit(app.exec_())
    def __init__(self, controller, callback):
        super(VistaInserisciAnamnesi, self).__init__(parent=None)
        self.controller = controller
        self.callback = callback
        self.info = {}
        self.anamnesi = {}

        font = QFont('Georia', 10)
        font.setBold(True)
        self.grid_layout = QGridLayout()
        label1 = QLabel(
            'Da compilare a cura del personale e da riesaminare insieme ai Professionisti Sanitari addetti alla vaccinazione.'
        )
        label1.setFont(font)
        self.grid_layout.addWidget(label1, 1, 0)

        self.grid_layout.addWidget(
            QLabel('Soffre di allergie ad uno dei componenti del vaccino ?'),
            2, 0)
        self.get_domanda('Pfizer', '- Pfizer', 3)
        self.get_domanda('Moderna', '- Moderna', 4)
        self.get_domanda('Astrazeneca', '- Astrazeneca', 5)
        self.get_domanda(
            'Reazione grave',
            'Ha mai avuto una reazione grave dopo aver ricevuto un vaccino?',
            6)
        self.get_domanda(
            'Malattie',
            'Soffre di malattie cardiache o polmonari, asma, malattie renali, diabete, anemia o altre malattie del sangue?',
            7)
        self.get_domanda(
            'Sistema immunitario',
            'Si trova in una condizione di compromissione del sistema immunitario (esempio: cancro, leucemia, linfoma, HIV/AIDS, trapianto)?',
            8)
        self.get_domanda(
            'Gravidanza',
            'È incinta o sta pensando di rimanere incinta nel prossimo mese?',
            9)

        font.setPointSize(8)
        font.setItalic(True)
        label2 = QLabel('Anamnesi COVID-Correlata')
        label2.setFont(font)
        self.grid_layout.addWidget(label2, 10, 0)
        self.get_domanda(
            'Contatto',
            'Nell\'ultimo mese è stato in contatto con una persona contagiata da Sars-CoV2 o affetta da COVID-19?',
            11)
        self.get_domanda(
            'Sintomi',
            'Manifesta sintomi riconducibili a infezione da COVID-19?', 12)
        self.grid_layout.addWidget(
            QLabel(
                'Se è stato precedentemente affetto da COVID-19, indicare quanti mesi sono trascorsi dall\'infezione'
            ), 13, 0)
        self.mesi = QComboBox()
        self.mesi.addItems([
            ' ', 'mai', 'meno di 3 mesi', 'tra i 3 e i 6 mesi', 'più di 6 mesi'
        ])
        self.grid_layout.addWidget(self.mesi, 13, 1, 1, 2)

        btn = QPushButton("OK")
        btn.clicked.connect(self.check_anamnesi_completa)
        self.grid_layout.addWidget(btn, 14, 0, -1, 3)

        self.setLayout(self.grid_layout)
        self.setWindowTitle("Questionario anamnestico")
Beispiel #29
0
    def paintEvent(self, QPaintEvent):
        opt = QStyleOption()
        opt.initFrom(self)
        # painter = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, opt, QPainter(self), self)

        if self.parent.isDebug == 0:
            return

        colorTable = [0xFF0000, 0xFF7F00, 0xFFFF00, 0x0000FF,
                      0x8B00FF, 0x00FF00, 0x00FFFF]

        rec = self.contentsRect()
        height = rec.height() * 5 / 16
        width = rec.width() / 25
        topx = 0
        topy = rec.height() * 11 / 32
        painter = QPainter(self)

        font = QFont()
        font.setFamily("consolas")
        painter.setFont(font)
        painter.setPen(QColor(163, 163, 163))

        # Draw instruction text
        fctCodeString = ["lit", "opr", "lod", "sto", "cal", "ini", "jmp", "jpc", "add", "sub", "tad"]
        inst = Ipt.code[Ipt.p]
        if inst.fct == Ipt.FctCode.lit and inst.opr2 != 0:
            painter.drawText(QRect(0, 20, 300, 25), Qt.AlignVCenter,
                          "Next instruction:%s %s %s" % (fctCodeString[inst.fct],
                                                         inst.opr1, round(inst.opr2, 2)))
        else:
            painter.drawText(QRect(0, 20, 300, 25), Qt.AlignVCenter,
                          "Next instruction:%s %s %s" % (fctCodeString[inst.fct],
                                                         inst.opr1, int(inst.opr2)))


        typeString = ["", "int", "dbl", "chr", "bol"]
        for i in range(1, Ipt.t + 1):
            # Draw name and type
            painter.drawText(QRect(topx, topy + height, width, 25),
                             Qt.AlignHCenter | Qt.AlignVCenter, "%s" % typeString[Ipt.s[i].dataType])
            painter.drawText(QRect(topx, topy - 25, width, 25), Qt.AlignHCenter | Qt.AlignVCenter, Ipt.stype[i])


            # Draw rectangle
            if Ipt.stype[i] == "null":
                color =QColor(colorTable[0])
            elif Ipt.stype[i] == "DL":
                color =QColor(colorTable[1])
            elif Ipt.stype[i] == "RA":
                color =QColor(colorTable[2])
            else:
                color = QColor(colorTable[Ipt.s[i].dataType + 2])
            painter.fillRect(topx, topy, width, height, color)
            painter.setPen(color.darker())
            painter.drawLine(topx, topy, topx, topy + height)
            painter.setPen(QColor(163, 163, 163))
            painter.drawLine(topx, topy, topx + width, topy)
            painter.drawLine(topx + width, topy, topx + width, topy + height)
            painter.drawLine(topx, topy + height, topx + width, topy + height)


            # Draw specific data
            if Ipt.s[i].dataType == Ipt.DataType.Double:
                painter.drawText(QRect(topx, topy + height / 2 - 12.5, width, 25), Qt.AlignHCenter | Qt.AlignVCenter,
                              "%s" % round(Ipt.s[i].dblData, 2))
            else:
                painter.drawText(QRect(topx, topy + height / 2 - 12.5, width, 25), Qt.AlignHCenter | Qt.AlignVCenter,
                                  "%s" % Ipt.s[i].intData)
            topx = topx + width
    def update_io(self):
        inputs_header_text = _("Inputs") + ' (%d)'%len(self.tx.inputs())
        if not self.finalized:
            selected_coins = self.main_window.get_manually_selected_coins()
            if selected_coins is not None:
                inputs_header_text += f"  -  " + _("Coin selection active ({} UTXOs selected)").format(len(selected_coins))
        self.inputs_header.setText(inputs_header_text)
        ext = QTextCharFormat()
        rec = QTextCharFormat()
        rec.setBackground(QBrush(ColorScheme.GREEN.as_color(background=True)))
        rec.setToolTip(_("Wallet receive address"))
        chg = QTextCharFormat()
        chg.setBackground(QBrush(ColorScheme.YELLOW.as_color(background=True)))
        chg.setToolTip(_("Wallet change address"))
        twofactor = QTextCharFormat()
        twofactor.setBackground(QBrush(ColorScheme.BLUE.as_color(background=True)))
        twofactor.setToolTip(_("TrustedCoin (2FA) fee for the next batch of transactions"))

        def text_format(addr):
            if self.wallet.is_mine(addr):
                return chg if self.wallet.is_change(addr) else rec
            elif self.wallet.is_billing_address(addr):
                return twofactor
            return ext

        def format_amount(amt):
            return self.main_window.format_amount(amt, whitespaces=True)

        i_text = self.inputs_textedit
        i_text.clear()
        i_text.setFont(QFont(MONOSPACE_FONT))
        i_text.setReadOnly(True)
        cursor = i_text.textCursor()
        for txin in self.tx.inputs():
            if txin.is_coinbase_input():
                cursor.insertText('coinbase')
            else:
                prevout_hash = txin.prevout.txid.hex()
                prevout_n = txin.prevout.out_idx
                cursor.insertText(prevout_hash + ":%-4d " % prevout_n, ext)
                addr = self.wallet.get_txin_address(txin)
                if addr is None:
                    addr = ''
                cursor.insertText(addr, text_format(addr))
                if isinstance(txin, PartialTxInput) and txin.value_sats() is not None:
                    cursor.insertText(format_amount(txin.value_sats()), ext)
            cursor.insertBlock()

        self.outputs_header.setText(_("Outputs") + ' (%d)'%len(self.tx.outputs()))
        o_text = self.outputs_textedit
        o_text.clear()
        o_text.setFont(QFont(MONOSPACE_FONT))
        o_text.setReadOnly(True)
        cursor = o_text.textCursor()
        for o in self.tx.outputs():
            addr, v = o.get_ui_address_str(), o.value
            cursor.insertText(addr, text_format(addr))
            if v is not None:
                cursor.insertText('\t', ext)
                cursor.insertText(format_amount(v), ext)
            cursor.insertBlock()