コード例 #1
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
 def user_rm(self):
     pass1 = self.page4.Box2.text()
     mess = Pass.checkpass("Admin", pass1)
     if mess:
         name = str(self.page4.Box1.currentText())
         print name
         Pass.getuserdata(name)
     else:
         QtGui.QMessageBox.warning(self, "Adding User", mess,
                                   QtGui.QMessageBox.Ok,
                                   QtGui.QMessageBox.NoButton,
                                   QtGui.QMessageBox.NoButton)
コード例 #2
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
    def program_start(self):
        name = str(self.page0.Box1.currentText())
        pass1 = str(self.page0.Box2.text())
        # print name
        # print pass1
        test = Pass.checkpass(name, pass1)
        if test is True:
            if self.user_checks(name) is True:
                self.user_update(True)
                if name == "Admin":
                    self.stack.setPage(1)
                else:
                    self.page2.Box1.setText(name)
                    self.page2.Box2.setText(time.strftime("%y-%m-%d-%H:%M:%S"))
                    self.page2.Box4.setText("Under Construction")
                    self.stack.setPage(2)
                    self.quit = False
                    hr = 0.0
                    fname = self.rel_path(
                            "data",
                            "%s_Log.csv" % str(time.strftime("%y_%m")))
                    # Get time this month
                    try:
                        with open(fname, "r") as data_file:
                            for row in data_file:
                                data = row.split(",")
                                if name == data[1]:
                                    ti = time.strptime(data[4], "%H:%M:%S")
                                    hr += ti[3] + ti[4]/60.0 + ti[5]/3600.0
                            self.page2.Box4.setText(str(round(hr, 2)))
                    except:
                        pass  # do nothing just keep going
                        # file does not exist and parse errors

                    self.process = subprocess.Popen([self.dest])
                    self.program_check()
            else:
                return
        else:
            QtGui.QMessageBox.warning(self, "Incorrect username or password!",
                                      test, QtGui.QMessageBox.Ok,
                                      QtGui.QMessageBox.NoButton,
                                      QtGui.QMessageBox.NoButton)