示例#1
0
def cre(mindate,maxdate):
    try:
        
        conn = sqlite3.connect('worksheet.db')
        cur=conn.execute('SELECT NAME,ERGO,ACTIVITY,DATE,HOURSDEC,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',(mindate,maxdate))
        
        if cur.fetchall():   
            fo=open('worksheet.xls','a')
            cur1=conn.execute('SELECT NAME,ERGO,ACTIVITY,DATE,HOURSDEC,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',(mindate,maxdate))
            for r in cur1.fetchall():
                 name,ergo,activity,date,hoursdec,hours = r
                 #print(name,ergo,activity,date,str(hoursdec)[0:4],hours)dtformated = strptime(str(dt),("%H:%M"))
                 
                 fo.write(name+'\t'+ergo+'\t'+activity+'\t'+date+'\t'+str(hoursdec)[0:4]+'\t'+hours)
                 fo.write('\n')
            fo.close()
            conn.close()
            messagebox.showinfo("Results","Your results for the Month are located here:"+'  '+os.path.abspath('worksheet.xls'))
        else:
            messagebox.showerror("Error","No entries for your dates")
            conn.close()
            raise ('Empty Dataset')
            
     
    except sqlite3.Error as e:
        messagebox.showerror("Warning","Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e),' ')
        raise e

    
    conn.close()
示例#2
0
    def _quit(self, event=None):
        if self.SHUTDOWN_IN_PROGRESS:
            try:
                #python 2.7
                tkMessageBox.showerror('Error', 'Device Shutdown In Progress\nPlease wait...')
            except ImportError:
                #python 3.x
                messagebox.showerror('Error', 'Device Shutdown In Progress\nPlease wait...')
            return
             
        try:
            yes = tkMessageBox.askyesno('Exit', 'Do you really want to quit?')
        except:
            yes = messagebox.askyesno('Exit', 'Do you really want to quit?')

        if yes:
            if self.IS_WIRESHARK_RUNNING:
                self.logger.debug('Wireshark stopping...')
                self._send_cmd_to_thread('STOP_WIRESHARK')
            if self.IS_SITE_SURVEY_RUNNING:
                self.logger.debug('Site survey stopping...')
                self._send_cmd_to_thread('STOP_PLINK')

            self.status_check_thread.join()
            self.exec_cmd_thread.join()
            self.destroy()
示例#3
0
def connect():
   from login import Login
   if not v4.get() or not v5.get():
      messagebox.showerror("Warning","Check your input for empty fields!")
      raise
   Login(v4.get(),v5.get())
   #hiding the buttons after succesful login
   b.lower()
   c.lower()
   eip.lower()
   ecl.lower()
   spip.lower()
   dnpip.lower()
   d.place(x=0,y=0)
   de.place(x=0,y=390)
   e.place(x=819,y=0)
   f.place(x=819,y=300)
   g.place(x=819,y=550)
   d.lift()
   de.lift()
   e.lift()
   f.lift()
   g.lift()
   e1.lift()
   e2.lift()
   v7.set(v4.get()+' '+v5.get())#with succesful logins we have name and surname ready for the next action
   e3.lift()
   e4.lift()
   e5.lift()
   e6.lift()
   e7.lift()
   e8.lift()
   logout.place(x=405,y=0)
   logout.lift()
示例#4
0
def New_entry(namesur,ergo,activity,date,tim1,tim2,dt):
    #get the decimal form of hours!
    secs = dt.total_seconds()
    hoursdec = secs / 3600
    #change dot char with coma char for the summing of dechours in the csv file
    a=str(hoursdec).replace('.',',')
    #print(a)
    #change dot char with coma char for the summing of dechours in the csv file
    try:
        conn = sqlite3.connect('worksheet.db')
    
        conn.execute('insert into Ergo values (? , ? , ? , ? , ? ,?, ?, ?)',(namesur,ergo,activity,date,tim1,tim2,a,str(dt)))      
        conn.commit()
        messagebox.showinfo("Successful Entry","You just created your Entry for the"+'  '+date)
        conn.close()

    except sqlite3.IntegrityError as e:
        messagebox.showerror("Warning","You have created your Entry for:"+date)
        conn.close()
        ErrorLogfile('ErrorLogFiles\\integrityerrors.txt',date,' ')
        raise e
    except sqlite3.Error as e1:
        messagebox.showerror("Error","An error occured while connecting to the Database")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e1),'None')
        raise e1

    conn.close()
示例#5
0
 def add_signature():
     try:
         with open("signature.txt") as f:
             main_text.insert(tk.INSERT, "\n" + f.read(), "a")
     except IOError:
         MESSAGE = SIGNATURE_TXT_NOT_FOUND_MESSAGE
         pop_up.showerror("\"signature.txt\" not found.", MESSAGE)
示例#6
0
def allentries():
    try:
        conn = sqlite3.connect('worksheet.db')
        cur=conn.execute('SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS,DATE,HOURSDEC FROM Ergo ')
        if cur.fetchall():
            fo=open('FullReport.xls','a')
            fo.write('Όνομα-Επώνυμο'+'\t'+'Υποδιέυθυνση' +'\t'+'Εργασιά'+'\t'+'Ωρα Εισόδου'+'\t'+'Ώρα Εξόδου'+'\t'+'Σύνολο Ωρών'+'\t'+'Ημερομηνία'+'\t'+'Ωρες σε δεκαδική μορφή')
            fo.write('\n')
            cur1=conn.execute('SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS,DATE,HOURSDEC FROM Ergo ')
            for r in cur1.fetchall():
                name,ergo,activity,timei,timeo,hours,date,hoursdec = r
                #creating the right format for the excel file
                t1 = time.strptime(timei[10:len(timei)].strip(), "%H:%M:%S")
                t2 = time.strptime(timeo[10:len(timeo)].strip(), "%H:%M:%S")
                timei = time.strftime( "%I:%M %p", t1 )
                timeo = time.strftime( "%I:%M %p", t2 )
                #creating the right format for the excel file
                fo.write(name+'\t'+ergo+'\t'+activity+'\t'+timei+'\t'+timeo+'\t'+hours+'\t'+date+'\t'+str(hoursdec)[0:4])
                fo.write('\n')
            fo.close()    
            conn.close()
            messagebox.showinfo("Results","Your results  are located here:"+'  '+os.path.abspath('FullReport.xls'))
        else:
            messagebox.showerror("Error","You have made no Entries")
            conn.close()
            raise ('Empty Dataset')
        
    except sqlite3.Error as e:
        
        messagebox.showerror("Warning","Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e),' ')
        raise e

    
    conn.close()
示例#7
0
def New_entry(namesur, ergo, activity, date, tim1, tim2, dt):
    #get the decimal form of hours!
    secs = dt.total_seconds()
    hoursdec = secs / 3600
    #change dot char with coma char for the summing of dechours in the csv file
    a = str(hoursdec).replace('.', ',')
    #print(a)
    #change dot char with coma char for the summing of dechours in the csv file
    try:
        conn = sqlite3.connect('worksheet.db')

        conn.execute('insert into Ergo values (? , ? , ? , ? , ? ,?, ?, ?)',
                     (namesur, ergo, activity, date, tim1, tim2, a, str(dt)))
        conn.commit()
        messagebox.showinfo(
            "Successful Entry",
            "You just created your Entry for the" + '  ' + date)
        conn.close()

    except sqlite3.IntegrityError as e:
        messagebox.showerror("Warning",
                             "You have created your Entry for:" + date)
        conn.close()
        ErrorLogfile('ErrorLogFiles\\integrityerrors.txt', date, ' ')
        raise e
    except sqlite3.Error as e1:
        messagebox.showerror(
            "Error", "An error occured while connecting to the Database")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e1), 'None')
        raise e1

    conn.close()
示例#8
0
def weekcre(mindate,maxdate):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur=conn.execute('SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',(mindate,maxdate))
        if cur.fetchall():
            fo=open('weekworksheet.xls','a')
            cur1=conn.execute('SELECT DATE,NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',(mindate,maxdate))
            for r in cur1.fetchall():
                date,name,ergo,activity,timei,timeo,hours = r
                
                #creating the right format for the excel file
                t1 = time.strptime(timei[10:len(timei)].strip(), "%H:%M:%S")
                t2 = time.strptime(timeo[10:len(timeo)].strip(), "%H:%M:%S")
                timei = time.strftime( "%I:%M %p", t1 )
                timeo = time.strftime( "%I:%M %p", t2 )
                #creating the right format for the excel file
                fo.write(date+'\t'+name+'\t'+ergo+'\t'+activity+'\t'+timei+'\t'+timeo+'\t'+hours)
                fo.write('\n')
            fo.close()    
            conn.close()
            messagebox.showinfo("Results","Your results for the Week are located here:"+'  '+os.path.abspath('weekworksheet.xls'))
        else:
            messagebox.showerror("Error","No entries for your dates")
            conn.close()
            raise ('Empty Dataset')
        
    except sqlite3.Error as e:
        
        messagebox.showerror("Warning","Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e),' ')
        raise e

    
    conn.close()
示例#9
0
def delete():
   from newday import deentries
   try:
      datetime.strptime(v6.get(),("%Y/%m/%d"))
   except ValueError:
      messagebox.showerror("Warning","Date does not match format dd/mm/yy")
      ErrorLogfile('ErrorLogFiles\BaDdataTime.txt','Wrong format of DateTime',v6.get())
      raise ValueError
   deentries(v6.get())
示例#10
0
def createweekcsv():
   from newday import weekcre
   
   try:
      datetime.strptime(v12.get(),("%Y/%m/%d"))
      datetime.strptime(v13.get(),("%Y/%m/%d"))
   except ValueError:
      messagebox.showerror("Warning","Date does not match format yy/mm/dd")
      ErrorLogfile('ErrorLogFiles\BaDdataTime.txt','Wrong format of DateTime',v12.get()+' or '+v13.get())
      raise ValueError
   weekcre(v12.get(),v13.get())
示例#11
0
    def save():
        if not file_title.get():
            pop_up.showerror("No title.", EMPTY_TITLE_ERROR_MESSAGE_SAVE)
            return 1

        if not ".txt" in file_title.get():
            filename = file_title.get() + ".txt"

        with open(filename, "w+") as f:
            f.write(main_text.get(1.0, tk.END))
        pop_up.showinfo("File saved succesfully.",
                        SAVING_SUCCESS_MESSAGE.format(filename=filename))
示例#12
0
def register():
   from login import New_employee
   if not v1.get() or not v2.get():
      messagebox.showerror("Warning","Check your input for empty fields!")
      raise
   New_employee(v1.get(),v2.get())
   #hiding the buttons after succesful register
   eip.lower()
   ecl.lower()
   b.lower()
   logout.lower()
   v4.set(v1.get())
   v5.set(v2.get())
示例#13
0
    def _open():
        if not file_title.get():
            pop_up.showerror("Title is empty.", EMPTY_TITLE_ERROR_MESSAGE_OPEN)
            return 1

        if not ".txt" in file_title.get():
            filename = file_title.get() + ".txt"

        try:
            with open(filename) as f:
                main_text.delete("1.0", tk.END)
                main_text.insert(tk.INSERT, f.read(), "a")
        except IOError:
            pop_up.showerror("File not found.", FILE_NOT_FOUND_ERROR_MESSAGE)
    def _view_profiles(self):
        if not (self.uname.get() and self.ucard.get() and self.ufcode.get()
                and self.upass.get()):
            messagebox.showerror("Incomplete Info",
                                 "Please enter all info to login")
            return False

        if not (self.database.verify_user_login(
                self.uname.get().lower(), self.upass.get(), self.ucard.get(),
                self.ufcode.get())):
            messagebox.showerror("User Not Found",
                                 "Please Check info and try login again")
            return False

        self._display_info()
示例#15
0
 def openTournament(self):
     tourn = self.openTourneyName.get()
     #Make sure the tournament name isn't blank
     if tourn!="":
         self.tournament.openDatabase(tourn, self.window)
     elif tourn=="":
         error = messagebox.showerror("Error", "Please enter the name of the tournament you want to open.")
 def teamWin(self, num, roundpos):
     # Make sure there is an opponent before a team advances
     if roundpos != 0:
         if num % 2 == 0:
             opponentPos = num + 1
         else:
             opponentPos = num - 1
         opponentExists = self.button_name[roundpos][opponentPos].get() != ""
     else:
         opponentExists = True
     if opponentExists:
         # Activate the button in the next round, and set the button text as the team name
         current_team = self.button_name[roundpos][num].get()
         if roundpos == (self.rounds // 2) - 1:
             self.champion.set(current_team)
         else:
             self.button_name[roundpos + 1][math.floor(num / 2)].set(current_team)
             self.team[roundpos + 1][math.floor(num / 2)].config(state="active")
         # Disable the buttons from the previous round
         top_team = math.floor(num / 2) * 2
         bottom_team = top_team + 1
         self.team[roundpos][top_team].config(state="disabled")
         self.team[roundpos][bottom_team].config(state="disabled")
         # Send the data to the bracketDB
         self.tournament.saveTourney(self.table, current_team, (roundpos + 1), math.floor(num / 2))
         self.lastRoundChanged = roundpos + 1
         self.lastPosChanged = math.floor(num / 2)
     else:
         # Display an error is no opponent exists
         error = messagebox.showerror("Error", "No opponent exists.")
 def undo(self):
     roundpos = self.lastRoundChanged
     num = self.lastPosChanged
     if roundpos > 0:
         # Reset the database to exclude the last win
         # Reset the database to exclude the last win
         if self.champion.get() == "":
             self.tournament.undoLastSave(self.table, self.button_name[roundpos][num].get())
             # Erase the button name and disable the team button that just won
             self.button_name[roundpos][num].set("")
             self.team[roundpos][num].config(state="disabled")
         else:
             self.tournament.undoLastSave(self.table, self.champion.get())
             # Erase the button name and disable the team button that just won
             self.champion.set("")
         previousRoundTeamPos = num * 2
         previousRoundOpponentPos = num * 2 + 1
         # Reactivate the matchup that had just been decided
         if self.button_name[roundpos - 1][previousRoundTeamPos].get() != "Buy":
             self.team[roundpos - 1][previousRoundTeamPos].config(state="active")
         if self.button_name[roundpos - 1][previousRoundOpponentPos].get() != "Buy":
             self.team[roundpos - 1][previousRoundOpponentPos].config(state="active")
         # Disable the undo button
         self.lastRoundChanged = 0
         self.lastPosChanged = 0
     else:
         error = messagebox.showerror("Error", "Nothing to undo.")
示例#18
0
def Login(name,surname):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur=conn.execute('SELECT * FROM names WHERE NAME=? AND SURNAME=?',(name,surname))
        if cur.fetchall():
            messagebox.showinfo("Have a nice day","Welcome back  "+name+'  '+surname)
        else:
            messagebox.showerror("Warning","Name or Surname is wrong , check your Input")
            conn.close()
            ErrorLogfile('ErrorLogFiles\\NotfoundInDb.txt','These entries dont exist in the db',name+' and '+surname)
            raise ValueError
    except sqlite3.Error as e:
        messagebox.showerror("Warning","Not Connected to the Database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e),'None')
        raise e
    conn.close()
示例#19
0
def deentries(dedate):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur=conn.execute('DELETE  FROM Ergo  WHERE DATE=?',(dedate,))
        conn.commit()
        if cur.rowcount>0:
            messagebox.showinfo("Success","Your Entry was deleted successfully")
        else:
            messagebox.showerror("Error","Not Entries corresponding to your Date")
            conn.close()
        
    except sqlite3.Error as e1:
        messagebox.showerror("Error","Not connected to the database")
        conn.close()
        raise e1
        
    conn.close()
示例#20
0
def allentries():
    try:
        conn = sqlite3.connect('worksheet.db')
        cur = conn.execute(
            'SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS,DATE,HOURSDEC FROM Ergo '
        )
        if cur.fetchall():
            fo = open('FullReport.xls', 'a')
            fo.write('Όνομα-Επώνυμο' + '\t' + 'Υποδιέυθυνση' + '\t' +
                     'Εργασιά' + '\t' + 'Ωρα Εισόδου' + '\t' + 'Ώρα Εξόδου' +
                     '\t' + 'Σύνολο Ωρών' + '\t' + 'Ημερομηνία' + '\t' +
                     'Ωρες σε δεκαδική μορφή')
            fo.write('\n')
            cur1 = conn.execute(
                'SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS,DATE,HOURSDEC FROM Ergo '
            )
            for r in cur1.fetchall():
                name, ergo, activity, timei, timeo, hours, date, hoursdec = r
                #creating the right format for the excel file
                t1 = time.strptime(timei[10:len(timei)].strip(), "%H:%M:%S")
                t2 = time.strptime(timeo[10:len(timeo)].strip(), "%H:%M:%S")
                timei = time.strftime("%I:%M %p", t1)
                timeo = time.strftime("%I:%M %p", t2)
                #creating the right format for the excel file
                fo.write(name + '\t' + ergo + '\t' + activity + '\t' + timei +
                         '\t' + timeo + '\t' + hours + '\t' + date + '\t' +
                         str(hoursdec)[0:4])
                fo.write('\n')
            fo.close()
            conn.close()
            messagebox.showinfo(
                "Results", "Your results  are located here:" + '  ' +
                os.path.abspath('FullReport.xls'))
        else:
            messagebox.showerror("Error", "You have made no Entries")
            conn.close()
            raise ('Empty Dataset')

    except sqlite3.Error as e:

        messagebox.showerror("Warning", "Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e), ' ')
        raise e

    conn.close()
示例#21
0
def New_employee(name,surname):
    try:
        conn = sqlite3.connect('worksheet.db')
        print ("Opened database successfully")
        conn.execute("INSERT INTO Names VALUES (?,?)",(name,surname))      
        conn.commit()
        messagebox.showinfo("Successful Entry","Welcome to IBM  "+name+'  '+surname)
    except sqlite3.IntegrityError as e:
        messagebox.showerror("Warning","User Already Exists")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\integrityerrors.txt',str(e),surname)
        raise e
    except sqlite3.Error as e1:
        messagebox.showerror("Error","An error occured while connecting to the Database")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt',str(e1),'None')
        raise e1
    conn.close()
示例#22
0
def deentries(dedate):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur = conn.execute('DELETE  FROM Ergo  WHERE DATE=?', (dedate, ))
        conn.commit()
        if cur.rowcount > 0:
            messagebox.showinfo("Success",
                                "Your Entry was deleted successfully")
        else:
            messagebox.showerror("Error",
                                 "Not Entries corresponding to your Date")
            conn.close()

    except sqlite3.Error as e1:
        messagebox.showerror("Error", "Not connected to the database")
        conn.close()
        raise e1

    conn.close()
示例#23
0
 def submitTeams(self):
     self.teamList = []
     submit = True
     #Check to make sure that no team's name is blank, or "Buy"
     for i in range(len(self.teams)):
         self.teamList.append(self.teams[i].newTeamEntry.get())
         if self.teamList[i]=="":
             submit = False
             error = messagebox.showerror("Error", "Please enter the name of the teams.")
         elif self.teamList[i]=="Buy":
             submit = False
             error = messagebox.showerror("Error", "Enter a different team name other than 'Buy.'")
     #Create a new table in the tournament database
     if submit:
         self.teamListWindow.destroy()
         if self.tourneyName=="Demo":
             self.tournament.createTournament ("Demo", len(self.MLBTeams), self.MLBTeams)
         else:
             self.tournament.createTournament (self.tourneyName, len(self.teamList), self.teamList)
示例#24
0
def hours():
   
   from newday import New_entry
   try:
      datetime.strptime(v6.get(),("%Y/%m/%d"))
   except ValueError:
      messagebox.showerror("Warning","Date does not match format yy/mm/dd")
      ErrorLogfile('ErrorLogFiles\BaDdataTime.txt','Wrong format of DateTime',v6.get())
      raise ValueError
   #:%S"
   try:
      t1=datetime.strptime(v8.get(),("%H:%M:%S"))
      t2=datetime.strptime(v9.get(),("%H:%M:%S"))
      dt=t2-t1
      
      New_entry(v7.get(),v10.get(),v11.get(),v6.get(),t1,t2,dt)
   except ValueError:
      messagebox.showerror("Warning","Time does not match format hh:mm:ss ")
      ErrorLogfile('ErrorLogFiles\BaDdataTime.txt','Wrong format of time ',v8.get()+' and '+v9.get())
      raise ValueError
示例#25
0
def New_employee(name, surname):
    try:
        conn = sqlite3.connect('worksheet.db')
        print("Opened database successfully")
        conn.execute("INSERT INTO Names VALUES (?,?)", (name, surname))
        conn.commit()
        messagebox.showinfo("Successful Entry",
                            "Welcome to IBM  " + name + '  ' + surname)
    except sqlite3.IntegrityError as e:
        messagebox.showerror("Warning", "User Already Exists")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\integrityerrors.txt', str(e), surname)
        raise e
    except sqlite3.Error as e1:
        messagebox.showerror(
            "Error", "An error occured while connecting to the Database")
        conn.close()
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e1), 'None')
        raise e1
    conn.close()
示例#26
0
def Login(name, surname):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur = conn.execute('SELECT * FROM names WHERE NAME=? AND SURNAME=?',
                           (name, surname))
        if cur.fetchall():
            messagebox.showinfo("Have a nice day",
                                "Welcome back  " + name + '  ' + surname)
        else:
            messagebox.showerror(
                "Warning", "Name or Surname is wrong , check your Input")
            conn.close()
            ErrorLogfile('ErrorLogFiles\\NotfoundInDb.txt',
                         'These entries dont exist in the db',
                         name + ' and ' + surname)
            raise ValueError
    except sqlite3.Error as e:
        messagebox.showerror("Warning", "Not Connected to the Database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e), 'None')
        raise e
    conn.close()
示例#27
0
def weekcre(mindate, maxdate):
    try:
        conn = sqlite3.connect('worksheet.db')
        cur = conn.execute(
            'SELECT NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',
            (mindate, maxdate))
        if cur.fetchall():
            fo = open('weekworksheet.xls', 'a')
            cur1 = conn.execute(
                'SELECT DATE,NAME,ERGO,ACTIVITY,TIME_IN,TIME_OUT,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',
                (mindate, maxdate))
            for r in cur1.fetchall():
                date, name, ergo, activity, timei, timeo, hours = r

                #creating the right format for the excel file
                t1 = time.strptime(timei[10:len(timei)].strip(), "%H:%M:%S")
                t2 = time.strptime(timeo[10:len(timeo)].strip(), "%H:%M:%S")
                timei = time.strftime("%I:%M %p", t1)
                timeo = time.strftime("%I:%M %p", t2)
                #creating the right format for the excel file
                fo.write(date + '\t' + name + '\t' + ergo + '\t' + activity +
                         '\t' + timei + '\t' + timeo + '\t' + hours)
                fo.write('\n')
            fo.close()
            conn.close()
            messagebox.showinfo(
                "Results", "Your results for the Week are located here:" +
                '  ' + os.path.abspath('weekworksheet.xls'))
        else:
            messagebox.showerror("Error", "No entries for your dates")
            conn.close()
            raise ('Empty Dataset')

    except sqlite3.Error as e:

        messagebox.showerror("Warning", "Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e), ' ')
        raise e

    conn.close()
示例#28
0
def cre(mindate, maxdate):
    try:

        conn = sqlite3.connect('worksheet.db')
        cur = conn.execute(
            'SELECT NAME,ERGO,ACTIVITY,DATE,HOURSDEC,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',
            (mindate, maxdate))

        if cur.fetchall():
            fo = open('worksheet.xls', 'a')
            cur1 = conn.execute(
                'SELECT NAME,ERGO,ACTIVITY,DATE,HOURSDEC,HOURS FROM Ergo WHERE DATE BETWEEN ? AND ?',
                (mindate, maxdate))
            for r in cur1.fetchall():
                name, ergo, activity, date, hoursdec, hours = r
                #print(name,ergo,activity,date,str(hoursdec)[0:4],hours)dtformated = strptime(str(dt),("%H:%M"))

                fo.write(name + '\t' + ergo + '\t' + activity + '\t' + date +
                         '\t' + str(hoursdec)[0:4] + '\t' + hours)
                fo.write('\n')
            fo.close()
            conn.close()
            messagebox.showinfo(
                "Results", "Your results for the Month are located here:" +
                '  ' + os.path.abspath('worksheet.xls'))
        else:
            messagebox.showerror("Error", "No entries for your dates")
            conn.close()
            raise ('Empty Dataset')

    except sqlite3.Error as e:
        messagebox.showerror("Warning", "Not connected to the database")
        ErrorLogfile('ErrorLogFiles\\connections_errors.txt', str(e), ' ')
        raise e

    conn.close()
示例#29
0
 def newTournament(self):
     #Get the name of the new tournament, and connect to the database
     self.tourneyName = self.newTourneyName.get()
     connection = sqlite3.connect("tournament")
     cursor = connection.cursor()
     validName = True
     #Check to see if a name is entered
     if self.tourneyName=="":
         error = messagebox.showerror("Error", "Please enter a name for the self.tournament.")
         validName = False
     #Check the name for spaces
     for char in self.tourneyName:
         if char.isspace():
             error = messagebox.showerror("Error", "Please enter a name without spaces.")
             validName = False
     #Check to see if the tournament doesn't already exist
     if validName:
         try:
             cursor.execute("select * from "+self.tourneyName)
             error = messagebox.showerror("Error", "Please enter a name that doesn't already exist.")
         except:
             #Move on to the next window
             self.window.destroy()
             self.createNewTourneyWindow()
示例#30
0
 def openDatabase(self, tourneyName, openwindow):
     #Make sure that the tournament name entered exists
     try:
         self.cursor.execute("select name from "+tourneyName)
         teams = self.cursor.fetchall()
         teamList = []
         #Turn the tuple into a list
         for i in range(len(teams)):
             teamList.append(teams[i][0])
         #Get the list of teams, as well as their information from the database and pass it on to the bracket window
         self.cursor.execute("select name, startPos, currentRound, currentPos from "+tourneyName)
         openteams = self.cursor.fetchall()
         self.connection.close()
         openwindow.destroy()
         bracketWindow.window(tourneyName, len(teams), teamList, True, openteams)
     except:
         #Give an error message if the tournament doesn't exist
         error = messagebox.showerror("Error", "Please enter the name of a tournament that exists.")  
    def _place_the_order(self):
        selected_amenity = ""
        if self.amenity_type == "CAFE":
            selected_amenity = self.selected_cafe.get()
        if self.amenity_type == "VendingMachine":
            selected_amenity = self.selected_vending_machine.get()
        if not (self.uname.get() and self.ucard.get() and self.ufcode.get()
                and self.upass.get()):
            messagebox.showerror(
                title="Userinfo incomplete",
                message=
                "Please provide userinfo, password, card no and family code and try again"
            )
            return

        if (self._verify_user_login() == False):
            messagebox.showerror(
                title="User does not exist",
                message=
                "Username or card number or password is invalid. Please try again"
            )
            return 0

        if (not self.verify_user_funds()):
            messagebox.showerror(
                title="Insufficient funds",
                message=
                "User does not have enough funds in his account. Please add more funds"
            )
            return 0

        self.order_datetime = datetime.strftime(datetime.now(),
                                                "%Y-%m-%d %H:%M:%S")
        print("Todays Expense ", self.get_todays_expenditure())

        self.order_status = self.database.update_tables_with_orders_info(
            self.uname.get().lower(), self.upass.get(), self.ucard.get(),
            self.ufcode.get(), selected_amenity.lower(), self.selected_items,
            self.get_todays_expenditure(), self.get_todays_calories(),
            self.order_datetime)

        messagebox.showinfo(
            title="Order has been placed: ",
            message="Your order will be ready in 15 minutes at " +
            selected_amenity + "\nThank you for your business! ")

        self.clear_amenity_data()
        self.frame_amenity_order.destroy()
        self.frame_amenity_menu.destroy()
import MySQLdb
import from tkinter import messagebox

try:
    valor1 = "Valor1"
    valor2 = "Valor2"

    # cursorVar É A VARIÁVEL QUE VOCÊ DEFINIU NA CONEXÃO DO SEU BANCO: cursorVar = mysqlVar.cursor()
    # O SQL E ONDE ESTÁ (%s,%s)É ONDE SERÃO ADICIONADOS OS VALORES QUE VOCÊ DEFINIR..
    # QUE PODEM VIR DE CAMPOS DE TEXTOS OU OUTROS LOCAS. NO EXEMPLO EU USEI 2 VARIAVEIS  
    cursorVar.execute("INSERT INTO nomeDaTabela (campo1,campo2) VALUES (%s,%s)",(valor1, valor2))
    messagebox.showinfo("CONEXÃO", "CADASTRO REALIZADO COM SUCESSO")

    # SALVA AS ALTERAÇÕES FEITAS NO BANCO
    # IMPORTANTE CHAMAR ELE SEMPRE APÓS CADA TRANSAÇÃO PARA CONFIRMAR 
    mysqlVar.commit()
       
except:
    messagebox.showerror("CONEXÃO", "NÃO FOI POSSÍVEL CADASTRAR OS DADOS")
        
            
示例#33
0
    def _send_cmd_to_thread(self, cmd=None, *args):
        self.logger.debug('received cmd: {}'.format(cmd))
        if cmd == 'MONITOR_MODE':
            if self.IS_WIRESHARK_RUNNING or self.IS_SITE_SURVEY_RUNNING:
                self.logger.debug('Wireshark is running: {}, Site Survey is running: {}'.format(self.IS_WIRESHARK_RUNNING,
                                                                                                self.IS_SITE_SURVEY_RUNNING))
                try:
                    #python 2.7
                    tkMessageBox.showerror("Error", "Other Task Running Please Wait...")
                except ImportError:
                    #python 3.x
                    messagebox.showerror("Error", "Other Task Running Please Wait...")
                return

            # Neither Wireshark nor Site Survey is running.
            #Now changing wifi interface to Monitor mode and set to target Frequency
            self.IS_FREQUENCY_SET = False
            channel = self.var_channel_option.get().split()[1]
            self.logger.debug('Chaning WiFi channel to {}'.format(channel))
            mapping_cmd = self.CMD_MAPPING[cmd].substitute(channel=channel)

        elif cmd == 'WIFI_INFO':
            mapping_cmd = self.CMD_MAPPING[cmd]

        else:
            # for all other commands, wait until device is ready
            self.IS_DEVICE_READY = self.IS_DEVICE_CONNECTED and self.IS_WIFI_INFO_AVAILABLE and self.IS_FREQUENCY_SET
            self.logger.debug('device status - Conn: {}, WiFi: {}, Freq: {}'.format(self.IS_DEVICE_CONNECTED,
                                                                                    self.IS_WIFI_INFO_AVAILABLE,
                                                                                    self.IS_FREQUENCY_SET))
            if not self.IS_DEVICE_READY:
                self.logger.debug('device not ready. just returning...')
                try:
                    #python 2.7
                    tkMessageBox.showerror('Error', 'Device Not Ready Yet...')
                except ImportError:
                    #python 3.x
                    messagebox.showerror('Error', 'Device Not Ready Yet...')
                return
            
            if cmd == 'START_WIRESHARK':
                if self.IS_SITE_SURVEY_RUNNING:
                    self.logger.debug('site survey is running. do not start wireshark')
                    try:
                        tkMessageBox.showerror('Error', 'Site Survey is running. Please Wait...')
                    except ImportError:
                        messagebox.showerror('Error', 'Site Survey is running. Please Wait...')
                    return

                filter_expression = self.ent_set_filter.get()
                if filter_expression and not 'xx:xx:xx:xx:xx:xx' in filter_expression:
                    # this means user entered capture filter option. 
                    if not re.search(r'([0-9A-F]{2}[:-]){5}([0-9A-F]{2})', filter_expression, re.I):
                        try:
                            tkMessageBox.showerror('Error', 'Invalid capture filter')
                        except ImportError:
                            messagebox.showerror('Error', 'Invalid capture filter')
                        return
                    else:
                        filter_expression = '"wlan.addr==' + filter_expression + '"'
                        filter_option='"-f"'
                else:
                    # this means no capture filter set
                    filter_expression = ''
                    filter_option=''

                self.logger.debug('filter option: {}, filter expression: {}'.format(filter_option, filter_expression))
                    
                if not self.IS_WIRESHARK_RUNNING and self.IS_WIRESHARK_INSTALLED:
                    self.IS_WIRESHARK_RUNNING = True    
                    mapping_cmd = self.CMD_MAPPING[cmd].substitute(filter_option=filter_option, filter_expression=filter_expression)
                else:
                    #prevent double-click in short period of time which causes double wireshark launching
                    return
                    
            elif cmd == 'STOP_WIRESHARK':
                mapping_cmd = 'taskkill /IM wireshark.exe'
                from subprocess import call, Popen, PIPE, STDOUT
                p = Popen(mapping_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
                stdout, stderr = p.communicate()
                return
                
            elif cmd == 'STOP_PLINK':
                mapping_cmd = 'taskkill /IM plink.exe /F /T'
                from subprocess import call, Popen, PIPE, STDOUT
                p = Popen(mapping_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
                stdout, stderr = p.communicate()
                return
                
            elif cmd == 'SITE_SURVEY':
                if self.IS_WIRESHARK_RUNNING:
                    self.logger.debug('wireshark is running. do not start site survey')
                    try:
                        tkMessageBox.showerror('Error', 'Wireshark is running. Please Wait...')
                    except ImportError:
                        messagebox.showerror.showerror('Error', 'Wireshark is running. Please Wait...')
                    return
                
                if not self.IS_SITE_SURVEY_RUNNING:
                    self.IS_SITE_SURVEY_RUNNING = True
                    mapping_cmd = self.CMD_MAPPING[cmd].substitute(timeout=args[0])
                else:
                    return
            elif cmd == 'STOP_DEVICE':
                # double-confirm 
                try:
                    yes = tkMessageBox.askyesno('Exit', 'Do you really want to shutdown device?')
                except:
                    yes = messagebox.askyesno('Exit', 'Do you really want to shutdown device??')
                if not yes:
                    return
                mapping_cmd = self.CMD_MAPPING[cmd]
            else:
                mapping_cmd = self.CMD_MAPPING[cmd]

        # now send cmd to ExeCmdThread
        self.logger.debug('send cmd to ExeCmdThread: cmd:{}, mapping_cmd:{}'.format(cmd, mapping_cmd))
        self.queue_cmd_request.put((cmd, mapping_cmd))
示例#34
0
    def _update_gui_status(self):
        # this gets called every 3s and update GUI display
        
        if not self.queue_conn_status.empty():
            MSG_TYPE, STATUS = self.queue_conn_status.get()
            self.logger.debug('status msg - MSG_TYPE: {}, STATUS: {}'.format(MSG_TYPE, STATUS))
            self.queue_conn_status.task_done()

            if MSG_TYPE == 'IS_DEVICE_CONNECTED':
                self.IS_DEVICE_CONNECTED = STATUS
                if self.IS_DEVICE_CONNECTED:
                    self.lbl_conn_status_val['text'] = 'Connected'
                    self.logger.debug('device connected. getting wifi info and setting initial channel')
                    self._send_cmd_to_thread('WIFI_INFO')
                    #self._send_cmd_to_thread('MONITOR_MODE')
                else:
                    self.IS_WIFI_INFO_AVAILABLE = False
                    self.IS_FREQUENCY_SET = False
                    self.lbl_conn_status_val['text'] = 'Connecting...'
                    self.lbl_wifi_interface_val['text'] = ' '
                    
            elif MSG_TYPE == 'IS_WIRESHARK_RUNNING':
                self.IS_WIRESHARK_RUNNING = STATUS
                if self.IS_WIRESHARK_RUNNING:
                    self.btn_start_sniff['text'] = 'Stop(Wireshark Running)'
                else:
                    self.btn_start_sniff['text'] = 'Start'
            else:
                pass
                
        if not self.queue_cmd_response.empty():
            # check what cmd, its response and update gui          
            CMD_TYPE, (success, stdout, stderr) = self.queue_cmd_response.get()
            self.logger.debug('CMD_TYPE: {}, success: {}, stdout: {}, stderr: {}'.format(CMD_TYPE, success, stdout, stderr))
            self.queue_cmd_response.task_done()
            
            if CMD_TYPE == 'WIFI_INFO':
                if '802.11' in stdout:
                    if '2.4G' in stdout and '5G' in stdout:
                        self.logger.debug('wifi interface: Dual band')
                        # update available channels                        
                        self.options_set_channel['menu'].delete(0, 'end')
                        self.var_channel_option.set('CH 1 [2.412 GHz]')
                        for channel in self.DUAL_BAND:
                            self.options_set_channel['menu'].add_command(label=channel,
                                                                  command=tk._setit(self.var_channel_option, channel))
                    else:
                        self.logger.debug('wifi interface: Single band')

                    # strip spaces and also 'Unable to use key file' which might come if ssh key auth fails.
                    # if ssh key auth fails, plink tries with password.
                    # ToDo: just parse out wifi info from stdout using regular expression
                    if "The server's host key" in stdout:
                        #this is first time so need to parse output
                        self.lbl_wifi_interface_val['text'] = stdout.split('(y/n)')[-1].strip()
                    else:
                        self.lbl_wifi_interface_val['text'] = stdout.split('Unable to use key file')[0].strip()
                    self.IS_WIFI_INFO_AVAILABLE = True
                    # only after device is connected and wifi info is available, config monitor mode
                    self._send_cmd_to_thread('MONITOR_MODE')
                else:
                    try:
                        #python 2.7
                        tkMessageBox.showerror('Error', 'No WiFi Device\n')
                    except ImportError:
                        #python 3.x
                        messagebox.showerror('Error', 'No WiFi Device\n')
                        
                    self.lbl_wifi_interface_val['text'] = 'No WiFi Device'
                    self.logger.debug('err in wifi info. stdout: {}'.format(stdout))
                    
            elif CMD_TYPE == 'SITE_SURVEY':
                self.IS_SITE_SURVEY_RUNNING = False
                self.logger.debug('got site survey result: {}'.format(stdout.strip('\n').split('Unable to use key file')[0]))
                self._show_site_survey_result(stdout.strip('\n').split('Unable to use key file')[0])

                # here need to re configure wifi channel as site_survey hopps different channels
                self._send_cmd_to_thread('MONITOR_MODE')
            
            elif CMD_TYPE == 'MONITOR_MODE':
                # if fail, show error message
                if not success or 'Error for wireless request' in stdout or 'Unable to open connection' in stdout:
                    self.logger.debug('Error for wireless setting request: {}'.format(stdout))
                    try:
                        #python 2.7
                        tkMessageBox.showerror('Error', 'Set Frequency Failed...\n'
                                               '(This Frequency is not supported in WiFi Device)')
                        self.var_channel_option.set('CH 1 [2.412 GHz]')
                    except ImportError:
                        #python 3.x
                        messagebox.showerror('Error', 'Set Frequency Failed...\n'
                                               '(This Frequency is not supported in WiFi Device)')
                        self.var_channel_option.set('CH 1 [2.412 GHz]')
                        
                    self.logger.debug('Frequency setting failed...')
                    self.IS_FREQUENCY_SET = False
                elif 'No such device' in stdout:
                    try:
                        #python 2.7
                        tkMessageBox.showerror('Error', 'No WiFi Device')
                    except ImportError:
                        #python 3.x
                        messagebox.showerror('Error', 'No WiFi Device')                 
                else:
                    self.IS_FREQUENCY_SET = True
            elif CMD_TYPE == 'STOP_DEVICE':
                self.SHUTDOWN_IN_PROGRESS = True
                self.btn_device_shutdown['text'] = 'Shutdown in Progress...'
                self.btn_device_shutdown['bg'] = 'orange red'
            
            else:
                # ignore START_WIRESHARK or STOP_WIRESHARK.
                # Wireshark running status is monitored by ChkStatusThread
                pass

        # other statuff to update gui from flags files.       
        self.IS_DEVICE_READY = self.IS_DEVICE_CONNECTED and self.IS_WIFI_INFO_AVAILABLE and self.IS_FREQUENCY_SET
        if not self.IS_DEVICE_READY:
            self.logger.debug('device not ready - conn: {}, wifi_info: {}, freq set: {}'.format(self.IS_DEVICE_CONNECTED,
                                                                                                self.IS_WIFI_INFO_AVAILABLE,
                                                                                                self.IS_FREQUENCY_SET))
            if not self.IS_DEVICE_CONNECTED:
                self.lbl_status['text'] = 'Status: Not Ready'
            elif not self.IS_WIFI_INFO_AVAILABLE:
                self.lbl_status['text'] = 'Status: Checking WiFi'
            elif not self.IS_FREQUENCY_SET:
                # device ready but frequency not set
                self.lbl_status['text'] = 'Status: Setting Freq'
            else:
                self.lbl_status['text'] = 'Status: Unknown Err'
            self.lbl_status.config(fg='red')
        else:
            # device ready
            self.lbl_status['text'] = 'Status: Device Ready'
            self.lbl_status.config(fg='forest green')
        
        if self.IS_SITE_SURVEY_RUNNING:
            if 'Start' in self.btn_site_survey.cget('text'):
                self.btn_site_survey['text'] = 'In Progress(30s)...'
                self.start_time = datetime.datetime.now()
            else:
                remaining_time = 30 - ((datetime.datetime.now() - self.start_time).seconds)
                remaining_time = 0 if remaining_time < 0 else remaining_time
                self.btn_site_survey['text'] = 'In Progress({}s)...'.format(remaining_time)
                
        if not self.IS_SITE_SURVEY_RUNNING and 'Start' not in self.btn_site_survey.cget('text'):
            self.btn_site_survey['text'] = 'Start'
            
        if not self.IS_DEVICE_CONNECTED:
            txt = self.lbl_conn_status_val.cget('text')
            txt = txt + '.' if len(txt) < 15 else 'Connecting'
            self.lbl_conn_status_val['text'] = txt

        if not self.IS_DEVICE_CONNECTED and self.SHUTDOWN_IN_PROGRESS:
            self.logger.debug('OPi-Pcap shutdown successful!!!')
            self.SHUTDOWN_IN_PROGRESS = False
            self.btn_device_shutdown['text'] = 'Shutdown Gracefully'
            self.btn_device_shutdown['bg'] = 'SteelBlue1'
            try:
                #python 2.7
                tkMessageBox.showinfo('Shutdown', 'Shutdown OPi-Pcap successful!!!')
            except ImportError:
                #python 3.x
                messagebox.showinfo('Shutdown', 'Shutdown OPi-Pcap successful!!!')
    
        self.after(1000, self._update_gui_status)
示例#35
0
    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)

        # logging
        self.log_file = 'opi_pcap.log'
        self.logger = get_logger(log_file=self.log_file)
        
        # for pyinstaller to include everything in one executable
        try:
            #self.iconbitmap(default='resources\logo.ico')
            self.logo = pyinstaller_resource_path('resources\logo.ico')            
            self.plink = pyinstaller_resource_path('resources\plink.exe')
            self.ssh_key = pyinstaller_resource_path('resources\id_rsa_putty.ppk')
            self.say_yes = pyinstaller_resource_path('resources\say.yes')
        except Exception as e:
            self.logger.exception('cannot find resource files')
            try:
                #python 2.7
                tkMessageBox.showerror('Error', 'Cannot find resource files')
            except ImportError:
                #python 3.x
                messagebox.showerror('Error', 'Cannot find resource files')
            return

        self.tk_setPalette(background='ghost white')
        self.title('OPi-Pcap Control Panel')
        self.resizable(width=False, height=False)
        self.option_add('*Font', 'Courier 10')
        self.iconbitmap(default=self.logo)
        
        self._create_menu()
        self._create_body()
        self.opi = OPi(logger=self.logger)
        
        self.SINGLE_BAND = OPi.CHANNELS_24G
        self.DUAL_BAND = OPi.CHANNELS_24G + OPi.CHANNELS_5G

        # flags based on which gui status is updated
        self.IS_DEVICE_CONNECTED = False
        self.IS_WIFI_INFO_AVAILABLE = False
        self.IS_FREQUENCY_SET = False
        self.IS_SITE_SURVEY_RUNNING = False
        self.IS_WIRESHARK_RUNNING = False
        self.SHUTDOWN_IN_PROGRESS = False
        self.IS_WIRESHARK_INSTALLED = False
        
        # device is ready only when pingable and wifi interface is checked and frequency set is done.
        self.IS_DEVICE_READY = self.IS_DEVICE_CONNECTED and self.IS_WIFI_INFO_AVAILABLE and self.IS_FREQUENCY_SET  
        
        # commands for gui program to execute            
        self.WIFI_INFO = (self.plink + ' -ssh -i ' + self.ssh_key + ' -pw orangepi [email protected] '
                          '"wifi_info.sh" < ' + self.say_yes)
        self.MONITOR_MODE = Template(self.plink + ' -ssh -i ' + self.ssh_key + ' -pw orangepi '
                                     '[email protected] "sudo monitor_mode.sh wlan1 $channel"')
        self.SITE_SURVEY = Template(self.plink + ' -ssh -i ' + self.ssh_key + ' -pw orangepi '
                                    '[email protected] "site_survey.sh wlan1 $timeout"')
        self.START_WIRESHARK = Template(self.plink + ' -ssh -i ' + self.ssh_key + ' -pw orangepi [email protected] '
                                '"sudo tcpdump -i wlan1 -U -w - 2> /dev/null"'
                                '| ("C:\Program Files\Wireshark\Wireshark.exe" $filter_option $filter_expression "-k" "-i" "-")')
        self.STOP_WIRESHARK = 'taskkill /F /IM wireshark.exe'
        self.STOP_PLINK = 'taskkill /F /IM plink.exe'
        self.STOP_DEVICE = (self.plink + ' -ssh -i ' + self.ssh_key + ' -pw orangepi [email protected] '
                                   '"sudo sync; sync; shutdown -h now"')       
        # map commands for ease of exchanging messages with Thread
        self.CMD_MAPPING ={'WIFI_INFO': self.WIFI_INFO,
                           'SITE_SURVEY': self.SITE_SURVEY,
                           'MONITOR_MODE': self.MONITOR_MODE,
                           'START_WIRESHARK': self.START_WIRESHARK,
                           'STOP_WIRESHARK': self.STOP_WIRESHARK,
                           'STOP_PLINK': self.STOP_PLINK,
                           'STOP_DEVICE': self.STOP_DEVICE,
                            }
    
        # 3 queues to communicate with Thread
        self.queue_conn_status = Queue()
        self.queue_cmd_request = Queue()
        self.queue_cmd_response = Queue()

        # thread to monitor device connectivity and wireshark running status and update main thread
        self.status_check_thread = StatusCheckThread(self.opi, self.queue_conn_status, logger=self.logger)
        self.status_check_thread.start()

        # thread to execute cmd and return result to main thread
        self.exec_cmd_thread = ExecCmdThread(self.opi, self.queue_cmd_request, self.queue_cmd_response, logger=self.logger)
        self.exec_cmd_thread.start()
        
        # self._update_gui_status: check queue messages from Threads and update GUI display
        self.after(100, self._update_gui_status)

        # check if wireshark is installed
        if not os.path.isfile('C:\Program Files\Wireshark\Wireshark.exe'):
            self.IS_WIRESHARK_INSTALLED = False
            self.logger.error('Cannot find Wireshark program.')
            try:
                #python 2.7
                tkMessageBox.showerror('Error', 'Cannot find Wireshark Program\nPlease install Wireshark first and restart program')
            except ImportError:
                #python 3.x
                messagebox.showerror('Error', 'Cannot find Wireshark Program\nPlease install Wireshark first and restart program')
            self._quit()
        else:
            self.IS_WIRESHARK_INSTALLED = True