def dependency_comp(bt, popup, win): popup.delete() try: con = urllib2.urlopen("http://www.google.com/") except: logging.exception("No network activity detected") logging.exception("Please try again with an established Internet Connection.") no_net_popup(win) else: logging.info("Starting attempt to fulfill dependencies:") dep_comp = "apt-get -f install -y" n = elm.Notify(win) esudo.eSudo(dep_comp, win, start_callback=start_cb, end_callback=dep_cb, data=n)
def check_file_install(self, bt1, win, bt2, en): if self.file == HOME: nofile_error_popup(win) return else: bt1.disabled_set(True) bt2.disabled_set(True) en.disabled_set(True) self.bt1 = bt1 self.bt2 = bt2 logging.info("Package: %s" %self.file) install_deb = 'dpkg -i %s'%self.file n = elm.Notify(win) esudo.eSudo(install_deb, win, bt1, bt2, en, start_callback=start_cb, end_callback=main_cb, data=n) return
def dependency_grab(tb, bt, win): try: con = urllib2.urlopen("http://www.google.com/") except: logging.exception("No network activity detected") logging.exception("Please try again with an established Internet Connection.") iw.delete() no_net_popup(win) else: missingdep = deb.missing_deps separator_string = " " missdep = separator_string.join(missingdep) logging.info("Starting Dependency Grab:") dep_grab = "apt-get --no-install-recommends install -y %s" %(missdep) n = elm.Notify(win) esudo.eSudo(dep_grab, win, start_callback=start_cb, end_callback=dep_grab_cb, data=n)
def check_file_install(self, bt1, bt2, win, en): if self.file == HOME: generic_error_popup(win, "<b>No File Selected</><br><br>Please select an appropriate file candidate for installation.") else: bt1.disabled_set(True) bt2.disabled_set(True) en.disabled_set(True) self.bt1 = bt1 self.bt2 = bt2 print("Package: %s" %self.file) install_deb = 'dpkg -i %s'%self.file n = elm.InnerWindow(win) info_en = elm.Entry(win) info_en_bt = elm.Button(win) bt3 = elm.Button(win) bt4 = elm.Button(win) esudo.eSudo(bt3=bt3, bt4=bt4, info=info_en, info_bt=info_en_bt, command=install_deb, window=win, bt1=bt1, bt2=bt2, en=en, start_callback=start_cb, end_callback=main_cb, data=n)
def dependency_comp(popup, win, en): popup.delete() try: con = urllib2.urlopen("http://www.google.com/") #~ except urllib2.URLError, e: except IOError: print("No network activity detected") print("Please try again with an established Internet Connection.") no_net_popup(win) else: print("Starting attempt to fulfill dependencies:") dep_comp = "apt-get -f install" n = elm.InnerWindow(win) info_en = elm.Entry(win) info_en_bt = elm.Button(win) bt3 = elm.Button(win) bt4 = elm.Button(win) esudo.eSudo(bt3=bt3, bt4=bt4, info=info_en, en=en, info_bt=info_en_bt, command=dep_comp, window=win, start_callback=start_cb, end_callback=dep_cb, data=n)
def dependency_grab(): try: con = urllib2.urlopen("http://www.google.com/") #~ except urllib2.URLError, e: except IOError: print("No network activity detected") print("Please try again with an established Internet Connection.") iw.delete() no_net_popup(self.win) else: missingdep = deb.missing_deps missdep = " ".join(missingdep) print("Starting Dependency Grab:") dep_grab = "apt-get install %s" %(missdep) n = elm.InnerWindow(win) info_en = elm.Entry(win) info_en_bt = elm.Button(win) bt3 = elm.Button(win) bt4 = elm.Button(win) esudo.eSudo(depbt_chk=self.depbtn, bt3=bt3, bt4=bt4, deb=deb, dep_fx=depends, dep_btn=bt2, info=info_en, info_bt=info_en_bt, command=dep_grab, window=self.win, start_callback=start_cb, end_callback=dep_grab_cb, data=n)
def run_command(self, bnt, window, command): if window: window.hide() cmd = esudo.eSudo(command, self.win, end_callback=self.refreshInterface)
def run_command(self, bnt, window, command): if window: window.hide() cmd = esudo.eSudo(command, self.win)
command = "leafpad" window = elementary.StandardWindow("test", "eSudo Test!") window.callback_delete_request_add(lambda o: elementary.exit()) window.resize(400,400) box = elementary.Box(window) box.size_hint_weight = 1.0, 1.0 window.resize_object_add(box) box.show() lbl = elementary.Label(window) lbl.text = "eSudo Test!" lbl.show() box.pack_end(lbl) window.show() def end_cb(exit_code): if exit_code == 0: print("Success") else: print("Something went wrong") esudo.eSudo(command, window, end_callback=end_cb) esudo.eSudo("This cannot succeed", window, end_callback=end_cb) elementary.run() elementary.shutdown()
lbl.show() box.pack_end(lbl) window.show() def start_cb(*args, **kwargs): n = kwargs["data"] pb = elementary.Progressbar(window) pb.style = "wheel" pb.pulse(True) n.orient = elementary.ELM_NOTIFY_ORIENT_CENTER n.content = pb n.show() def end_cb(exit_code, *args, **kwargs): n = kwargs["data"] n.delete() if exit_code == 0: print("Success") else: print("Something went wrong") n = elementary.Notify(window) esudo.eSudo(command, window, start_callback=start_cb, end_callback=end_cb, data=n) n = elementary.Notify(window) esudo.eSudo("This cannot succeed", window, start_callback=start_cb, end_callback=end_cb, data=n) elementary.init() elementary.run() elementary.shutdown()
def execute(self, bt, val): src = self.fssrc.selected_get() dest = self.fsdest.selected_get() n = elm.Notify(self.win) if val == 1: ran = "copy" copy = "cp '%s' '%s'" %(src, dest) if self.params: copy = "cp %s '%s' '%s'" %(self.params, src, dest) esudo.eSudo(copy, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n) elif val == 2: ran = "move" move = "mv '%s' '%s'" %(src, dest) if self.params: move = "mv %s '%s' '%s'" %(self.params, src, dest) esudo.eSudo(move, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n) elif val == 3: ran = "removal" remove = "rm '%s'" %src if self.params: print("h") remove = "rm %s '%s'" %(self.params, src) elif self.shred: remove = "shred '%s'" %src else: pass esudo.eSudo(remove, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n) elif val == 4: ran = "directory removal" dir_remove = "rm -R '%s'" %src if self.params: dir_remove = "rm -R %s '%s'" %(self.params, src) esudo.eSudo(dir_remove, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n) elif val == 5: ran = "rename" rename = "mv '%s' '%s'" %(src, dest) if self.params: rename = "mv %s '%s' '%s'" %(self.params, src, dest) esudo.eSudo(rename, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n) else: ran = "directory copy" dir_copy = "cp -R '%s' '%s'" %(src, dest) if self.params: dir_copy = "cp -R %s '%s' '%s'" %(self.params, src, dest) esudo.eSudo(dir_copy, self.win, self.bt, ran, start_callback=self.start_cb, end_callback=self.end_cb, data=n)