Esempio n. 1
0
 def __save_personal_list_cb(self, b):
     buf = self.__p.get_buffer()
     l = buf.get_text(buf.get_start_iter(),
                      buf.get_end_iter()).strip().split()
     l = filter(lambda j: j, map(lambda i: i.strip(), l))
     self.ccw.mechanism('hosts', 'set_personal_list', *l)
     info(_('Done. You may need to restart your browser.'), self.ccw)
Esempio n. 2
0
File: vga.py Progetto: 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)
Esempio n. 3
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)
Esempio n. 4
0
    def __on_button_clicked(self, button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return

        count = 0
        for n in self.__to_order_d:
            if count == 0:
                subprocess.call(r"echo '%s=%s' >/tmp/ojuba_grub_plugin" %
                                (self.config[n][0], self.config[n][1]),
                                shell=True)
                count = 1
            else:
                subprocess.call(r"echo '%s=%s' >>/tmp/ojuba_grub_plugin" %
                                (self.config[n][0], self.config[n][1]),
                                shell=True)
        check = self.ccw.mechanism(
            'run', 'system', "cp /tmp/ojuba_grub_plugin /etc/default/grub")
        if check != '0':
            return info(_("Change Config Fail"))

        check = self.__update_grub()
        if not check:
            return info(
                _("Update Grub Menu Fail Restore Default Config File And Restart occ"
                  ))

        info(_("Done"))
Esempio n. 5
0
File: net.py Progetto: albakry/occ
    def suggest_cb(self, b):
        nic_list=glob('/etc/sysconfig/networking/devices/*')
        nm=0
        for nic in nic_list:
            d=self.nic_parse(nic)
            if not d: continue
            ch=0
            if d.get('ONBOOT','yes')!='yes' and sure(_("The device [%s] named [%s] is not set to be started automatically on each boot.\nDo you like to start it automatically on boot?") % (d['DEVICE'], d.get('NAME','unnamed')), self.ccw):
                self.ccw.mechanism('net','nic_set_onboot', nic)

            if d.get('NM_CONTROLLED','yes')!='yes' and sure(_("The device [%s] named [%s] is not set to be controlled with Network Manager.\nDo you like to allow Network Manager to control this device?") % (d['DEVICE'], d.get('NAME','unnamed')), self.ccw):
                self.ccw.mechanism('net','nic_set_nm', nic)
                ch=1

            if d.get('USERCTL','yes')!='yes' and sure(_("The device [%s] named [%s] is not allowed to be controlled by unprivileged users.\nDo you like to allow them?") % (d['DEVICE'], d.get('NAME','unnamed')), self.ccw):
                self.ccw.mechanism('net','nic_set_userctl', nic)
            # if something is changed reload conf
            if ch: d=self.nic_parse(nic)
            if not d: continue
            if d.get('NM_CONTROLLED','yes')!='yes': nm|=1

        fix_nm_service=chkconfig(5, 'network') or not chkconfig(5, 'NetworkManager')
        if nm and fix_nm_service and sure(_("Network Manager is used by some device, but you are using the legacy network service.\nWould you like to fix that?") % (d['DEVICE'], d.get('NAME','unnamed')), self.ccw):
            self.ccw.mechanism('net','set_nm_service', nic)
        info(_("We got no more suggestions.\nIf you have made any changes it will take effect on next boot"), self.ccw)
Esempio n. 6
0
File: vga.py Progetto: 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)
Esempio n. 7
0
File: fonts.py Progetto: albakry/occ
 def import_fonts(self,*args):
     M=("ar", "co", "ta","ti","tr", "ve")
     f=[]
     m=[]
     d=[]
     if not sure(_("Are you sure you want to search and install fonts ?\nMake sure that the partitions are mounted and you have a license to use the fonts.\n"), self.ccw): return
     for i in open('/proc/mounts','rt'):
         p=self.__ch_re.sub(lambda m: chr(int(m.group(1),8)), i.split()[1].strip())
         if p=='/': continue
         d.extend(glob(os.path.join(p,'*','[Ff][Oo][Nn][Tt][Ss]')))
     for i in d:
         f.extend(glob(os.path.join(i,'*.[Tt][Tt][Ff]')))
     # make f uniq
     k={}
     for i in f: k[os.path.basename(i).lower()]=i
     f=k.values()
     
     m=filter(lambda i: os.path.basename(i).lower()[:2] in M,f)
     a=True
     lf,lm=len(f),len(m)
     if lf-lm>10: a=sure(_("There are %i fonts found, only %i could be important to you. Do you want to install all the fonts?\n") % (lf,lm), self.ccw)
     d=os.path.expanduser('~/.fonts/')
     if not os.path.exists(d): os.mkdir(d)
     os.system('xdg-open "%s"' % d)
     if not a: f=m
     for i in f:
         shutil.copy(i,d)
     info(_("Done. %d font were installed.") % len(f), self.ccw)
Esempio n. 8
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)
Esempio n. 9
0
File: dm.py Progetto: 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)
Esempio n. 10
0
    def __restore_default_file_config(self,button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return
	check=self.ccw.mechanism('run','system',"cp  /etc/default/tlp.backup_by_ojuba_occ /etc/default/tlp")
	if check!='0':
		return
	info (_("Done"))
Esempio n. 11
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)
Esempio n. 12
0
 def hda_verb_now(self, *args):
     if not self.sure(): return
     r = self.ccw.mechanism('snd', 'hda_verb',
                            '/dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2')
     if r == 'NotAuth': return
     #os.system("hda-verb /dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2")
     info(_('Done.'), self.ccw)
Esempio n. 13
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)
Esempio n. 14
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)
Esempio n. 15
0
 def mk_samples(self, b):
     try:
         os.unlink(self.oj_conf)
     except OSError:
         pass
     if os.path.exists('/etc/X11/xinit/xinitrc.d/zz-samples.sh'):
         os.system('bash /etc/X11/xinit/xinitrc.d/zz-samples.sh')
         info(_('Done.'), self.ccw)
Esempio n. 16
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)
Esempio n. 17
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"))
Esempio n. 18
0
File: vga.py Progetto: albakry/occ
 def install_nvidia(self, b):
     kmod=self.kmod_nvidia_ls.get_active_text()
     if os.uname()[2].endswith('PAE'): kmod+='-PAE'
     print kmod
     print self.ccw.is_installed([kmod])
     if self.ccw.is_installed([kmod]):
         info(_('proprietary nVidia drivers [%s] already installed.') % kmod,self.ccw)
     else: self.ccw.install_packages([kmod])
Esempio n. 19
0
 def remove_from_boot(self, *args):
     if not sure(
             _("Are you sure you want to disable an already enabled hda fix ?"
               ), self.ccw):
         return
     r = self.ccw.mechanism('snd', 'remove_hda_verb')
     if r == 'NotAuth': return
     info(_('Done. New settings will take effect on next boot.'), self.ccw)
Esempio n. 20
0
 def tbs_cb(self, b):
     if self.tbs.get_active():
         r = self.ccw.mechanism('snd', 'enable_tsched')
     else:
         r = self.ccw.mechanism('snd', 'disable_tsched')
     if r == 'NotAuth': return
     self.set_checkbox()
     info(_('Done. New settings will take effect on next boot.'), self.ccw)
Esempio n. 21
0
 def __personal_list_cb(self, b):
     if self.__lock: return
     self.__lock = True
     v = str(int(b.get_active()))
     r = self.ccw.mechanism('hosts', 'enable_black_list', v)
     if r == 'NotAuth': return
     b.set_active(os.path.exists(self.__blacklist_f))
     self.__lock = False
     info(_('Done. You may need to restart your browser.'), self.ccw)
Esempio n. 22
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"))
Esempio n. 23
0
 def __personal_list_cb(self, b):
     if self.__lock: return
     self.__lock=True
     v=str(int(b.get_active()))
     r=self.ccw.mechanism('hosts','enable_black_list', v)
     if r == 'NotAuth': return
     b.set_active(os.path.exists(self.__blacklist_f))
     self.__lock=False
     info(_('Done. You may need to restart your browser.'), self.ccw)
Esempio n. 24
0
 def apply_cb(self, w):
     if not sure(_('Are you sure you want to detect and add other operating systems?'), self.ccw): return
     dlg=wait(self.ccw)
     dlg.show_all()
     r=self.ccw.mechanism('grub2','os_prober_cb')
     dlg.hide()
     if r == 'NotAuth': return 
     if r.startswith("Error"): return info('%s: %s'%(_('Error'),r[6:]))
     info(_('Operating systems found:\n%s') % r,self.ccw)
Esempio n. 25
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)
Esempio 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()
Esempio n. 27
0
    def __restore_default_file_config(self,button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return
	check=self.ccw.mechanism('run','system',"cp  /etc/default/grub.backup_by_ojuba_occ /etc/default/grub")
	if check!='0':
		return info (_("Restore Default Config File Fail"))
	check=self.__update_grub()
	if not check:
		return info(_("Update Grub Menu Fail"))

	info (_("Done"))
Esempio n. 28
0
File: vga.py Progetto: Mrmohanak/occ
 def install_nvidia(self, b):
     kmod = self.kmod_nvidia_ls.get_active_text()
     if os.uname()[2].endswith('PAE'): kmod += '-PAE'
     print kmod
     print self.ccw.is_installed([kmod])
     if self.ccw.is_installed([kmod]):
         info(
             _('proprietary nVidia drivers [%s] already installed.') % kmod,
             self.ccw)
     else:
         self.ccw.install_packages([kmod])
Esempio n. 29
0
 def apply_cb(self, w):
     if not sure(
             _('Are you sure you want to detect and add other operating systems?'
               ), self.ccw):
         return
     dlg = wait(self.ccw)
     dlg.show_all()
     r = self.ccw.mechanism('grub2', 'os_prober_cb')
     dlg.hide()
     if r == 'NotAuth': return
     if r.startswith("Error"): return info('%s: %s' % (_('Error'), r[6:]))
     info(_('Operating systems found:\n%s') % r, self.ccw)
Esempio n. 30
0
 def apply_cb(self, w):
     if not sure(
             _('Make sure all disks are mounted. Are you sure you want to detect and add other operating systems?'
               ), self.ccw):
         return
     dlg = wait()
     dlg.show_all()
     r = self.ccw.mechanism('grub', 'set_grub_items')
     dlg.hide()
     if r == 'NotAuth': return
     if not r: return info(_('No operating systems were found'))
     info(_('Operating systems found:\n%s') % r, self.ccw)
Esempio n. 31
0
File: dm.py Progetto: 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)
Esempio n. 32
0
    def __restore_default_file_config(self, button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return
        check = self.ccw.mechanism(
            'run', 'system',
            "cp  /etc/default/grub.backup_by_ojuba_occ /etc/default/grub")
        if check != '0':
            return info(_("Restore Default Config File Fail"))
        check = self.__update_grub()
        if not check:
            return info(_("Update Grub Menu Fail"))

        info(_("Done"))
Esempio n. 33
0
 def __block_cb(self, b):
     if self.__lock: return
     self.__lock=True
     if b.get_active() and not os.path.exists(self.__blocked_ls_f):
         e,l=get_blocked_hosts()
         r=self.ccw.mechanism('hosts','set_blocked_list', *l)
         if r == 'NotAuth': return
     v=str(int(b.get_active()))
     r=self.ccw.mechanism('hosts','enable_blocked', v)
     if r == 'NotAuth': return
     b.set_active(os.path.exists(self.__blocked_f))
     self.__lock=False
     info(_('Done. You may need to restart your browser.'), self.ccw)
Esempio n. 34
0
 def __block_cb(self, b):
     if self.__lock: return
     self.__lock = True
     if b.get_active() and not os.path.exists(self.__blocked_ls_f):
         e, l = get_blocked_hosts()
         r = self.ccw.mechanism('hosts', 'set_blocked_list', *l)
         if r == 'NotAuth': return
     v = str(int(b.get_active()))
     r = self.ccw.mechanism('hosts', 'enable_blocked', v)
     if r == 'NotAuth': return
     b.set_active(os.path.exists(self.__blocked_f))
     self.__lock = False
     info(_('Done. You may need to restart your browser.'), self.ccw)
Esempio n. 35
0
 def cp_rpms_cb(self, b):
     tdir_dlg=sel_dir_dlg(self.ccw)
     if (tdir_dlg.run()==Gtk.ResponseType.ACCEPT):
         tdir = tdir_dlg.get_filename()
         tdir_dlg.hide()
     else:
         tdir_dlg.hide()
         return
     #tdir = '/media/DATA/project/yumarchive/sss'
     dlg=wait(self.ccw)
     dlg.show_all()
     c,r = self.cp(tdir)
     dlg.hide()
     info(_("%d RPM files has been copied\nTo:%s\n%d Repeated RPMS removed!") %(len(c), tdir, len(r)), self.ccw) 
Esempio n. 36
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
Esempio n. 37
0
    def __on_button_clicked(self,button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return
	count=0
	for l in self.config.values():
		if count==0:
			subprocess.call("echo \'%s=%s\' >/tmp/ojuba_tlp_plugin"%(l[0],l[1]),shell=True)
			count=1
		else:
			subprocess.call("echo \'%s=%s\' >>/tmp/ojuba_tlp_plugin"%(l[0],l[1]),shell=True)
	check=self.ccw.mechanism('run','system',"cat /tmp/ojuba_tlp_plugin >/etc/default/tlp")
	if check!='0':
		return
	self.ccw.mechanism('run','system',"tlp start")
	info(_("Done"))
Esempio n. 38
0
 def cp_rpms_cb(self, b):
     tdir_dlg = sel_dir_dlg(self.ccw)
     if (tdir_dlg.run() == Gtk.ResponseType.ACCEPT):
         tdir = tdir_dlg.get_filename()
         tdir_dlg.hide()
     else:
         tdir_dlg.hide()
         return
     #tdir = '/media/DATA/project/yumarchive/sss'
     dlg = wait(self.ccw)
     dlg.show_all()
     c, r = self.cp(tdir)
     dlg.hide()
     info(
         _("%d RPM files has been copied\nTo:%s\n%d Repeated RPMS removed!")
         % (len(c), tdir, len(r)), self.ccw)
Esempio n. 39
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)
Esempio n. 40
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()
Esempio n. 41
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)
Esempio n. 42
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
Esempio n. 43
0
    def __on_button_clicked(self,button):
        if not sure(_("Are you sure you want to continue?"), self.ccw):
            return

	count=0
	for n in self.__to_order_d:
		if count==0:
			subprocess.call(r"echo '%s=%s' >/tmp/ojuba_grub_plugin"%(self.config[n][0],self.config[n][1]),shell=True)
			count=1
		else:
			subprocess.call(r"echo '%s=%s' >>/tmp/ojuba_grub_plugin"%(self.config[n][0],self.config[n][1]),shell=True)
	check=self.ccw.mechanism('run','system',"cp /tmp/ojuba_grub_plugin /etc/default/grub")
	if check!='0':
		return info(_("Change Config Fail"))

	check=self.__update_grub()
	if not check:
		return info(_("Update Grub Menu Fail Restore Default Config File And Restart occ"))

	info(_("Done"))
Esempio n. 44
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()
Esempio n. 45
0
File: vga.py Progetto: 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)
Esempio n. 46
0
 def rm_rpms_cb(self, b):
     cmd = '/bin/rm -f'
     dlg=wait(self.ccw)
     dlg.show_all()
     p = self.get_ls()
     if not p:
         dlg.hide()
         info(_("There are no repeated RPM files!"), self.ccw)
         return
     s = self.get_size(p)[1]
     dlg.hide()
     if not sure(_("Delete %d RPM Files, will save %s!\nAre you sure?"%(len(p), s)), self.ccw): return
     cmd = '%s %s'%(cmd, ' '.join(p))
     dlg.show_all()
     r = self.ccw.mechanism('run', 'system', cmd)
     dlg.hide()
     if r == 'NotAuth': return
     if r: info(_("%d RPM files has been deleted, TO save %s!") %(len(p), s), self.ccw)
     else: info(_("We can't complete this action at this time, due unknown error, you can try again!"), self.ccw)
Esempio n. 47
0
File: snd.py Progetto: albakry/occ
 def hda_verb_at_boot(self,*args):
     if not self.sure(): return
     r=self.ccw.mechanism('snd','add_hda_verb','/dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2')
     if r == 'NotAuth': return
     info(_('Done. New settings will take effect on next boot.'), self.ccw)
Esempio n. 48
0
 def __akmods_cb(self, b):
     p=self.__get_akmods()
     if self.ccw.is_installed(p):
         info(_("all needed akmods are already installed."), self.ccw)
     else:
         self.ccw.install_packages(p)
Esempio n. 49
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
Esempio n. 50
0
File: snd.py Progetto: albakry/occ
 def rt_cb(self,b):
     if self.rt_b.get_active(): r=self.ccw.mechanism('snd','enable_rt')
     else: r=self.ccw.mechanism('snd','reset_rt')
     if r == 'NotAuth': return
     self.set_checkbox()
     info(_('Done. New settings will take effect on next boot.'), self.ccw)
Esempio n. 51
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
Esempio n. 52
0
File: snd.py Progetto: albakry/occ
 def hda_verb_now(self,*args):
     if not self.sure(): return
     r=self.ccw.mechanism('snd','hda_verb','/dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2')
     if r == 'NotAuth': return
     #os.system("hda-verb /dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2")
     info(_('Done.'), self.ccw)
Esempio n. 53
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);
Esempio n. 54
0
 def smb_service_on(self, b):
     r=self.ccw.mechanism('smb','start_on_boot')
     if r == 'NotAuth': return
     info(_('Done.'), self.ccw)
Esempio n. 55
0
File: snd.py Progetto: albakry/occ
 def remove_from_boot(self,*args):
     if not sure(_("Are you sure you want to disable an already enabled hda fix ?"), self.ccw): return
     r=self.ccw.mechanism('snd','remove_hda_verb')
     if r == 'NotAuth': return
     info(_('Done. New settings will take effect on next boot.'), self.ccw)
Esempio n. 56
0
 def ushare_cb(self,b):
     r=self.ccw.mechanism('smb','enable_ushare', str(int(self.ushare.get_active())) )
     if r == 'NotAuth': return
     info(_('Done.'), self.ccw)
Esempio n. 57
0
 def __apply_cb(self, b):
     active = self.resolutions_ls[self.__vga_ls.get_active()]
     n=self.__resolutions.get(active,None)
     if not n: self.ccw.mechanism('vga', 'rm_kernel_vga')
     else: self.ccw.mechanism('vga', 'set_kernel_vga', str(n))
     info(_('Done!'), self.ccw)
Esempio n. 58
0
 def __save_personal_list_cb(self, b):
     buf=self.__p.get_buffer()
     l=buf.get_text(buf.get_start_iter(),buf.get_end_iter()).strip().split()
     l=filter(lambda j: j, map(lambda i: i.strip(), l))
     self.ccw.mechanism('hosts','set_personal_list', *l)
     info(_('Done. You may need to restart your browser.'), self.ccw);