def getDistName(): distroName = platform.linux_distribution( supported_dists=conf.supported_linux_dists)[0] if distroName == "": resin_ui.alert( hyperlocale.getLocalisedString("incorrectSystemError").format( hyperlocale.getLocalisedString("unknown")), sys.exit) return distroName
def create_conf_folder(): try: os.stat(conf_folder) except: try: os.mkdir(conf_folder) except: message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) message.set_markup(hyperlocale.getLocalisedString("cannotCreateConfError")) message.set_title(hyperlocale.getLocalisedString("productName")) message.run() sys.exit(1) os.chmod(conf_folder, 0755)
def __init__(self): gladeUI = resin_config.gladeUI gladeUI.signal_autoconnect(self) self.window = gladeUI.get_widget("error_report") self.tree = gladeUI.get_widget("error_tree") self.close = gladeUI.get_widget("error_close") self.label = gladeUI.get_widget("error_label") self.close.connect("clicked",self.on_close) self.window.connect("delete-event",self.window.hide_on_delete) self.window.set_icon_from_file(resin_config.images["windowIcon"]) extra_functions.set_title(self.window, hyperlocale.getLocalisedString("errorReport")) tree = self.tree cell = gtk.CellRendererPixbuf() cell.set_property("width",56) column = gtk.TreeViewColumn(None, cell, pixbuf=0) tree.append_column(column) cell = gtk.CellRendererText() cell.set_property("wrap-width",500) column = gtk.TreeViewColumn(None,cell,markup=1) column.set_fixed_width(400) column.set_max_width(400) column.set_clickable(False) tree.append_column(column) self.label.set_markup("<span size='x-large'><b>Errors and information...</b></span>\nSee below for more details") self.tree.connect("cursor-changed",self.unselect)
def __init__(self): gladeUI = resin_config.gladeUI #get glade interface gladeUI.signal_autoconnect(self) logo = gtk.gdk.pixbuf_new_from_file(resin_config.images['aboutSplash']) self.window = gladeUI.get_widget('AX_about') self.window.set_modal(True) self.label = gladeUI.get_widget('about_label') self.logo_area = gladeUI.get_widget('AX_image') self.logo_area.set_from_pixbuf(logo) self.okay = gladeUI.get_widget('AX_about_ok_button') self.okay.connect("clicked",self.hide) self.window.set_icon_from_file(resin_config.images['windowIcon']) extra_functions.set_title(self.window, hyperlocale.getLocalisedString("about")) self.window.connect("delete-event",extra_functions.no_delete) self.label.set_text("<span size='x-large'><b>{0} {1}</b></span>\n{2}".format(hyperlocale.getLocalisedString("productName"), conf.version, hyperlocale.getLocalisedString("aboutText"))) self.label.set_use_markup(True)
def __init__(self): gladeUI = resin_config.gladeUI gladeUI.signal_autoconnect(self) self.window = gladeUI.get_widget("textview") self.window.connect("delete-event",self.window.hide_on_delete) self.textview = gladeUI.get_widget("text_text") self.textbuffer = gtk.TextBuffer() self.textview.set_buffer(self.textbuffer) self.window.set_icon_from_file(resin_config.images["windowIcon"]) self.window.set_title(hyperlocale.getLocalisedString("productName"))
def __init__(self,message=None,handler=None,window=None,width=None,height=None): self.handler = handler gladeUI = resin_config.gladeUI gladeUI.signal_autoconnect(self) self.window = gladeUI.get_widget('alert') if width and height: self.window.resize(width,height) label = gladeUI.get_widget('alert_label') label.set_text(message) label.set_use_markup(True) extra_functions.set_title(self.window, hyperlocale.getLocalisedString("alert")) self.window.connect("delete-event",extra_functions.no_delete) self.window.set_modal(True) self.window.show() if window: self.window.set_transient_for(window) self.up = 1 if self.handler == None: self.handler = self.window.hide while self.up: extra_functions.update_ui()
def checkEnviroment(self): resin_config.log( hyperlocale.getLocalisedString("logStarting").format(conf.version)) cur_user = getpass.getuser() if cur_user != "root": self.splashArea.window.hide() resin_ui.alert( hyperlocale.getLocalisedString("notRunningAsRootError"), sys.exit) conf.uName = distro_helpers.getDistName() self.splashArea.prog.set_text( hyperlocale.getLocalisedString("checkVersion").format(conf.uName)) self.splashArea.prog.set_fraction(0.2) extra_functions.update_ui() conf.uVersion = distro_helpers.getDistVersion() distro_helpers.getDesktop() self.splashArea.prog.set_text( hyperlocale.getLocalisedString("foundVersion").format( conf.uVersion)) extra_functions.update_ui() if conf.uName not in conf.supported_linux_dists: self.splashArea.window.hide() resin_ui.alert( hyperlocale.getLocalisedString("incorrectSystemError").format( conf.uName), sys.exit) #check enviroment for synaptic ect... self.splashArea.prog.set_text( hyperlocale.getLocalisedString("checkEnvironment")) self.splashArea.prog.set_fraction(0.4) extra_functions.update_ui() conflicts = distro_helpers.checkConflicts() #locker = exclusive_lock(); #report conflicts if any if conflicts: self.splashArea.window.hide() resin_ui.alert(conflicts[1], sys.exit) self.splashArea.prog.set_text( hyperlocale.getLocalisedString("checkConnection")) self.splashArea.prog.set_fraction(0.5) extra_functions.update_ui() #check for an internerd connection... if not distro_helpers.checkConnection(): self.splashArea.window.destroy() resin_ui.alert(hyperlocale.getLocalisedString("notConnectedError"), sys.exit) #FIXME #self.splashArea.prog.set_text("Setting Up Repositories...") #self.splashArea.prog.set_fraction(0.7) #extra_functions.update_ui() #repoUpdate = setupRepos() ###update splash... #self.splashArea.prog.set_text("Updating Repositories...") #self.splashArea.prog.set_fraction(0.8) #extra_functions.update_ui() #if repoUpdate or conf.update_my_repos == 1: #self.splashArea.window.hide() #axUser.update_apt() #self.splashArea.window.show() #update_ui() #conf.update_my_repos = 0; self.splashArea.prog.set_text("Building Scripts List...") self.splashArea.prog.set_fraction(0.9) extra_functions.update_ui() extra_functions.buildScripts() self.splashArea.prog.set_fraction(1) extra_functions.update_ui() self.splashArea.window.hide() extra_functions.update_ui()
def __init__(self): print(hyperlocale.getLocalisedString("starting")) conf.restricted = 0 self.splashArea = resin_ui.splash() extra_functions.update_ui() self.checkEnviroment()
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Hypermatix64. If not, see <http://www.gnu.org/licenses/>. # # interface.py - starts interface import sys, argparse import hyperlocale import conf import gtk ultamatix_version_num = "1.9.0" ultamatix_version = hyperlocale.getLocalisedString( "productName") + ": " + ultamatix_version_num if conf.args.version: print(ultamatix_version) sys.exit(0) if conf.args.debug: print(hyperlocale.getLocalisedString("runningInDebugMode")) print(ultamatix_version) if conf.args.dumplog: try: dump = open("/var/log/hypermatix64_activity.log").readlines() except: print(hyperlocale.getLocalisedString("noActivityLogError")) sys.exit(1) for d in dump: print(d)
conf.home = location import hyperlocale # FIXME - There should be a more specific way to get the DE than just # using an environment variable to determine if we're on KDE or not. if "KDE_FULL_SESSION" in os.environ: conf.onkde = True if "--relaunch" in sys.argv: sys.argv.pop(sys.argv.index("--relaunch")) # hide from argparse relaunched = True else: relaunched = False welcome = hyperlocale.getLocalisedString("welcome") print(welcome) for count in welcome: sys.stdout.write("=") # btw, this page doesn't actually exist on my site yet - I will make # it and remove this comment once HX64 is usable print("\nhttp://home.exetel.com.au/declanhoare/hypermatix64") parser = argparse.ArgumentParser( description=hyperlocale.getLocalisedString("productDescription")) parser.add_argument("-d", "--debug", dest="debug", action="store_const", const=True,
def set_title(window, addition=False): if addition: window.set_title("{0}: {1}".format( hyperlocale.getLocalisedString("productName"), addition)) else: window.set_title(hyperlocale.getLocalisedString("productName"))
def create_log(): try: os.stat(log_file) except: open(log_file, "w").write("") log(hyperlocale.getLocalisedString("logStarted"))
tmp = open(install_log,"w") tmp.write("\n".join(installed) + "\n") tmp.close() return True def get_activity(self): return open(self.log_file).read() create_conf_folder() create_usage_log() create_installed_log() create_log() gladeUI = gtk.glade.XML(os.path.join(conf.home, "resin_glade.glade")) dist = distro_helpers.getDistName() print(hyperlocale.getLocalisedString("distro") + dist) dom = xml_functions.DOMX() dom.load(os.path.join(conf.home, "conf_data.xml")) locations = dom.return_dict_with_xpath('/*/locations/*') for key in locations.keys(): locations[key] = locations[key].format(conf.home) images = dom.return_dict_with_xpath('/*/images/*') for key in images.keys(): images[key] = locations['image'] + "/" + images[key] key_dom = xml_functions.DOMX() apt_sources = locations['sources']+"/sources.list" # FIXME catagorys = xml_functions.DOMX() catagorys.load(locations['clientData']+"/category_data.xml") catagory = catagorys.xBuild() client = "" file_li = os.popen("find %s"%locations['clientData']+'/scripts/'+dist,"r").readlines()