示例#1
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_Dialog()
     self.ui.setupUi(self)
     self.setWindowTitle('Linkbot Diagnostics')
     self.ui.pushButton_start.clicked.connect(self.startTests)
     self.ui.pushButton_quit.clicked.connect(self.exit)
示例#2
0
class dialog(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        # Create an instance of the GUI
        self.ui = Ui_Dialog()
        # Run the .setupUi() method to show the GUI
        self.ui.setupUi(self)
示例#3
0
    def __init__(self):
        super(Dialog, self).__init__()

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        tbl = self.ui.schedule_tbl

        self.in_file = open('/Users/howard/PreferencesDialog/workfile')
        self.preference_string = self.in_file.read()

        #       self.preference_string = self.preference_string.strip('(')
        #        self.preference_string = self.preference_string.strip(')')
        self.preference_string = self.preference_string.split(sep=';')

        self.preference_string = list(filter(
            None, self.preference_string))  # fastest

        self.emp = []
        for x in self.preference_string:
            y = x.split(sep=',')
            z = list(filter(None, y))
            self.emp.append(z)

#       self.preferences = (self.preference_string,)

        pref_btn = self.ui.preferences_btn
        rec_btn = self.ui.recommendations_btn
        make_btn = self.ui.create_schedule_btn
        lkahd_btn = self.ui.look_ahead_btn

        pref_btn.clicked.connect(self.gt_prefs)
        rec_btn.clicked.connect(self.gt_rec)
        make_btn.clicked.connect(self.mk_sched)
        lkahd_btn.clicked.connect(self.lkahd)
示例#4
0
    def __init__(self):
        super().__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        #prepare face_detection
        self.detector = MTCNN()
        K.set_image_data_format('channels_first')
        self.FRmodel = faceRecoModel(input_shape=(3, 96, 96))

        self.FRmodel.compile(optimizer='adam',
                             loss=self.triplet_loss,
                             metrics=['accuracy'])
        load_weights_from_FaceNet(self.FRmodel)

        #connect database-server
        self.myclient = pymongo.MongoClient(
            "mongodb+srv://VuGiaBao:[email protected]/face_recognition?retryWrites=true&w=majority"
        )
        self.mydb = self.myclient["Attendance_checking"]
        self.CSDL_col = self.mydb["CSDL"]
        self.Cham_cong_col = self.mydb["Cham_cong"]

        #call database func
        self.data = self.prepare_database()

        # create a timer
        self.timer = QTimer()
        # set timer timeout callback function
        self.timer.timeout.connect(self.recog_pushdata)
        # set control_bt callback clicked  function
        self.ui.Open_bt.clicked.connect(self.controlTimer)
示例#5
0
    def __init__(self, stu):
        self.dialog = QtWidgets.QDialog()
        window = Ui_Dialog()
        window.setupUi(self.dialog)
        self.dialog.setWindowTitle("信息修改")
        self.dialog.setWindowModality(QtCore.Qt.ApplicationModal)
        self.dialog.setWindowFlags(QtCore.Qt.WindowCloseButtonHint)
        self.id = window.lineEdit_id
        self.name = window.lineEdit_name
        self.gender = window.lineEdit_gender
        self.grade = window.lineEdit_grade
        self.major = window.lineEdit_major
        self.score1 = window.lineEdit_score1
        self.score2 = window.lineEdit_score2
        self.score3 = window.lineEdit_score3
        self.score4 = window.lineEdit_score4
        self.okButton = window.buttonBox.accepted
        self.cancelButton = window.buttonBox.rejected

        self.id.setText(stu.id)
        self.id.setEnabled(False)
        self.name.setText(stu.name)
        self.gender.setText(stu.gender)
        self.grade.setText(stu.grade)
        self.major.setText(stu.major)
        self.score1.setText(stu.score1)
        self.score2.setText(stu.score2)
        self.score3.setText(stu.score3)
        self.score4.setText(stu.score4)

        self.okButton.connect(self.getValue)
示例#6
0
文件: app.py 项目: pymft/mft-05
class AppWindow(QDialog):
    def __init__(self):
        super().__init__()
        self.ui = Ui_Dialog()

        self.ui.setupUi(self)
        self.show()
示例#7
0
 def raiseerror(self):
     dialog = QtWidgets.QDialog()
     ex = Ui_Dialog()
     ex.setupUi(dialog)
     dialog.activateWindow()
     dialog.exec_()
     dialog.show()
示例#8
0
def verifyUser(licenseId, random_code):

    syntaxSms = "Syxtax SMS: V " + str(licenseId) + \
        " " + str(random_code) + " Send +84343021605"
    note = """
    * You have 3 attempts OTP *
    * Don't share OTP for anyone *
    * OTP will 5 minutes expired *
    """
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    ui.lSmsSyntax.setText(syntaxSms)
    ui.lDetails.setStyleSheet("color: red")
    font = QtGui.QFont()
    font.setPointSize(10)
    font.setItalic(True)
    ui.lDetails.setFont(font)
    ui.lDetails.setText(note)
    if Dialog.exec_() == QtWidgets.QDialog.Accepted:
        value = ui.lineEdit.text()
        Dialog.deleteLater()
        return value
    else:
        import sys
        sys.exit()
    Dialog.show()
示例#9
0
    def __init__(self):
        super(Dialog, self).__init__()
        #list that will store all info from preferences
        #to be written to file
        #must use set() function after apply

        info = []

        self.out_file = open('workfile', 'w')

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        self.buttons = self.ui.buttonBox.buttons()
        self.apply_button = self.buttons[2]
        self.cancel_button = self.buttons[1]
        self.ok_button = self.buttons[0]

        self.ok_button.clicked.connect(self.accept)
        self.cancel_button.clicked.connect(self.reject)
        self.apply_button.clicked.connect(self.apply_changes)

        self.all_chk = self.get_child_widget(self.ui.days_available_grpbox,
                                             QCheckBox, "all_days_chk")
        self.all_chk.clicked.connect(self.check_all_days)

        self.time_from_edit = self.get_child_widget(
            self.ui.time_available_grpbox, QTimeEdit,
            "available_from_time_edit")
        self.time_to_edit = self.get_child_widget(
            self.ui.time_available_grpbox, QTimeEdit, "available_to_time_edit")
示例#10
0
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        internet_usage = search()
        super(MainWindow, self).__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.ui.lcdNumber.display(internet_usage)

        # daily limit 20GB
        usage_percent = float(internet_usage) / 20 * 100
        print(usage_percent)

        # set the progress bar
        self.ui.progressBar.setValue(usage_percent)
        self.ui.progressBar.setFormat("%.02f %%" % usage_percent)

        # this is a thread which can get the data and reflash the window
        self.thread = Thread()
        self.thread.trigger.connect(self.reflasher)

        self.thread.start()

        self.setWindowTitle("網路用量表 %.01f %%" % usage_percent)

    def reflasher(self, internet_usage):
        usage_percent = float(internet_usage) / 20 * 100
        print(usage_percent)

        self.setWindowTitle("網路用量表 %.01f %%" % usage_percent)

        self.ui.progressBar.setValue(usage_percent)
        self.ui.progressBar.setFormat("%.02f %%" % usage_percent)

        self.ui.lcdNumber.display(internet_usage)
        print('refreshed')
示例#11
0
class Ui(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super(Ui, self).__init__(parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self) #inittial
        self.ui.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) #read only
        self.ui.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)#单个选择
        self.ui.tableWidget.setAlternatingRowColors(1) #隔行显示颜色

        self.result = []


    def search(self):
        key = self.ui.lineEdit.text()
        if len(key)==40:
            #composite link
            link = MAGNET_HEAD+key
        else:
            handle = NetHandler()
            self.result=handle.getMagnetLink(key) #search from web
        #show in tableWidget
        j=0
        #debug
        '''for i in result:
            print type(i),i['hash']'''
        for i in self.result:
            self.ui.tableWidget.setItem(j,0,QtWidgets.QTableWidgetItem(MAGNET_HEAD+(self.result[j]['hash'])))
            self.ui.tableWidget.setItem(j,1,QtWidgets.QTableWidgetItem(self.result[j]['size']))
            self.ui.tableWidget.setItem(j,2,QtWidgets.QTableWidgetItem(self.result[j]['date']))
            j+=1
        #self.ui.tableWidget.resizeColumnsToContents()

    def currentRow(self):
        return 0 if self.ui.tableWidget.currentColumn() != 0 else self.ui.tableWidget.currentRow()

    def currenritem(self):
        return self.ui.tableWidget.item(0,0) if self.ui.tableWidget.currentColumn()!=0 else self.ui.tableWidget.currentItem()

    def copy(self):
         QtGui.QGuiApplication.clipboard().setText(self.currenritem().text())

    def download(self):
        key_hash = self.currenritem().text()[-40:]
        filePath = QtWidgets.QFileDialog.getSaveFileName(self,u"保存种子",self.result[self.currentRow()]['name'],"*.torrent") #*.torrent;; *.png;; *.jpg
        if filePath==None:
            return
        handle=NetHandler()
        handle.getTorrent(key_hash,filePath[0]+'.torrent')

     #status bar
    def showStatus(self):
        pass

    def bindEvent(self):
        #bind event
        self.ui.searchBtn.clicked.connect(self.search)
        self.ui.copyBtn.clicked.connect(self.copy)
        self.ui.downBtn.clicked.connect(self.download)
示例#12
0
文件: main.py 项目: bog-box/Qtlearn
    def show_dialog(self):
        self.dialog = QtWidgets.QDialog()
        ui = Ui_Dialog()
        ui.setupUi(self.dialog)
        self.dialog.show()

        rsp = self.dialog.exec_()
        if rsp == QtWidgets.QDialog.finished:
            self.on_new_click()
示例#13
0
class MainApplication(QDialog):
    """SetUp the dialog generated with pyside-uic."""
    def __init__(self, parent=None):
        super(MainApplication, self).__init__(parent)
        self.createWidgets()

    def createWidgets(self):
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
示例#14
0
    def __init__(self, parent=None):
        super().__init__(parent=parent)  # 构造窗体
        self._ui = Ui_Dialog()  # 构造UI对象
        self._ui.setupUi(self)  # 构造UI

        # 将信号与函数绑定
        self._ui.radioRed.clicked.connect(self.my_setTextColor)
        self._ui.radioBlack.clicked.connect(self.my_setTextColor)
        self._ui.radioBlue.clicked.connect(self.my_setTextColor)
示例#15
0
 def __init__(self, error, parent=None):
     super().__init__(parent)
     self.ui = Ui_Dialog()
     self.error = error
     self.ui.setupUi(self)
     if self.error == "reserve":
         self.ui.Error.setText("Cannot reserve today")
     if self.error == "date":
         self.ui.Error.setText("Invalid date format. Valid date format is day.month.year")
     if self.error == 'daterange':
         self.ui.Error.setText("Invalid date range")
示例#16
0
    def __init__(self, parent=None):
        super(Dialog, self).__init__(parent)

        self.sharedMemory = QSharedMemory('QSharedMemoryExample')

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        self.ui.loadFromFileButton.clicked.connect(self.loadFromFile)
        self.ui.loadFromSharedMemoryButton.clicked.connect(self.loadFromMemory)

        self.setWindowTitle("SharedMemory Example")
示例#17
0
文件: main.py 项目: Bashakov/storage
class Dialog(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.settings = Storage()
        self.ui = MainDlg()
        self.ui.setupUi(self)
        self.resize(self.settings.size)
        self.move(self.settings.pos)

        self.file_filter = ''
        self.modelCommits = CommitModel(self.ui.listCommit, self._on_select_commit)
        self.modelFiles = DirFileModel(self.ui.listFiles, self._on_select_file)
        self.modelFileHistory = FileHistoryModel(self.ui.listFileHistory)
        self.ui.edtFindFile.textChanged.connect(self.set_file_filter)
        self.ui.btnCleanFltr.pressed.connect(lambda: self.ui.edtFindFile.clear())
        self.ui.btnSettings.pressed.connect(self._show_settings)

        self._fill_commits()

    def closeEvent(self, e):
        self.settings.Save(self)
        e.accept()

    def done(self, p_int):
        self.settings.Save(self)
        QtGui.QDialog.done(self, p_int)


    def set_file_filter(self, word):
        self.file_filter = word.upper()
        self._fill_commits()

    def _fill_commits(self):
        self.modelCommits.set_commits([])
        try:
            self.git_repo = Git2Repo(self.settings.workdir)
            commits = self.git_repo.get_commits(self.file_filter)
            self.modelCommits.set_commits(commits)
        except Exception as e:
            QtGui.QMessageBox.critical(self, "workdir", "[%s] no working dir" % e)

    def _on_select_commit(self, commit):
        self.modelFiles.set_files(commit, self.git_repo, self.file_filter)
        self.modelFileHistory.set_commits(None, [], None)

    def _on_select_file(self, file_oid, file_name):
        commits = self.git_repo.get_file_history_commits(file_oid, file_name)
        self.modelFileHistory.set_commits(self.git_repo.repo, commits, file_name)

    def _show_settings(self):
        if(self.settings.ShowDlg()):
            self._fill_commits()
class Dialog(QDialog):
    def __init__(self):
        QDialog.__init__(self)
        self.dialog = Ui_Dialog()
        self.dialog.setupUi(self)

        self.dialog.pushButton.clicked.connect(self.dialog_close)

    def dialog_close(self):
        self.close()

    def dialog_change(self, text):
        self.dialog.label.setText(text)
示例#19
0
class myfirstui(QtWidgets.QDialog, Ui_Dialog):
    def __init__(self):
        super(myfirstui,self).__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.ui.buttonBox.accepted.connect(self.pushClick)
        self.ui.buttonBox.rejected.connect(self.close)

    def pushClick(self):
        print ("ok button clicked")

        
    def close(self):
        print("cancel button clicked")
示例#20
0
    def __init__(self):
        super().__init__()

        # Set up the dialog
        self.dialog = Ui_Dialog()
        self.dialog.setupUi(self)

        # Setup buttons
        self.dialog.radioButtonCelcius2Farenheit.clicked.connect(self.handle_change)
        self.dialog.radioButtonMeters2Centimeters.clicked.connect(self.handle_change)


        # Present the dialog
        self.show()
示例#21
0
 def __add_liquid_button_clicked(self):
     Dialog = QtWidgets.QDialog()
     ui = Ui_Dialog(LIQUIDS[self.ui.theoryCombobox.currentText()])
     ui.setupUi(Dialog)
     Dialog.show()
     rsp = Dialog.exec_()
     if rsp == QtWidgets.QDialog.Accepted:
         self.liquids[self.ui.theoryCombobox.currentText()] = []
         for index in range(ui.myList.count()):
             self.liquids[self.ui.theoryCombobox.currentText()].append(
                 ui.myList.item(index).text())
         self.__create_input_bar()
         self.__fullfill_table()
     else:
         pass
示例#22
0
    def __init__(self, parent=None):
        super(ProducerDialog, self).__init__(parent)

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        # We only allow one image to be put into the shared memory (otherwise we would need to
        # create a dedicated data structure within the SHARED memory and access it from Python and
        # C++ appropriately). Also note that "Open" and "Create" have very different semantics (see
        # docs) and we use "Create" to always create a "fresh" semaphore to not cause undesired
        # blocking/stalls, see also https://doc.qt.io/qt-5/qsystemsemaphore.html

        if CONSUMER == 0:
            self.ui.loadFromFileButton.clicked.connect(self.load_from_file)
            self.ui.loadFromSharedMemoryButton.setEnabled(False)
            self.setWindowTitle("Shared Memory Producer: Python Example")
            from prodcon_ipc.producer_ipc import ProducerIPC
            self.producer_ipc = ProducerIPC(UNIQUE_SHARED_MEMORY_NAME,
                                            SHARED_MEMORY_KEY_FILE)
        else:
            self.ui.loadFromSharedMemoryButton.clicked.connect(
                self.load_from_memory)
            self.ui.loadFromFileButton.setEnabled(False)
            self.setWindowTitle("Shared Memory Consumer: Python Example")
            from prodcon_ipc.consumer_ipc import ConsumerIPC
            self.consumer_ipc = ConsumerIPC(UNIQUE_SHARED_MEMORY_NAME,
                                            SHARED_MEMORY_KEY_FILE)

        if SHARED_STRUCT == 1:
            self.shmem_config = QSharedMemory('shared_struct_test')
            if self.shmem_config.isAttached() or self.shmem_config.attach():
                if self.shmem_config.lock():
                    counter, stop_flag, file_name = struct.unpack(
                        STRUCT_FORMAT, self.shmem_config.constData())
                    logzero.logger.debug(
                        "Shared memory struct read: counter=" + str(counter) +
                        ", stop_flag=" + str(stop_flag) + ", file_name=" +
                        file_name)
                    self.shmem_config.unlock()
                else:
                    logzero.logger.error("unable to lock " +
                                         self.shmem_config.key())
                # Note: if both processes detach from the memory, it gets deleted so that attach() fails. That's why we
                #       simply never detach (HERE). Depending on the app design, there may be a better solution.
                #self.shmem_config.detach()
            else:
                logzero.logger.error("unable to attach " +
                                     self.shmem_config.key())
示例#23
0
    def __init__(self, parent):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.ui.pushButton_2.setEnabled(False)

        self.backExstro()
        self.backFeel()
        self.backIntro()
        self.backIntusi()
        self.backJudg()
        self.backPercep()
        self.backSense()
        self.backThink()
        self.actTombol()
        self.act()
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_Dialog()
     self.ui.setupUi(self)
     self.setWindowTitle('Linkbot Diagnostics')
     self.ui.pushButton_start.clicked.connect(self.startTests)
     self.ui.pushButton_quit.clicked.connect(self.exit)
示例#25
0
    def __init__(self, width, height, host_orch, host_pp):
        # pdb.set_trace()
        QtGui.QWidget.__init__(self)
        #Dialog component
        self.dialog = QtGui.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.dialog)

        #Tab widget
        self.tabWidget = QtGui.QTabWidget()
        self.tab = Ui_TabWidget()
        self.tab.setupUi(self.tabWidget, width / 2, height / 2, host_orch,
                         host_pp)

        #Column widget
        self.column = QtGui.QWidget()
        self.col = Ui_column()
        self.col.setupUi(self.column, width, height)

        self.video_widget = Phonon.VideoWidget()
        self.video = Ui_Video()
        self.video.setupUi(self.video_widget, width / 2, height / 2)

        #List Widget
        # self.list = QtGui.QListWidget(self)
        # self.list.setMaximumSize(width/2,height/2)
        # #self.list.hide()
        #Log Widget

        self.scrollArea = QtGui.QScrollArea()
        self.scroll = Ui_ScrollArea()
        self.scroll.setupUi(self.scrollArea)
        # self.listView = QtGui.Qlabel(self)
        # self.listView.setObjectName("listView")

        #Connecting Handlers
        self.col.set_handler_about(self.__show_about_handle)
        self.col.set_handler_start(self.__start_scenario)
        self.col.set_handler_stop(self.__stop_scenario)
        self.col.set_handler_clean(self.__clean_logs)

        #Including in the grid
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.video_widget, 0, 0)
        layout.addWidget(self.scrollArea, 1, 2)
        layout.addWidget(self.tabWidget, 1, 0)
        layout.addWidget(self.column, 0, 2)
示例#26
0
 def __init__(self):
     super(Ui, self).__init__()
     self.downloadPath = os.path.abspath('.')
     self.configParser = configparser.ConfigParser()
     self.configPath = ".config"
     self.md5LogName = os.path.join(self.configPath, "md5log.json")
     if not os.path.exists(self.configPath):
         os.makedirs(self.configPath)
     self.confName = os.path.join(self.configPath, "cache.cfg")
     self.login = {}
     self.coursesList = []
     self.resourceInfos = []
     self.sess = requests.session()
     self.ui = Ui_Dialog()
     self.ui.setupUi(self)
     self.initUI()
     self.show()
示例#27
0
文件: main.py 项目: bog-box/Qtlearn
    def __init__(self):
        self.app = QtWidgets.QApplication(sys.argv)

        self.main_window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.main_window)

        self.dialog = QtWidgets.QDialog()
        self.dialog_ui = Ui_Dialog()
        self.dialog_ui.setupUi(self.dialog)

        self.ui.textEdit.textChanged.connect(self.auto_save)
        self.ui.actionOpen.triggered.connect(self.on_open_click)
        self.ui.actionSave.triggered.connect(self.on_save_click)
        self.ui.actionNew.triggered.connect(self.on_new_click)

        self.main_window.show()
        sys.exit(self.app.exec_())
示例#28
0
    def __init__(self, parent=None):
        super(Ui, self).__init__(parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self) #inittial
        self.ui.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) #read only
        self.ui.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)#单个选择
        self.ui.tableWidget.setAlternatingRowColors(1) #隔行显示颜色

        self.result = []
示例#29
0
class QmyDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent=parent)  # 构造窗体
        self._ui = Ui_Dialog()  # 构造UI对象
        self._ui.setupUi(self)  # 构造UI

        # 将信号与函数绑定
        self._ui.radioRed.clicked.connect(self.my_setTextColor)
        self._ui.radioBlack.clicked.connect(self.my_setTextColor)
        self._ui.radioBlue.clicked.connect(self.my_setTextColor)

    def on_btnClear_clicked(self):  # 清除文本框
        self._ui.textEdit.clear()

    @pyqtSlot(bool)
    def on_checkBoxBold_clicked(self, checked: bool):  # 设置粗体
        font = self._ui.textEdit.font()  # 获取字体样式
        font.setBold(checked)  # 设置粗体
        self._ui.textEdit.setFont(font)  # 改变文本框字体c

    # @pyqtSlot(bool)
    def on_chkBoxUnder_clicked(self):  # 设置下划线
        font = self._ui.textEdit.font()
        checked = self._ui.chkBoxUnder.isChecked()  # 获取勾选状态,和使用装饰器效果一致
        font.setUnderline(checked)
        self._ui.textEdit.setFont(font)

    @pyqtSlot(bool)
    def on_chkBoxItalic_clicked(self, checked: bool):  # 示威者斜体
        font = self._ui.textEdit.font()
        font.setItalic(checked)
        self._ui.textEdit.setFont(font)

    def my_setTextColor(self):  # 设置颜色
        palette = self._ui.textEdit.palette()  # 获取字体调色板

        if (self._ui.radioBlack.isChecked()):  # 更改调色板颜色
            palette.setColor(QPalette.Text, Qt.black)
        elif (self._ui.radioBlue.isChecked()):
            palette.setColor(QPalette.Text, Qt.blue)
        else:
            palette.setColor(QPalette.Text, Qt.red)

        self._ui.textEdit.setPalette(palette)  # 设置字体颜色
示例#30
0
	def __init__(self):
		super().__init__()
		self.ui = Ui_Dialog()
		self.ui.setupUi(self)

		print("prepare face_detection")
		self.detector = MTCNN()
		K.set_image_data_format('channels_first')
		self.FRmodel = faceRecoModel(input_shape=(3, 96, 96))

		self.FRmodel.compile(optimizer = 'adam', loss = self.triplet_loss, metrics = ['accuracy'])
		load_weights_from_FaceNet(self.FRmodel)

		print("Load model security")
		self.model_name = "trained_models/replay_attack_trained_models/replay-attack_ycrcb_luv_extraTreesClassifier.pkl"
		self.thresh = 0.725
		self.clf = None
		self.sample_number = 1
		self.count = 0
		self.measures = np.zeros(self.sample_number, dtype=np.float)

		try:
			self.clf = joblib.load(self.model_name)
		except IOError as e:
			print ("Error loading model")
			exit(0)

		print("onnect database-server")
		self.myclient = pymongo.MongoClient("mongodb+srv://VuGiaBao:[email protected]/face_recognition?retryWrites=true&w=majority")
		self.mydb = self.myclient["Attendance_checking"]
		self.CSDL_col = self.mydb["CSDL"]
		self.Cham_cong_col = self.mydb["Cham_cong"]

		print("call database func")
		self.data=self.prepare_database()

		print("create a timer")
		self.timer = QTimer()
		print("set timer timeout callback function")
		self.timer.timeout.connect(self.recog_pushdata)
		print("Get control_bt callback clicked  function")
		self.ui.Open_bt.clicked.connect(self.controlTimer)
示例#31
0
class DialogApplication(QtWidgets.QDialog):
    def __init__(self):
        super().__init__()

        # Set up the dialog
        self.dialog = Ui_Dialog()
        self.dialog.setupUi(self)

        # Setup buttons
        self.dialog.radioButtonCelcius2Farenheit.clicked.connect(self.handle_change)
        self.dialog.radioButtonMeters2Centimeters.clicked.connect(self.handle_change)


        # Present the dialog
        self.show()

    def handle_change(self):

        string_input = self.dialog.lineEditInput.text()

        if self.get_option() == 1:
            result = self.meters2centimeters(string_input)
        else:
            result = self.celsius2fahrenheit(string_input)

        self.dialog.lineEditOutput.setText(result)
        
    def get_option(self):
        if self.dialog.radioButtonMeters2Centimeters.isChecked():
            return 1
        else:
            return 2

    def meters2centimeters(self, meters : str):
        target = int(meters)
        result = target * 100
        return str(result) + " cm"

    def celsius2fahrenheit(self, celsius: str):
        target = int(celsius)
        result = round(((target * 9 / 5) + 32), 2)
        return str(result) + " F"
示例#32
0
    def __init__(self):
        self.dialog = QtWidgets.QDialog()
        window = Ui_Dialog()
        window.setupUi(self.dialog)
        self.dialog.setWindowTitle("档案信息")
        self.dialog.setWindowModality(QtCore.Qt.ApplicationModal)
        self.dialog.setWindowFlags(QtCore.Qt.WindowCloseButtonHint)
        self.id = window.lineEdit_id
        self.name = window.lineEdit_name
        self.gender = window.lineEdit_gender
        self.grade = window.lineEdit_grade
        self.major = window.lineEdit_major
        self.score1 = window.lineEdit_score1
        self.score2 = window.lineEdit_score2
        self.score3 = window.lineEdit_score3
        self.score4 = window.lineEdit_score4
        self.okButton = window.buttonBox.accepted
        self.cancelButton = window.buttonBox.rejected

        self.okButton.connect(self.getValue)
示例#33
0
    def __init__(self, parent = None):
        super(Dialog, self).__init__(parent)

        self.sharedMemory = QtCore.QSharedMemory('QSharedMemoryExample')

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        self.ui.loadFromFileButton.clicked.connect(self.loadFromFile)
        self.ui.loadFromSharedMemoryButton.clicked.connect(self.loadFromMemory)

        self.setWindowTitle("SharedMemory Example")
示例#34
0
    def __init__ (self) :
        """Menghubungkan tiap tombol dalam GUI dengan metode yang akan dilakukan sebagai respon terhadap aksi pengguna."""
        super().__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)        
        self.ui.randomizeButton.clicked.connect(self.randomClick)
        self.ui.loadDirectoryButton.clicked.connect(self.pickDirectory)
        self.ui.loadDatabaseButton.clicked.connect(self.pickDatabase)
        self.ui.saveDbButton.clicked.connect(self.saveDatabase)
        self.ui.batchProcessButton.clicked.connect(self.processDirToDb)
        self.ui.cosRadioButton.toggled.connect(lambda:self.matchMethod(self.ui.cosRadioButton))
        self.ui.euclidRadioButton.toggled.connect(lambda:self.matchMethod(self.ui.euclidRadioButton))
        self.ui.loadImageButton.clicked.connect(self.loadImageClick)
        self.ui.matchButton.clicked.connect(self.matchClick)

        """Inisialisasi keadaan awal program"""
        self.curDbDir = 'No Database Loaded'
        self.matchingMethod = 1
        self.dirLoaded = False
        self.db = None
        self.show()

        """Mengatur metode pencocokan (dengan cosine similarity atau euclidean distance) sesuai dengan pilihan pengguna."""
示例#35
0
文件: plot.py 项目: janrito/imreg
def searchInspector(search):
    """
    A Qt based GUI to inspect the output of search algorithms. 
    
    Parameters
    ----------
    search: list of Register.optstepnd-array
        The output of a registration.
    """
    
    try:
        from PyQt4.QtGui import QApplication, QDialog
        from dialog import Ui_Dialog
    except Exception:
        print "Missing a required library - please install pyQt4."
        return
    
    app = QApplication(sys.argv)
    window = QDialog()
    ui = Ui_Dialog()
    ui.setupUi(window)
    ui.updateList(search)
    window.show()
    app.exec_()
示例#36
0
    def __init__(self,width,height,host_orch,host_pp):
       # pdb.set_trace()
        QtGui.QWidget.__init__(self)
        #Dialog component
        self.dialog = QtGui.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.dialog)
        
        #Tab widget
        self.tabWidget=QtGui.QTabWidget()
        self.tab= Ui_TabWidget()
        self.tab.setupUi(self.tabWidget,width/2,height/2,host_orch,host_pp)
        
        #Column widget
        self.column = QtGui.QWidget()
        self.col = Ui_column()
        self.col.setupUi(self.column,width,height)
        
        self.video_widget = Phonon.VideoWidget()
        self.video = Ui_Video()
        self.video.setupUi(self.video_widget,width/2,height/2)

        #List Widget
        # self.list = QtGui.QListWidget(self)
        # self.list.setMaximumSize(width/2,height/2)
        # #self.list.hide()
        #Log Widget
        
        self.scrollArea = QtGui.QScrollArea()
        self.scroll=Ui_ScrollArea()
        self.scroll.setupUi(self.scrollArea)
        # self.listView = QtGui.Qlabel(self)
        # self.listView.setObjectName("listView")

        #Connecting Handlers
        self.col.set_handler_about(self.__show_about_handle)
        self.col.set_handler_start(self.__start_scenario)
        self.col.set_handler_stop(self.__stop_scenario)
        self.col.set_handler_clean(self.__clean_logs)


        #Including in the grid
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.video_widget, 0,0)
        layout.addWidget(self.scrollArea,1,2)
        layout.addWidget(self.tabWidget,1,0)
        layout.addWidget(self.column,0,2)
示例#37
0
文件: main.py 项目: Bashakov/storage
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.settings = Storage()
        self.ui = MainDlg()
        self.ui.setupUi(self)
        self.resize(self.settings.size)
        self.move(self.settings.pos)

        self.file_filter = ''
        self.modelCommits = CommitModel(self.ui.listCommit, self._on_select_commit)
        self.modelFiles = DirFileModel(self.ui.listFiles, self._on_select_file)
        self.modelFileHistory = FileHistoryModel(self.ui.listFileHistory)
        self.ui.edtFindFile.textChanged.connect(self.set_file_filter)
        self.ui.btnCleanFltr.pressed.connect(lambda: self.ui.edtFindFile.clear())
        self.ui.btnSettings.pressed.connect(self._show_settings)

        self._fill_commits()
示例#38
0
def searchInspector(search):
    """
    A Qt based GUI to inspect the output of search algorithms. 
    
    Parameters
    ----------
    search: list of Register.optstepnd-array
        The output of a registration.
    """

    try:
        from PyQt4.QtGui import QApplication, QDialog
        from dialog import Ui_Dialog
    except Exception:
        print "Missing a required library - please install pyQt4."
        return

    app = QApplication(sys.argv)
    window = QDialog()
    ui = Ui_Dialog()
    ui.setupUi(window)
    ui.updateList(search)
    window.show()
    app.exec_()
示例#39
0
    def menufunction(self, action):
        txt = (action.text())
        if txt == 'NEW Team':
            sql = "SELECT name FROM teams;"
            try:
                cur.execute(sql)
                result = cur.fetchall()
                name, ok = QtWidgets.QInputDialog.getText(
                    MainWindow, "Team",
                    "Enter name of team:")  #Dialog to enter teamName
                teamName = (name, )
                if ok and name == "":
                    self.showdlg(
                        "Teamname can't be empty!!!"
                    )  #Popup if teamName column is left empty and ok is pressed
                elif teamName in result:
                    self.showdlg("Team with this name already exists!!!"
                                 )  #Popup if the teamName already exists
                elif ok and name != "":
                    self.team.setText(str(name))
                    self.rb1.setEnabled(True)
                    self.rb2.setEnabled(True)
                    self.rb3.setEnabled(True)
                    self.rb4.setEnabled(True)

                    self.bat = 0
                    self.bwl = 0
                    self.ar = 0
                    self.wk = 0
                    self.av_pts = 1000
                    self.used_pts = 0
                    self.total_pl = 0
                    self.av_players.clear()
                    self.selected_pl.clear()

                self.show_count()
            except:
                pass

        if txt == 'SAVE Team':
            if self.total_pl < 11:
                self.showdlg(
                    "The team must consist of 11 players"
                )  #Team can't be saved until it consists of 11 players
            else:
                sql = "SELECT name FROM teams;"
                try:
                    cur.execute(sql)
                    result = cur.fetchall()
                    teamName = (self.team.text(),
                                )  #If a user modifies already saved team and
                    if teamName in result:  #wants to save this changed team with the same name
                        try:
                            sql = "DELETE FROM teams WHERE name='" + self.team.text(
                            ) + "';"  #The previously existing team is deleted
                            cur.execute(sql)  #and new modified team is saved
                            Mydb.commit()
                        except:
                            Mydb.rollback()
                    players = []
                    for i in range(self.selected_pl.count()):
                        players.append(self.selected_pl.item(i).text())
                    my_players = ",".join(players)
                    try:
                        cur.execute(
                            "INSERT INTO teams(name,player,value) VALUES(?,?,?);",
                            (self.team.text(), my_players, self.used_pts))
                        Mydb.commit(
                        )  #Team gets saved in the database.If not,message is displayed
                        self.showdlg("Your team is saved")
                    except:
                        self.showdlg("Some Error occurred")
                        Mydb.rollback()
                except:
                    pass

        if txt == 'OPEN Team':
            sql = "SELECT name FROM teams"
            try:
                cur.execute(sql)
                result = cur.fetchall()
                teamnames = []

                for i in result:
                    teamnames.append(i[0])
                item, ok = QtWidgets.QInputDialog.getItem(
                    MainWindow, "OpenTeam", "Select any team to open",
                    teamnames, 0, False)  #Dialog with teamNames is displayed

                if ok and item:
                    self.team.setText(item)
                    self.av_players.clear()
                    self.selected_pl.clear()
                    self.bat = 0
                    self.bwl = 0
                    self.ar = 0
                    self.wk = 0
                    self.total_pl = 11

                    self.rb1.setEnabled(
                        True
                    )  #If the user selects OPEN Team menu in the starting,
                    self.rb2.setEnabled(
                        True)  #then all radio buttons are enabled
                    self.rb3.setEnabled(True)
                    self.rb4.setEnabled(True)

                    sql = "SELECT player,value FROM teams WHERE name='" + item + "';"
                    cur.execute(sql)
                    result = cur.fetchone()
                    players = result[0].split(",")
                    for i in players:
                        sql = "SELECT ctg FROM stats WHERE player='" + i + "';"
                        try:
                            cur.execute(sql)
                            category = cur.fetchone()
                            if category[0] == "BAT": self.bat += 1
                            if category[0] == "BWL": self.bwl += 1
                            if category[0] == "AR": self.ar += 1
                            if category[0] == "WK":
                                self.wk += 1  #Players of the selected team are displayed along with all counts
                            self.selected_pl.addItem(i)  #and points
                        except:
                            pass
                    self.used_pts = int(result[1])
                    self.av_pts = 1000 - self.used_pts
                self.show_count()
            except:
                pass

        if txt == 'EVALUATE Team':
            Dialog = QtWidgets.QDialog(
            )  #New dialog box for evaluating your saved team
            ui = Ui_Dialog()
            ui.setupUi(Dialog)
            ret = Dialog.exec()
示例#40
0
class Dialog(QtGui.QDialog):
    """ This class is a simple example of how to use QSharedMemory.  It is a
    simple dialog that presents a few buttons.  Run the executable twice to
    create two processes running the dialog.  In one of the processes, press
    the button to load an image into a shared memory segment, and then select
    an image file to load.  Once the first process has loaded and displayed the
    image, in the second process, press the button to read the same image from
    shared memory.  The second process displays the same image loaded from its
    new location in shared memory.

    The class contains a data member sharedMemory, which is initialized with
    the key "QSharedMemoryExample" to force all instances of Dialog to access
    the same shared memory segment.  The constructor also connects the
    clicked() signal from each of the three dialog buttons to the slot function
    appropriate for handling each button.
    """

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

        self.sharedMemory = QtCore.QSharedMemory('QSharedMemoryExample')

        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        self.ui.loadFromFileButton.clicked.connect(self.loadFromFile)
        self.ui.loadFromSharedMemoryButton.clicked.connect(self.loadFromMemory)

        self.setWindowTitle("SharedMemory Example")

    def loadFromFile(self):
        """ This slot function is called when the "Load Image From File..."
        button is pressed on the firs Dialog process.  First, it tests whether
        the process is already connected to a shared memory segment and, if so,
        detaches from that segment.  This ensures that we always start the
        example from the beginning if we run it multiple times with the same
        two Dialog processes.  After detaching from an existing shared memory
        segment, the user is prompted to select an image file.  The selected
        file is loaded into a QImage.  The QImage is displayed in the Dialog
        and streamed into a QBuffer with a QDataStream.  Next, it gets a new
        shared memory segment from the system big enough to hold the image data
        in the QBuffer, and it locks the segment to prevent the second Dialog
        process from accessing it.  Then it copies the image from the QBuffer
        into the shared memory segment.  Finally, it unlocks the shared memory
        segment so the second Dialog process can access it.  After self
        function runs, the user is expected to press the "Load Image from
        Shared Memory" button on the second Dialog process.
        """

        if self.sharedMemory.isAttached():
            self.detach()

        self.ui.label.setText("Select an image file")
        fileName = QtGui.QFileDialog.getOpenFileName(self, None, None,
                "Images (*.png *.xpm *.jpg)")
        image = QtGui.QImage()
        if not image.load(fileName):
            self.ui.label.setText(
                    "Selected file is not an image, please select another.")
            return

        self.ui.label.setPixmap(QtGui.QPixmap.fromImage(image))

        # Load into shared memory.
        buf = QtCore.QBuffer()
        buf.open(QtCore.QBuffer.ReadWrite)
        out = QtCore.QDataStream(buf)
        out << image
        size = buf.size()

        if not self.sharedMemory.create(size):
            self.ui.label.setText("Unable to create shared memory segment.")
            return

        size = min(self.sharedMemory.size(), size)
        self.sharedMemory.lock()

        # Copy image data from buf into shared memory area.
        self.sharedMemory.data()[:] = buf.data().data()
        self.sharedMemory.unlock()

    def loadFromMemory(self):
        """ This slot function is called in the second Dialog process, when the
        user presses the "Load Image from Shared Memory" button.  First, it
        attaches the process to the shared memory segment created by the first
        Dialog process.  Then it locks the segment for exclusive access, copies
        the image data from the segment into a QBuffer, and streams the QBuffer
        into a QImage.  Then it unlocks the shared memory segment, detaches
        from it, and finally displays the QImage in the Dialog.
        """

        if not self.sharedMemory.attach():
            self.ui.label.setText(
                    "Unable to attach to shared memory segment.\nLoad an "
                    "image first.")
            return
 
        buf = QtCore.QBuffer()
        ins = QtCore.QDataStream(buf)
        image = QtGui.QImage()

        self.sharedMemory.lock()
        buf.setData(self.sharedMemory.constData())
        buf.open(QtCore.QBuffer.ReadOnly)
        ins >> image
        self.sharedMemory.unlock()
        self.sharedMemory.detach()

        self.ui.label.setPixmap(QtGui.QPixmap.fromImage(image))

    def detach(self):
        """ This private function is called by the destructor to detach the
        process from its shared memory segment.  When the last process detaches
        from a shared memory segment, the system releases the shared memory.
        """

        if not self.sharedMemory.detach():
            self.ui.label.setText("Unable to detach from shared memory.")
示例#41
0
#coding=utf8
__author__ = 'rookiefly'

import PyQt4
import sys
from dialog import Ui_Dialog

if __name__ == "__main__":
    app = PyQt4.QtGui.QApplication(sys.argv)
    dialogWidget = PyQt4.QtGui.QDialog()
    mainDialog = Ui_Dialog()
    mainDialog.setupUi(dialogWidget)
    dialogWidget.show()
    sys.exit(app.exec_())
示例#42
0
class Window(QtGui.QWidget):
    def __init__(self,width,height,host_orch,host_pp):
       # pdb.set_trace()
        QtGui.QWidget.__init__(self)
        #Dialog component
        self.dialog = QtGui.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.dialog)
        
        #Tab widget
        self.tabWidget=QtGui.QTabWidget()
        self.tab= Ui_TabWidget()
        self.tab.setupUi(self.tabWidget,width/2,height/2,host_orch,host_pp)
        
        #Column widget
        self.column = QtGui.QWidget()
        self.col = Ui_column()
        self.col.setupUi(self.column,width,height)
        
        self.video_widget = Phonon.VideoWidget()
        self.video = Ui_Video()
        self.video.setupUi(self.video_widget,width/2,height/2)

        #List Widget
        # self.list = QtGui.QListWidget(self)
        # self.list.setMaximumSize(width/2,height/2)
        # #self.list.hide()
        #Log Widget
        
        self.scrollArea = QtGui.QScrollArea()
        self.scroll=Ui_ScrollArea()
        self.scroll.setupUi(self.scrollArea)
        # self.listView = QtGui.Qlabel(self)
        # self.listView.setObjectName("listView")

        #Connecting Handlers
        self.col.set_handler_about(self.__show_about_handle)
        self.col.set_handler_start(self.__start_scenario)
        self.col.set_handler_stop(self.__stop_scenario)
        self.col.set_handler_clean(self.__clean_logs)


        #Including in the grid
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.video_widget, 0,0)
        layout.addWidget(self.scrollArea,1,2)
        layout.addWidget(self.tabWidget,1,0)
        layout.addWidget(self.column,0,2)

    # def __handleButton(self):
    #     if self.media.state() == Phonon.PlayingState:
    #         self.media.stop()
    #     else:
    #         path = QtGui.QFileDialog.getOpenFileName(self, self.button.text())
    #         if path:
    #             self.media.setCurrentSource(Phonon.MediaSource(path))
    #             self.media.play()
    #     self.dialog.show()
    def __start_scenario(self):
        try:
            self.__clean_logs()
            scenario = self.col.getScenario()
            self.controller.startScenario(scenario+1)
        except Exception as e:
	    print e
            self.show_exception(e)

        self.video.start_reproduction("/home/Data/Videos/Demo_Scenario2_3D_T.wmv")

    def __stop_scenario(self):
        self.controller.stopScenario()
        
    def __clean_logs(self):
        self.scroll.clean_text()
        
    def __show_about_handle(self):
        self.dialog.show()
    
    def show_exception(self,exception):
        print "EXCEPTION ",exception
        #TODO
    
    def scenarioInitiated(self):
        print "SHOW WINDOW SCENARIO INITIATED"

    def setController(self,controller):
        self.controller = controller
    # def __handleStateChanged(self, newstate, oldstate):
    #     if newstate == Phonon.PlayingState:
    #         self.button.setText('Stop')
    #     elif (newstate != Phonon.LoadingState and
    #           newstate != Phonon.BufferingState):
    #         self.button.setText('Choose File')
    #         if newstate == Phonon.ErrorState:
    #             source = self.media.currentSource().fileName()
    #             print ('ERROR: could not play:', source.toLocal8Bit().data())
    #             print ('  %s' % self.media.errorString().toLocal8Bit().data())

    # def add_new_hit(self,hit):
    #     self.list.addItems(hit)

    def log(self,msg):
        self.scroll.append_text(msg)

    def stop(self):
        None
class StartQT4(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle('Linkbot Diagnostics')
        self.ui.pushButton_start.clicked.connect(self.startTests)
        self.ui.pushButton_quit.clicked.connect(self.exit)

    def exit(self):
        sys.exit(0)

    def startTests(self):
        try:
            linkbot = TestLinkbot('LOCL')
            x,y,z = linkbot.getAccelerometer()
            if abs(x) > 0.1 or \
               abs(x) > 0.1 or \
               abs(z-1) > 0.1:
                QtGui.QMessageBox.warning(self, 
                    "Accelerometer readings have anomalies!")
            con = sql.connect('testlog.db')
            initialize_tables(con.cursor())
            cur = con.cursor()
# Check to see if this linkbot is in our database already. Add it if not
            cur.execute('SELECT * FROM robot_type WHERE Id=\'{}\''.format(linkbot.getSerialId()))
            rows = cur.fetchall()
            formFactor = None
            if linkbot.getFormFactor() == Linkbot.FormFactor.I:
                formFactor = "Linkbot-I"
                motor2index = 2
            elif linkbot.getFormFactor() == Linkbot.FormFactor.L:
                formFactor = "Linkbot-L"
                motor2index = 1
            else:
                formFactor = "UNKNOWN"
            print ("Testing LinkBot {}".format(linkbot.getSerialId()))
            d = LinkbotDiagnostic(linkbot)
            results = d.runLinearityTest()
            now = time.strftime('%Y-%m-%d %H:%M:%S')
            if len(rows) == 0:
                cur.execute('INSERT INTO robot_type VALUES(\'{}\', \'{}\')'.format(
                    linkbot.getSerialId(), formFactor))
            cur.execute("INSERT INTO linearity_tests "
                "VALUES('{}', '{}', {}, {}, {}, {}, {}, {}, {}, {})".format(
                    linkbot.getSerialId(),
                    now,
                    results[0]['forward_slope'],
                    results[0]['forward_rvalue'],
                    results[0]['backward_slope'],
                    results[0]['backward_rvalue'],
                    results[motor2index]['forward_slope'],
                    results[motor2index]['forward_rvalue'],
                    results[motor2index]['backward_slope'],
                    results[motor2index]['backward_rvalue']))

            con.commit()
            con.close()
            self.ui.m1f.setText(str(results[0]['forward_slope']))
            self.ui.m1fl.setText(str(results[0]['forward_rvalue']))
            self.ui.m1b.setText(str(results[0]['backward_slope']))
            self.ui.m1bl.setText(str(results[0]['backward_rvalue']))

            self.ui.m2f.setText(str(results[motor2index]['forward_slope']))
            self.ui.m2fl.setText(str(results[motor2index]['forward_rvalue']))
            self.ui.m2b.setText(str(results[motor2index]['backward_slope']))
            self.ui.m2bl.setText(str(results[motor2index]['backward_rvalue']))
            speeds = [ 
                        results[0]['forward_slope'],
                        results[0]['backward_slope'],
                        results[motor2index]['forward_slope'],
                        results[motor2index]['backward_slope'],
                     ]
            linearities = [
                results[0]['forward_rvalue'],
                results[0]['backward_rvalue'],
                results[motor2index]['forward_rvalue'],
                results[motor2index]['backward_rvalue'],
                          ]
            if any(abs(x) < 210 for x in speeds):
                self.ui.lineEdit_status.setText('FAIL')
            elif any(x < 0.99 for x in linearities):
                self.ui.lineEdit_status.setText('FAIL')
            else:
                self.ui.lineEdit_status.setText('Pass')

        except Exception as e:
            QtGui.QMessageBox.warning(self, 
                    "Test Failed: " + str(e))
示例#44
0
 def createWidgets(self):
     self.ui = Ui_Dialog()
     self.ui.setupUi(self)