Exemplo n.º 1
0
Arquivo: vga.py Projeto: Mrmohanak/occ
 def call_vga_mechanism(self, b, m):
     s = self.ccw.mechanism('vga', m)
     if s == 'NotAuth': return
     if s == '0': info(_('Done.'), self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
Exemplo n.º 2
0
 def rm_samples(self, b):
     if not os.path.exists(self.oj_samples):
         info(_('Samples icon already removed.'), self.ccw)
         return
     try: os.unlink(self.oj_samples)
     except OSError: error(_('Unable to remove samples icon.'), self.ccw); return
     info(_('Done.'), self.ccw)
Exemplo n.º 3
0
Arquivo: vga.py Projeto: Mrmohanak/occ
 def enableKMS(self, *args):
     s = self.ccw.mechanism('vga', 'enableKMS')
     if s == 'NotAuth': return
     if s == '0': info(_('KMS is now enabled for all kernels.'), self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
Exemplo n.º 4
0
 def interface_cb(self, b):
     i = self.interface_ls.get_active_text()
     r = self.ccw.mechanism('modem', 'set_sl_interface', i)
     if r == 'NotAuth': return
     if r != '0':
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
Exemplo n.º 5
0
 def rm_repo_cb(self, *b):
     cmd='rm -f "%s"' %self.repo_fn
     s = self.ccw.mechanism('run', 'system', cmd)
     self.ch_rm_repo_b_sens()
     if s == 'NotAuth': return
     if s == '0': info(_("Done!"), self.ccw)
     else: error(_("unexpected return code, possible an error had occurred."), self.ccw)
Exemplo n.º 6
0
Arquivo: vga.py Projeto: albakry/occ
 def checkKMS(self,*args):
     s=self.ccw.mechanism('vga','checkKMS')
     if s == 'NotAuth': return
     if s=='2': info(_('KMS is enabled for all kernels.\nNote: You may need to remake grub config file.'),self.ccw)
     elif s=='1': info(_('KMS is enabled for some kernels, and disabled for others.'),self.ccw)
     elif s=='0': info(_('KMS is disabled for all kernels.\nNote: You may need to remake grub config file.'),self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'),self.ccw)
Exemplo n.º 7
0
Arquivo: dm.py Projeto: Mrmohanak/occ
 def autologin_cb(self, *args):
     u=pwd.getpwuid(os.geteuid())[0]
     s=self.ccw.mechanism('dm','enable_autologin', u)
     if s == 'NotAuth': return
     if s.startswith('-'): error(_('could not set automatic login in %s') % s[1:], self.ccw)
     elif s: info(_('Automatic login as %s was set in %s') % (u,s), self.ccw)
     else: error(_('could not set automatic login'), self.ccw)
Exemplo n.º 8
0
Arquivo: core.py Projeto: albakry/occ
 def __init__(self):
     Gtk.Window.set_default_icon_name('ojuba-control-center')
     Gtk.Window.__init__(self)
     self.connect("delete_event", Gtk.main_quit)
     self.connect("destroy", Gtk.main_quit)
     self.set_size_request(750, 550)
     self.set_title(_('Ojuba Control Center'))
     #self.maximize()
     self.set_resizable(False)
     self.set_position(Gtk.WindowPosition(1))
     
     dbus_loop = DBusGMainLoop(set_as_default=True)
     bus = dbus.SystemBus()
     self.GSettings=None
     if Gio and hasattr(Gio, 'Settings'):
         self.GSettings=Gio.Settings
         self.GSchemas_List=self.GSettings.list_schemas()
     self.GConf=None
     if GConf:
         self.GConf=[GConf.Client.get_default(), GConf.ClientPreloadType.PRELOAD_NONE]
     elif gconf:
         self.GConf=[gconf.client_get_default(), gconf.CLIENT_PRELOAD_NONE]
     self.__init_pk()
     try: self.__mechanism = Backend(bus = bus)
     except dbus.DBusException, e:
         error(_("Error loading DBus:\n\tRun (setenforce 0) as root to stop SELinux, and try again.\nNote: You can disable SELinux by running (sestop) as root."),self)
         print e
         sys.exit(1)
Exemplo n.º 9
0
 def __update_pciid_cb(self, b):
     r = self.ccw.mechanism('run', 'system', 'update-pciids -q')
     if r == 'NotAuth': return
     if r != '0':
         error(_("unexpected return code, possible an error had occurred."),
               self.ccw)
     else:
         info(_('Done.'), self.ccw)
Exemplo n.º 10
0
 def __refresh_cb(self, b):
     e, l = get_blocked_hosts()
     if len(l) < 1:
         error(_("Unable to fetch black list."), self.ccw)
         return
     r = self.ccw.mechanism('hosts', 'set_blocked_list', *l)
     if r == 'NotAuth': return
     info(_('Done. You may need to restart your browser.'), self.ccw)
Exemplo n.º 11
0
 def rm_samples(self, b):
     if not os.path.exists(self.oj_samples):
         info(_('Samples icon already removed.'), self.ccw)
         return
     try:
         os.unlink(self.oj_samples)
     except OSError:
         error(_('Unable to remove samples icon.'), self.ccw)
         return
     info(_('Done.'), self.ccw)
Exemplo n.º 12
0
Arquivo: modem.py Projeto: albakry/occ
 def sl_service_cb(self, b):
     if self.__sl_service_internal: return
     cmd="chkconfig --level 2345 slmodem %s" % ('off','on')[self.sl_service.get_active()]
     r=self.ccw.mechanism('run','system', cmd)
     if r == 'NotAuth': return
     self.__sl_service_internal=True
     self.sl_service.set_active(chkconfig(5,'slmodem'))
     self.__sl_service_internal=False
     if r!='0':
         error(_('unexpected return code, possible an error had occurred.'), self.ccw)
Exemplo n.º 13
0
    def execute(self, *args):
        f = "/usr/bin/livecd-iso-to-disk"
        if not os.path.exists(f): f = "/mnt/live/LiveOS/livecd-iso-to-disk"
        if not os.path.exists(f):
            error(_("The package 'livecd-tools' is not installed."), self.ccw)
            if sure(_("Would you like to install 'livecd-tools'?"), self.ccw):
                self.ccw.install_packages(['livecd-tools'])
                info(_("Please try again."), self.ccw)
            return
        ov = self.overlay_size.get_value()
        opt = "--noverify"
        dst, s, l = self.dst_parse(self.target_dev_ls.get_active_text())
        if not dst:
            error(_('Please choose valid target device.'), self.ccw)
            return

        if self.format.get_active():
            opt += " --format"
            if not sure(
                    _("Are you sure you want to format target device (labeled %s)?"
                      ) % l, self.ccw):
                return
        if self.reset_mbr.get_active(): opt += " --reset-mbr"
        if ov > 0: opt += " --overlay-size-mb %i" % ov

        if self.src_iso_file.get_active():
            src = self.iso_file_b.get_filename()
            if not src or not os.path.exists(src) or not src.lower().endswith(
                    '.iso'):
                error(_('Please choose a valid iso file'), self.ccw)
                return
        else:
            src = self.iso_dev_ls.get_active_text()
            if not src:
                error(_('Please choose a source device.'), self.ccw)
                return
        os.system("umount '%s'" % dst)
        cmd = '''%s %s "%s" "%s"''' % (f, opt, src, dst)
        print cmd
        dlg = wait(self.ccw)
        p = self.__dev_re.findall(dst)[0]
        dst0 = self.__dev_re.sub('', dst)
        self.ccw.mechanism('run', 'system',
                           '''echo ",,,*" | sfdisk %s -N%s''' % (dst0, p))
        while (Gtk.main_iteration_do()):
            pass
        r = self.ccw.mechanism('run', 'system', cmd, on_fail='0')
        if r != '0' and r != 'NotAuth':
            error(
                _("An error occurred while creating the live system.\nYou may run the following command in terminal to see the error:\n%s"
                  ) % cmd, self.ccw)
        while (Gtk.main_iteration_do()):
            pass
        dlg.hide()
        if dlg: dlg.destroy()
Exemplo n.º 14
0
 def sl_service_cb(self, b):
     if self.__sl_service_internal: return
     cmd = "chkconfig --level 2345 slmodem %s" % (
         'off', 'on')[self.sl_service.get_active()]
     r = self.ccw.mechanism('run', 'system', cmd)
     if r == 'NotAuth': return
     self.__sl_service_internal = True
     self.sl_service.set_active(chkconfig(5, 'slmodem'))
     self.__sl_service_internal = False
     if r != '0':
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
Exemplo n.º 15
0
 def convert_cb(self, b):
     if not os.path.exists('/usr/bin/fontforge'):
         error("FontForge is not installed, please install it.", self.ccw); return
     for l in self.files:
         f=l[0]
         l[4]=_("Converting ...")
         Gtk.main_iteration()
         while(Gtk.events_pending()): Gtk.main_iteration()
         r=self.convert(f)
         l[2]=100
         if r==0: l[4]=_("Done")
         else: l[4]=_("Skipped")
Exemplo n.º 16
0
Arquivo: dm.py Projeto: Mrmohanak/occ
 def set_dm(self,*args):
     s=''
     if os.path.exists("/etc/sysconfig/desktop"):
         s=self.ccw.mechanism('run','system', 'rm -f /etc/sysconfig/desktop')
     if s == 'NotAuth': return
     i=self.dm_ls[self.dm.get_active()]
     s=self.set_sysconf_disktop(i)
     if s == 'NotAuth': return
     if i != 'lxdm':
         s=self.ccw.mechanism('run','system', 'system-switch-displaymanager "%s"' % i)
     if s == 'NotAuth': return
     if s=='0': info(_('Display manager is now set to %s') % i, self.ccw)
     else: error(_('Unable to set display managed.'), self.ccw)
Exemplo n.º 17
0
    def __enable_or_disable(self,b,s,data):
        if not b.get_state():
            check=self.ccw.mechanism('run','system',"systemctl enable %s"%data)
	    if check!='0':
		error(_("unexpected return code, possible an error had occurred"), self.ccw)
		b.set_state(False)
		b.set_active(False)
		return True

            if not self.__is_enabled_disable(data):
                error(_("unexpected return code, possible an error had occurred"), self.ccw)
                b.set_state(False)
                b.set_active(False)
                return True

	    if data=="tlp.service":
	    	self.ccw.mechanism('run','system',"systemctl mask  systemd-rfkill.service")
                

        else:
            check=self.ccw.mechanism('run','system',"systemctl disable %s"%data)
	    if check!='0':
		error(_("unexpected return code, possible an error had occurred"), self.ccw)
		b.set_state(True)
		b.set_active(True)
		return True
            if self.__is_enabled_disable(data):
                error(_("unexpected return code, possible an error had occurred"), self.ccw)
                b.set_state(True)
                b.set_active(True)
                return True

	    if data=="tlp.service":
	    	self.ccw.mechanism('run','system',"systemctl unmask  systemd-rfkill.service")
Exemplo n.º 18
0
    def __start_or_stop(self,b,s,data):
        if not b.get_state():
            check=self.ccw.mechanism('run','system',"systemctl start %s"%data)
	    if check!='0':
		error(_("unexpected return code, possible an error had occurred"), self.ccw)
		b.set_state(False)
		b.set_active(False)
		return True

            if not  self.__is_active_dead(data):
                error(_("unexpected return code, possible an error had occurred"), self.ccw)
                b.set_state(False)
                b.set_active(False)
                return True
                
            
        else:
            check=self.ccw.mechanism('run','system',"systemctl stop %s"%data)
	    if check!='0':
		error(_("unexpected return code, possible an error had occurred"), self.ccw)
		b.set_state(True)
		b.set_active(True)
		return True
            if  self.__is_active_dead(data):
                error(_("unexpected return code, possible an error had occurred"), self.ccw)
                b.set_state(True)
                b.set_active(True)
                return True
Exemplo n.º 19
0
 def delete(self, b):
     if not sure(
             _('Do you like to remove xorg.conf file to use default settings?'
               ), self.ccw):
         return
     s = self.ccw.mechanism('run', 'system', 'rm /etc/X11/xorg.conf')
     if s == 'NotAuth': return
     if s == '0':
         info(_('Done. Changes will take effect when you login next time.'),
              self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
         return
Exemplo n.º 20
0
 def convert_cb(self, b):
     if not os.path.exists('/usr/bin/fontforge'):
         error("FontForge is not installed, please install it.", self.ccw)
         return
     for l in self.files:
         f = l[0]
         l[4] = _("Converting ...")
         Gtk.main_iteration()
         while (Gtk.events_pending()):
             Gtk.main_iteration()
         r = self.convert(f)
         l[2] = 100
         if r == 0: l[4] = _("Done")
         else: l[4] = _("Skipped")
Exemplo n.º 21
0
 def apply_cb(self, w):
     if not sure(_('Are you sure you want to apply changes?'), self.ccw): return
     dlg=wait(self.ccw)
     self.convert_img(self.bg_fn, self.bg_nm)
     self.conf[0]['GRUB_TIMEOUT'] = int(self.Time_Out.get_value())
     self.conf[0]['GRUB_DISTRIBUTOR'] = self.conf[0]['GRUB_DISTRIBUTOR']
     self.conf[0]['GRUB_DISABLE_RECOVERY'] = str(not self.recovery_c.get_active()).lower()
     self.conf[0]['GRUB_DEFAULT'] = self.conf[0]['GRUB_DEFAULT']
     self.conf[0]['GRUB_CMDLINE_LINUX'] = '"' + self.Kernel_Opt.get_text() + '"'
     self.conf[0]['GRUB_GFXMODE'] = self.gfxmode
     self.conf[0]['GRUB_GFXPAYLOAD_LINUX'] = "keep"
     self.conf[0]['GRUB_BACKGROUND'] = '/boot/grub2/oj.grub2.png'
     self.conf[1]['BACKGROUND'] = self.bg_fn
     self.conf[1]['FONT_FILE'] = self.font_fn
     self.conf[1]['FONT_NAME'] = self.font_nm
     font=self.font_fn
     if not self.theme_c.get_active(): font=''
     cfg = '\n'.join(map(lambda k: "%s=%s" % (k,str(self.conf[0][k])), self.conf[0].keys()))
     cfg +='\n'
     usr_cfg = '\n'.join(map(lambda k: "%s=%s" % (k,str(self.conf[1][k])), self.conf[1].keys()))
     try: open(self.user_conf, 'w+').write(usr_cfg)
     except IOError: pass
     #print usr_cfg, '\n\n',cfg,font, self.bg_fn,self.bg_nm
     r = self.ccw.mechanism('grub2', 'apply_cfg', self.conf_fn, cfg, font, self.bg_nm)
     dlg.destroy()
     if r == 'NotAuth': return 
     if r.startswith("Error"): return error('%s: %s' %(_('Error!'),r),self.ccw)
     info(_('Done!'),self.ccw)
Exemplo n.º 22
0
 def apply_cb(self, *b):
     if not os.path.isdir(self.tdir):
         return error(_("Select repository directory frist!"), self.ccw)
     dlg=wait(self.ccw)
     dlg.show_all()
     ret=False
     if self.gen_info_c.get_active():
         s=self.create_repo_cb(self.tdir)
         if s: dlg.hide(); return error(s, self.ccw)
         ret=True
     if self.write_config_c.get_active():
         if self.write_repo_cb(self.tdir) == '0': ret=True
         else: self.write_config_c.set_active(False)
     dlg.hide()
     if ret:info(_("Done!"), self.ccw)
     self.ch_rm_repo_b_sens()
Exemplo n.º 23
0
 def mkinitrd(self, b):
     if not sure(
             _('Some proprietary require rebuild initrd.\nWould you like to do that?'
               ), self.ccw):
         return
     s = self.ccw.mechanism(
         'run', 'system',
         'mkinitrd -f --allow-missing /boot/initrd-`uname -r`.img `uname -r`'
     )
     if s == 'NotAuth': return
     if s == '0':
         info(_('Done. Changes will take effect when you reboot.'),
              self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
         return
Exemplo n.º 24
0
 def __enable_or_disable(self,b,s,data):
     if not b.get_state():
         check=self.ccw.mechanism('run','system',"systemctl enable %s"%data)
         if check!='0':
             error(_("unexpected return code, possible an error had occurred"), self.ccw)
             b.set_state(False)
             b.set_active(False)
             return True
             
         
     else:
         check=self.ccw.mechanism('run','system',"systemctl disable %s"%data)
         if check!='0':
             error(_("unexpected return code, possible an error had occurred"), self.ccw)
             b.set_state(True)
             b.set_active(True)
             return True
Exemplo n.º 25
0
Arquivo: vga.py Projeto: Mrmohanak/occ
 def checkKMS(self, *args):
     s = self.ccw.mechanism('vga', 'checkKMS')
     if s == 'NotAuth': return
     if s == '2':
         info(
             _('KMS is enabled for all kernels.\nNote: You may need to remake grub config file.'
               ), self.ccw)
     elif s == '1':
         info(
             _('KMS is enabled for some kernels, and disabled for others.'),
             self.ccw)
     elif s == '0':
         info(
             _('KMS is disabled for all kernels.\nNote: You may need to remake grub config file.'
               ), self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
Exemplo n.º 26
0
    def execute(self, *args):
        f="/usr/bin/livecd-iso-to-disk"
        if not os.path.exists(f): f="/mnt/live/LiveOS/livecd-iso-to-disk"
        if not os.path.exists(f):
            error(_("The package 'livecd-tools' is not installed."), self.ccw)
            if sure(_("Would you like to install 'livecd-tools'?"), self.ccw):
                self.ccw.install_packages(['livecd-tools'])
                info(_("Please try again."), self.ccw)
            return
        ov=self.overlay_size.get_value()
        opt="--noverify"
        dst,s,l=self.dst_parse(self.target_dev_ls.get_active_text())
        if not dst: error(_('Please choose valid target device.'), self.ccw); return

        if self.format.get_active():
            opt+=" --format"
            if not sure(_("Are you sure you want to format target device (labeled %s)?") % l, self.ccw): return
        if self.reset_mbr.get_active(): opt+=" --reset-mbr"
        if ov>0: opt+=" --overlay-size-mb %i" % ov
        
        if self.src_iso_file.get_active():
            src=self.iso_file_b.get_filename()
            if not src or not os.path.exists(src) or not src.lower().endswith('.iso'):
                error(_('Please choose a valid iso file'), self.ccw); return
        else:
            src=self.iso_dev_ls.get_active_text()
            if not src:
                error(_('Please choose a source device.'), self.ccw); return
        os.system("umount '%s'" % dst)
        cmd='''%s %s "%s" "%s"''' % (f, opt,src,dst)
        print cmd
        dlg=wait(self.ccw)
        p=self.__dev_re.findall(dst)[0]
        dst0=self.__dev_re.sub('',dst)
        self.ccw.mechanism('run','system','''echo ",,,*" | sfdisk %s -N%s''' % (dst0, p))
        while(Gtk.main_iteration_do()): pass
        r=self.ccw.mechanism('run','system',cmd, on_fail='0')
        if r!='0' and r!='NotAuth': error(_("An error occurred while creating the live system.\nYou may run the following command in terminal to see the error:\n%s") % cmd, self.ccw)
        while(Gtk.main_iteration_do()): pass
        dlg.hide()
        if dlg: dlg.destroy()
Exemplo n.º 27
0
 def fc_match_cb(self, b, l):
     font=b.get_font_name().split()[:-1]
     font = ' '.join(font)
     fn = cmd_out("fc-match -f '%%{file}\n' '%s'" % font)[0]
     if os.path.splitext(fn)[1][1:] != 'ttf':
         b.set_font_name(self.font_nm + ' 12') 
         return error('%s (%s)' %(_('Error: Can not use this font!'),font),self.ccw)
     #print font, fn
     if os.path.isfile(fn):
         self.font_nm=font
         self.font_fn=fn
         l.set_text("%s: %s" %(_("Font name"),self.font_fn))
Exemplo n.º 28
0
 def save(self, b):
     v = {}
     modes = map(lambda m: m.get_child().get_text(),
                 filter(lambda r: r.get_active(), self.res))
     v['modes'] = self.modestr(modes)
     v['driver'] = self.driver.get_text().strip()
     v['compiz'] = ('Disable', 'Enable')[self.compiz.get_active()]
     v['aiglx'] = ('off', 'on')[self.aiglx.get_active()]
     if ' ' in v['driver'] or '\t' in v['driver']:
         error(_('driver should be one word'))
         return
     if v['driver'].lower() != v['driver']:
         error(_('driver should be lower case'), self.ccw)
         return
     if not sure(
             _('Are you sure you want to overwrite your currently working xorg.conf file and generate a new one ?'
               ), self.ccw):
         return
     xorgconf = self.xorgconf_t % v
     s = self.ccw.mechanism('vga', 'saveXorgConf', xorgconf)
     if s == 'NotAuth': return
     if s == '0':
         info(_('Done. Changes will take effect when you login next time.'),
              self.ccw)
     else:
         error(_('unexpected return code, possible an error had occurred.'),
               self.ccw)
         return
     self.mkinitrd(b)
Exemplo n.º 29
0
    def __enable_or_disable(self, b, s, data):
        if not b.get_state():
            check = self.ccw.mechanism('run', 'system',
                                       "systemctl enable %s" % data)
            if check != '0':
                error(
                    _("unexpected return code, possible an error had occurred"
                      ), self.ccw)
                b.set_state(False)
                b.set_active(False)
                return True

        else:
            check = self.ccw.mechanism('run', 'system',
                                       "systemctl disable %s" % data)
            if check != '0':
                error(
                    _("unexpected return code, possible an error had occurred"
                      ), self.ccw)
                b.set_state(True)
                b.set_active(True)
                return True
Exemplo n.º 30
0
 def apply_now(self,*args):
     k=self.k_ls.get_active_text()
     i=self.m_ls.get_active()
     if not k or i<0: error(_("no method selected.")); return
     if not self.usbsw_info.has_key(k): error(_("Could not find suitable method.")); return
     r=self.ccw.mechanism('usbsw','sw_now',self.usbsw_info[k][m][1])
     if r!='0': error(_("unexpected return code [%s]." % r))
     else: info(_("Applied successfully"))
Exemplo n.º 31
0
 def always_apply(self,*args):
     k=self.k_ls.get_active_text()
     i=self.m_ls.get_active()
     if not k or i<0: error(_("no method selected.")); return
     if not sure(_('Are you sure you want to apply this method automatically. You may want to try the "apply now" button first.')): return
     if not self.usbsw_info.has_key(k): error(_("Could not find suitable method.")); return
     r=self.ccw.mechanism('usbsw','add_rule',self.usbsw_info[k][m][1])
     if r!='0': error(_("unexpected return code [%s]." % r))
     else: info(_("Applied successfully"))
Exemplo n.º 32
0
    def __init__(self):
        Gtk.Window.set_default_icon_name('ojuba-control-center')
        Gtk.Window.__init__(self)
        self.connect("delete_event", Gtk.main_quit)
        self.connect("destroy", Gtk.main_quit)
        self.set_size_request(750, 550)
        self.set_title(_('Ojuba Control Center'))
        #self.maximize()
        self.set_resizable(False)
        self.set_position(Gtk.WindowPosition(1))

        dbus_loop = DBusGMainLoop(set_as_default=True)
        bus = dbus.SystemBus()
        self.GSettings = None
        if Gio and hasattr(Gio, 'Settings'):
            self.GSettings = Gio.Settings
            self.GSchemas_List = self.GSettings.list_schemas()
        self.GConf = None
        if GConf:
            self.GConf = [
                GConf.Client.get_default(),
                GConf.ClientPreloadType.PRELOAD_NONE
            ]
        elif gconf:
            self.GConf = [
                gconf.client_get_default(), gconf.CLIENT_PRELOAD_NONE
            ]
        self.__init_pk()
        try:
            self.__mechanism = Backend(bus=bus)
        except dbus.DBusException, e:
            error(
                _("Error loading DBus:\n\tRun (setenforce 0) as root to stop SELinux, and try again.\nNote: You can disable SELinux by running (sestop) as root."
                  ), self)
            print e
            sys.exit(1)
Exemplo n.º 33
0
 def inst_opera(self, b):
     dlg=wait(self.ccw)
     dlg.show()
     opera_url=self.get_latest_opera_url()
     if not opera_url:
         dlg.hide()
         return error(_("Can not get latest opera url, make sure that you are online!"), self.ccw)
     print opera_url
     if which_exe('opera'):
         dlg.hide()
         return info(_('already installed'), self.ccw)
     r=self.ccw.mechanism('run','system','rpm -Uvh "%s"' % opera_url, on_fail='-1')
     dlg.hide()
     if r == 'NotAuth': return
     if dlg: dlg.destroy()
     info(_("You can wait about 5-15 minutes while downloading opera browser."), self.ccw)
Exemplo n.º 34
0
 def save(self, b):
     v={}
     modes=map(lambda m: m.get_child().get_text(), filter(lambda r: r.get_active() ,self.res))
     v['modes']=self.modestr(modes)
     v['driver']=self.driver.get_text().strip()
     v['compiz']=('Disable','Enable')[self.compiz.get_active()]
     v['aiglx']=('off','on')[self.aiglx.get_active()]
     if ' ' in v['driver'] or '\t' in v['driver']: error(_('driver should be one word')); return
     if v['driver'].lower()!=v['driver']: error(_('driver should be lower case'), self.ccw); return
     if not sure(_('Are you sure you want to overwrite your currently working xorg.conf file and generate a new one ?'), self.ccw): return
     xorgconf=self.xorgconf_t % v
     s=self.ccw.mechanism('vga', 'saveXorgConf', xorgconf)
     if s == 'NotAuth': return
     if s=='0': info(_('Done. Changes will take effect when you login next time.'), self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'), self.ccw); return
     self.mkinitrd(b)
Exemplo n.º 35
0
 def inst_opera(self, b):
     dlg = wait(self.ccw)
     dlg.show()
     opera_url = self.get_latest_opera_url()
     if not opera_url:
         dlg.hide()
         return error(
             _("Can not get latest opera url, make sure that you are online!"
               ), self.ccw)
     print opera_url
     if which_exe('opera'):
         dlg.hide()
         return info(_('already installed'), self.ccw)
     r = self.ccw.mechanism('run',
                            'system',
                            'rpm -Uvh "%s"' % opera_url,
                            on_fail='-1')
     dlg.hide()
     if r == 'NotAuth': return
     if dlg: dlg.destroy()
     info(
         _("You can wait about 5-15 minutes while downloading opera browser."
           ), self.ccw)
Exemplo n.º 36
0
Arquivo: modem.py Projeto: albakry/occ
 def interface_cb(self, b):
     i=self.interface_ls.get_active_text()
     r=self.ccw.mechanism('modem','set_sl_interface', i)
     if r == 'NotAuth': return
     if r!='0': error(_('unexpected return code, possible an error had occurred.'), self.ccw)
Exemplo n.º 37
0
Arquivo: dm.py Projeto: Mrmohanak/occ
 def no_autologin_cb(self, *args):
     s=self.ccw.mechanism('dm','disable_autologin')
     if s == 'NotAuth': return
     if not s: error(_('could not disable automatic login'), self.ccw)
     elif s.startswith('-'): error(_('could not disable automatic login in %s') % s[1:], self.ccw)
     else: info(_('automatic login is now disabled'), self.ccw)
Exemplo n.º 38
0
 def remove_applied(self,*args):
     if not sure(_('Are you sure you want to remove all permanently applied methods.')): return
     r=self.ccw.mechanism('usbsw','remove_all_rules')
     if r!='0': error(_("unexpected return code [%s]." % r))
     else: info(_("Applied successfully"))
Exemplo n.º 39
0
Arquivo: vga.py Projeto: albakry/occ
 def call_vga_mechanism(self,b,m):
     s=self.ccw.mechanism('vga',m)
     if s == 'NotAuth': return
     if s=='0': info(_('Done.'),self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'),self.ccw)
Exemplo n.º 40
0
 def __refresh_cb(self, b):
     e,l=get_blocked_hosts()
     if len(l)<1: error(_("Unable to fetch black list."), self.ccw); return
     r=self.ccw.mechanism('hosts','set_blocked_list', *l)
     if r == 'NotAuth': return
     info(_('Done. You may need to restart your browser.'), self.ccw);
Exemplo n.º 41
0
Arquivo: vga.py Projeto: albakry/occ
 def enableKMS(self,*args):
     s=self.ccw.mechanism('vga','enableKMS')
     if s == 'NotAuth': return
     if s=='0': info(_('KMS is now enabled for all kernels.'),self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'),self.ccw)
Exemplo n.º 42
0
 def __update_pciid_cb(self, b):
     r=self.ccw.mechanism('run','system','update-pciids -q')
     if r == 'NotAuth': return
     if r!='0': error(_("unexpected return code, possible an error had occurred."), self.ccw)
     else: info(_('Done.'), self.ccw)
Exemplo n.º 43
0
 def __one_kernel(self, *args):
     r=self.ccw.mechanism('run','system','package-cleanup -y --oldkernels --count=1')
     if r == 'NotAuth': return
     if r=='0': info(_("Done."), self.ccw)
     else: error(_("unexpected return code, possible an error had occurred."), self.ccw)
Exemplo n.º 44
0
 def mkinitrd(self, b):
     if not sure(_('Some proprietary require rebuild initrd.\nWould you like to do that?'), self.ccw): return
     s=self.ccw.mechanism('run', 'system','mkinitrd -f --allow-missing /boot/initrd-`uname -r`.img `uname -r`')
     if s == 'NotAuth': return
     if s=='0': info(_('Done. Changes will take effect when you reboot.'), self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'), self.ccw); return
Exemplo n.º 45
0
 def delete(self, b):
     if not sure(_('Do you like to remove xorg.conf file to use default settings?'), self.ccw): return
     s=self.ccw.mechanism('run', 'system', 'rm /etc/X11/xorg.conf')
     if s == 'NotAuth': return
     if s=='0': info(_('Done. Changes will take effect when you login next time.'), self.ccw)
     else: error(_('unexpected return code, possible an error had occurred.'), self.ccw); return