コード例 #1
0
ファイル: Scratch.py プロジェクト: antoszy/Scratch-Analysis
 def __init__(self, sScratch):
     if type(sScratch) is str:
         strListPass = sScratch.split("\n\n")
         self.topo1 = Pass(strListPass[0])
         self.scratch = Pass(strListPass[1])
         self.topo2 = Pass(strListPass[2])
         self.__equalLength()
     else:
         raise NameError('no such constructor')
コード例 #2
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)
コード例 #3
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
    def refresh(self):
        allusers = Pass.getallusers()

        currentindex = self.page0.Box1.currentIndex()
        self.page0.Box1.blockSignals(True)
        self.page0.Box1.clear()
        self.page0.Box1.addItems(allusers)
        self.page0.Box1.setCurrentIndex(-1)
        self.page0.Box1.blockSignals(False)
        self.page0.Box1.setCurrentIndex(currentindex)
        self.page0.Box2.clear()

        self.page4.Box1.clear()
        self.page4.Box2.clear()
        self.page4.Box3.clear()
        self.page4.Box4.clear()
        self.page4.Box1.addItems(allusers[1:])
        self.page4.Box1.setCurrentIndex(currentindex)

        self.page5.Box1.clear()
        self.page5.Box2.clear()
        self.page5.Box3.clear()
        self.page5.Box4.clear()
        self.page5.Box1.addItems(allusers)
        self.page5.Box1.setCurrentIndex(currentindex)
コード例 #4
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
 def user_update(self, update):
     name = str(self.page0.Box1.currentText())
     if update is True:
         userdata = Pass.getuserdata(name, True)
         userdata[3] = str(self.page0.Box3.text())  # index
         userdata[2] = str(self.page0.Box4.text())  # advisor
         userdata[5] = str(self.page0.Box5.text())  # email
         userdata[4] = time.strftime("%y-%m-%d-%H:%M")  # lastlogin
         Pass.userup(userdata)
     else:
         userdata = Pass.getuserdata(name, False)
         self.page0.Box3.setText(userdata[3])
         self.page0.Box4.setText(userdata[2])
         self.page0.Box5.setText(userdata[5])  # email
         self.page0.Box2.setText("")
         self.page0.Box2.setFocus()
コード例 #5
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
 def user_chpass(self):
     name = str(self.page5.Box1.currentText())
     oldpass = str(self.page5.Box2.text())
     pass1 = str(self.page5.Box3.text())
     pass2 = str(self.page5.Box4.text())
     mess = Pass.changepass(name, oldpass, pass1, pass2)
     QtGui.QMessageBox.warning(self, "Change Password", mess,
                               QtGui.QMessageBox.Ok,
                               QtGui.QMessageBox.NoButton,
                               QtGui.QMessageBox.NoButton)
     if mess[0:3] == "Suc":
         self.stack.setPage(0)
コード例 #6
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
 def user_log(self):
     start = str(self.page2.Box2.text())
     user = str(self.page2.Box1.text())
     userdata = Pass.getuserdata(user, False)
     advisor = userdata[2]
     index = userdata[3]
     date = str(self.page2.Box3.text())
     data = [start, user, advisor, index, date, "\n"]
     data = ','.join(data)
     fname = self.rel_path("data",
                           "%s_Log.csv" % str(time.strftime("%y_%m")))
     with open(fname, "a") as out_file:
         out_file.write(data)
コード例 #7
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)
コード例 #8
0
ファイル: PUT_app.py プロジェクト: openafox/put_app
    def user_checks(self, name):
        userdata = Pass.getuserdata(name, False)
        index = str(self.page0.Box3.text())
        if index == "index":
            QtGui.QMessageBox.warning(
                                  self, "Index.",
                                  "You must supply a valid billing index to "
                                  "use the instrument.<br>Cost is $30/hr for"
                                  " internal users.", QtGui.QMessageBox.Ok,
                                  QtGui.QMessageBox.NoButton,
                                  QtGui.QMessageBox.NoButton)
            self.page0.Box2.clear()
            return
        date = time.mktime(time.strptime(userdata[4], "%y-%m-%d-%H:%M"))
        month = 30*24*60*60
        duration = time.time() - date
        if duration > month * 12:
            mess = "You have not used the instrument for Greater than 1 year!"\
                   "<br>Your account has been suspended." \
                   "<br>Please contact the XRD Manager to reactivate your"\
                   " account pending training."
            out = False

        elif duration > month * 6:
            mess = "You have not used the instrument for Greater than 6 "\
                   "months!<br>If you at all feel unconfortable using the "\
                   "instrument. Please contact the XRD Manager"\
                   " for assistance.<br>Do not break me! I will cut you!"
            out = True
        else:
            return True
        QtGui.QMessageBox.warning(self, "Infrequent Instrument Use.",
                                  mess, QtGui.QMessageBox.Ok,
                                  QtGui.QMessageBox.NoButton,
                                  QtGui.QMessageBox.NoButton)
        self.page0.Box2.clear()
        return out
コード例 #9
0
ファイル: Engine.py プロジェクト: mvanderkolff/navi-misc
 def __init__(self):
     self.erase()
     self.mainView = None
     self.dynTexRenderState = None
     self.passes = Pass.getRenderPasses()
コード例 #10
0
def read_pass_data(filePath):
    with open(filePath) as file:
        strData = file.read() 
        pas = Pass(strData)
        return pas
コード例 #11
0
 def ex():
     la = QApplication(sys.argv)
     pass1 = Pass()
     pass1.show()
     la.exec()
コード例 #12
0
                                   str(i)))
                    condition[5] = 0
                    break
        if condition[4] == 1:
            print(GREEN.format("No MRI error"))
        if condition[5] == 1:
            print(GREEN.format("No non-MRI error"))
        # syntax analysis
        for i in address:
            if i[0].isnumeric() or len(i) > 3 or '.' in i:
                print(RED.format(str(i) + "is an invalid address"))

        if all(i == 1 for i in condition):
            # Two pass assembly
            print(GREEN.format("Correct program!\nTranslating..."))
            Pass.pass1(name)
            Pass.pass2(name)
        else:
            print(
                RED.format(
                    "Please rectify the above error(s) before proceeding further"
                ))
    else:
        print(
            RED.format(
                ext +
                " extension not suppported.\nPlease enter a file with extensions .txt or .asm"
            ))
else:
    print(RED.format("Please enter valid file name"))