def dlfernwartung(): import urllib tempdir = (curdir + sep + "temp") if not os.path.exists(tempdir): os.makedirs(tempdir) if _osenv() == "nt": showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download) urllib.urlretrieve(dlsource.twclient_nt, savfilent) showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download_fertig) elif _osenv() == "linux": showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download) urllib.urlretrieve(dlsource.twclient_linux, savfilelinux) os.system("tar xfz " + savfilelinux + " -C " + curdir + sep + "temp" + sep) showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download_fertig) elif _osenv() == "macos": showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download) urllib.urlretrieve(dlsource.twclient_macos, savfilemacos) showinfo(ltrans.button_support_teamviewer_download, ltrans.label_shortdesc_teamviewer_download_fertig) return 0
def twstart(): if _osenv() == "nt": # appstart = [savfilent] p1 = Popen(savfilent) elif _osenv() == "linux": # appstart = twstart_linux p1 = Popen(twstart_linux) elif _osenv() == "macos": appstart = ['open', savfilemacos] p1 = Popen(appstart) return 0
def editconfiguration(): editor = '' if _osenv() == "nt": editor = 'notepad' elif _osenv() == "linux": editor = 'notepad' elif _osenv == "macos": editor = 'notepad' else: editor = 'notepad' confopen = [editor, 'conf/config.py'] p7 = Popen(confopen, stdout=PIPE) cmdt = p7.communicate()[0]
def chk_connection(): pingopt = '' stat = "" if _osenv() == "nt": pingopt = '-n' elif _osenv() == "linux": pingopt = '-c' elif _osenv() == "macos": pingopt = '-c' else: pingopt = '-c' if os.system("ping " + pingopt + " " + _check.rate + " " + _check.pingurl) == 0: stat = "OK" else: stat = "Error" return stat
def inetcon(): pingopt = '' if _osenv() == "nt": pingopt = '-n' elif _osenv() == "linux": pingopt = '-c' elif _osenv() == "macos": pingopt = '-c' else: pingopt = '-c' if os.system("ping " + pingopt + " " + _check.rate + " " + _check.pingurl) == 0: lb2["text"] = ltrans.display_connection_true lb2["bg"] = "#00FF00" else: lb2["text"] = ltrans.display_connection_false lb2["bg"] = "#FF0000" return 0
def extract(fpath, fname): ext = (fpath + sep + fname) try: with zipfile.ZipFile(ext, 'r') as z: z.extractall(fpath + sep) os.remove(ext) if _osenv() == "nt": mscopy(fpath, curdir) msdelupdate(fpath) else: copyTree(fpath, curdir) shutil.rmtree(fpath) except IOError: print("extract error")
def extract(fpath, fname): ext = (fpath+sep+fname) try: with zipfile.ZipFile(ext, 'r') as z: z.extractall(fpath+sep) os.remove(ext) if _osenv() == "nt": mscopy(fpath, curdir) msdelupdate(fpath) else: copyTree(fpath, curdir) shutil.rmtree(fpath) except IOError: print("extract error")
def __init__(self): if _osenv() == "nt": updname = "scupdate_win.zip" else: updname = "scupdate_linux.zip" self.url = ("http://download.bailey-solution.com/Support-Client/"+updname) self.dldir = (curdir+sep+"temp"+sep+"update") self.fname = self.url.split('/')[-1] if chk_connection() == "OK": try: self.dlprogram() extract(self.dldir, self.fname) showinfo(ltrans.programm_name, ltrans.label_update_finish) except IOError: print("cant run") else: showerror(ltrans.programm_name, ltrans.label_update_error)
def __init__(self): if _osenv() == "nt": updname = "scupdate_win.zip" else: updname = "scupdate_linux.zip" self.url = ("http://download.bailey-solution.com/Support-Client/" + updname) self.dldir = (curdir + sep + "temp" + sep + "update") self.fname = self.url.split('/')[-1] if chk_connection() == "OK": try: self.dlprogram() extract(self.dldir, self.fname) showinfo(ltrans.programm_name, ltrans.label_update_finish) except IOError: print("cant run") else: showerror(ltrans.programm_name, ltrans.label_update_error)
# Main Window main = tk.Tk() # window Title main.wm_title(ltrans.programm_name) main.grid_columnconfigure(0, weight=1) main.resizable(True, True) # dropdown Menu menu = tk.Menu(main) main.config(menu=menu) dateimenu = tk.Menu(menu) menu.add_cascade(label=ltrans.button_filemenu_label, menu=dateimenu) if _osenv() != 'nt': dateimenu.add_command(label=ltrans.button_config_editconf, command=editconfiguration) dateimenu.add_separator() dateimenu.add_command(label=ltrans.button_filemenu_end, command=ende) toolmenu = tk.Menu(menu) menu.add_cascade(label=ltrans.button_support_label, menu=toolmenu) toolmenu.add_command(label=ltrans.button_connection, command=inetcon) toolmenu.add_separator() toolmenu.add_command(label=ltrans.button_support_teamviewer_download, command=dlfernwartung) toolmenu.add_command(label=ltrans.button_support_teamviewer_start, command=twstart)
# Main Window main = tk.Tk() # window Title main.wm_title(ltrans.programm_name) main.grid_columnconfigure(0, weight=1) main.resizable(True, True) # dropdown Menu menu = tk.Menu(main) main.config(menu=menu) dateimenu = tk.Menu(menu) menu.add_cascade(label=ltrans.button_filemenu_label, menu=dateimenu) if _osenv() != 'nt': dateimenu.add_command(label=ltrans.button_config_editconf, command=editconfiguration) dateimenu.add_separator() dateimenu.add_command(label=ltrans.button_filemenu_end, command=ende) toolmenu = tk.Menu(menu) menu.add_cascade(label=ltrans.button_support_label, menu=toolmenu) toolmenu.add_command(label=ltrans.button_connection, command=inetcon) toolmenu.add_separator() toolmenu.add_command(label=ltrans.button_support_teamviewer_download, command=dlfernwartung) toolmenu.add_command(label=ltrans.button_support_teamviewer_start, command=twstart) hilfemenu = tk.Menu(menu) menu.add_cascade(label=ltrans.button_help_label, menu=hilfemenu) hilfemenu.add_command(label=ltrans.button_help_steps, command=helpsteps)