Example #1
0
 def label_creation(self):
     from base64 import b16encode as e1, b32encode as e3, b64encode as e6
     open('temp.data','w').close()
     f=open('temp.data','a')
     try:
         child.kill(shell=None)
     except:
         print 'Child label not started!'
     
     save_to_file= (
            self.ui.line_project.text(),
            self.ui.line_code.text(),
            self.ui.line_csc.text(),
            self.ui.line_modem.text(),
            self.ui.line_template.text(),
            self.ui.line_full.text(),
            self.ui.line_partial.toPlainText() ,
            self.ui.line_approver.text(),
            self.ui.line_p4port.text(),
            self.ui.label_name.toPlainText(),
            str(self.ui.comboBox.currentText()),
            )
     
     [f.write(e1(e3(e6(str(line))))[::-1]+'\n') for line in save_to_file]
     f.close()
     try:
         child=subprocess.Popen('start main_label', shell=None) #for exe
         #child=subprocess.Popen('python main_label.py', shell=None)
     except:
        child= subprocess.Popen('main_label')
     '''   
     finally:
        child= subprocess.Popen('python main_label.py') '''
         
     print "Saved to file temp.data!"
Example #2
0
    def call_labeling(self):
        print "Start Labeling!"
        open('temp.data','w').write('')
        f=open('temp.data','a')
        try:
            if not os.path.exists('Log'): os.makedirs('Log')
        except:
            print "Can't create Folder Log!"
            pass

        save_to_file= (
               self.ui.line_user.text(),
               self.ui.line_password.text(),
               self.ui.line_port.text(),
               self.ui.line_template.text(),
               self.ui.line_label.toPlainText(),
               
               self.ui.line_model.text(),
               self.ui.line_pl.text(),
               self.ui.line_devgroup.text(),
               self.ui.line_step.text(),
               self.ui.line_version.text(),
               self.ui.line_cl_full.text(),
               self.ui.line_cl_partials.toPlainText(),
               
               self.ui.line_code.text(),
               self.ui.line_csc.text(),
               self.ui.line_modem.text(),
               self.ui.line_comment.toPlainText() )
        
        [f.write(e1(e3(e6(str(line))))[::-1]+'\n') for line in save_to_file]
        f.close()
        
        try:
            child=subprocess.Popen('labeling', shell=None, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        except:
            child=subprocess.Popen('python labeling.py', shell=None,stderr=subprocess.PIPE, stdout=subprocess.PIPE)
            
        window.hide()
        text=child.stdout.read()
        text_err=child.stderr.read()
        print text_err
        
        log_name=str(self.ui.line_label.toPlainText())+'_labeling_log.txt'
        f=open('Log\\'+log_name,'w')
        f.write(text+text_err)
        f.close()
        child.kill()
        
        child=subprocess.Popen('notepad '+'Log\\'+log_name, shell=None)
        print "Main Done!"
        window.close()
def login_data_coding():
    if os.path.exists("login.data"):
        f = open("login.data", "r").readlines()
        data = [_(line[:-1]) for line in f]
        login = data[0]
        password = data[1]
        print "Welcome", login, "!\n"
    else:
        login = raw_input("Enter mySingle_id: ")
        password = raw_input("Enter password: "******"login.data", "a")
        [f.write(e1(e3(e6(str(line))))[::-1] + "\n") for line in (login, password)]
    return login, password
def login_data_coding():
    if os.path.exists('login.data'):
        f=open('login.data','r').readlines()
        data = [_(line[:-1]) for line in f]
        login = data[0]
        password = data[1]
        print 'Welcome',login,'!\n'
    else:
        login = raw_input('Enter mySingle_id: ')
        password  = raw_input('Enter password: '******'login.data','a')
        [f.write(e1(e3(e6(str(line))))[::-1]+'\n') for line in (login,password)]
    return login, password