示例#1
0
    def gtk_preview(self, item):
        #self.gclient.set_string("/desktop/gnome/interface/gtk_theme", '')
        gtkThemes_index_rc = item.rcfile
        ## conteneur des informations du theme
        gtkThemes_index_metacity = item.metacity
        gtkThemes_index_gtk = item.name
        gtkThemes_dirname = item.path
        gtkThemes_comment = item.comment

        files = []
        files.append(item.rcfile)
        gtk.rc_set_default_files(files)
        settings = gtk.settings_get_default()
        gtk.rc_reparse_all_for_settings(settings, 1)

        self.gtkpreview_infos.set_text(
            "Theme : %(name)s \n\
Metacity : %(metacity)s \n\
Icones : %(gtk)s \n\
Comment : %(comment)s" % {
                'name': gtkThemes_index_gtk,
                'metacity': gtkThemes_index_metacity,
                'gtk': gtkThemes_index_gtk,
                'comment': gtkThemes_comment
            })
示例#2
0
文件: main.py 项目: smolleyes/Gstyle
        def toggleb_menu_func_pressed(self,widget):
            gtk_check = self.toggleb_menu_gtkThemes.get_active()
            gdm_check = self.toggleb_menu_gdm.get_active()
            appgtk = self.gtk_obj.gtkThemes_preview
            if gtk_check :
                sysgtk = self.gtk_obj.gtkThemes_save
                if appgtk and sysgtk != appgtk and sysgtk != "Default" :
                    item = self.gtk_obj.gtk_dict[sysgtk]
                    path = item.path
                    rc = os.path.join(path,'gtk-2.0/gtkrc')
                    if not(os.path.exists(rc)):
                        return
                    gtk.rc_set_default_files(rc)
                    settings = self.window.get_settings()
                    gtk.rc_reparse_all_for_settings(settings, 1)
                    self.gtk_obj.gtkThemes_preview = ""
            ## if gdm btn clicked for first time and authentication not applied yet
            ## start the admin dialog
            if widget.name == "menu_gdm_btn" and not gdm_check and not self.gdm_check:
                run_as_root('Gstyle')
                self.xsplash_obj.autosetup_gdm()
                self.xsplash_obj.check_gdm_options()
                self.gdm_check=True

            self.inactive_widgets(widget)
            self.main_notebook.set_current_page(num_page)
示例#3
0
文件: main.py 项目: smolleyes/Gstyle
        def toggleb_menu_func_pressed(self, widget):
            gtk_check = self.toggleb_menu_gtkThemes.get_active()
            gdm_check = self.toggleb_menu_gdm.get_active()
            appgtk = self.gtk_obj.gtkThemes_preview
            if gtk_check:
                sysgtk = self.gtk_obj.gtkThemes_save
                if appgtk and sysgtk != appgtk and sysgtk != "Default":
                    item = self.gtk_obj.gtk_dict[sysgtk]
                    path = item.path
                    rc = os.path.join(path, 'gtk-2.0/gtkrc')
                    if not (os.path.exists(rc)):
                        return
                    gtk.rc_set_default_files(rc)
                    settings = self.window.get_settings()
                    gtk.rc_reparse_all_for_settings(settings, 1)
                    self.gtk_obj.gtkThemes_preview = ""
            ## if gdm btn clicked for first time and authentication not applied yet
            ## start the admin dialog
            if widget.name == "menu_gdm_btn" and not gdm_check and not self.gdm_check:
                run_as_root('Gstyle')
                self.xsplash_obj.autosetup_gdm()
                self.xsplash_obj.check_gdm_options()
                self.gdm_check = True

            self.inactive_widgets(widget)
            self.main_notebook.set_current_page(num_page)
示例#4
0
文件: mascot.py 项目: frigaut/mascot
 def on_skin2_activate(self, *args):
    rc_defs = list(gtk.rc_get_default_files())
    # rc_xtra = os.path.join(mysttop,'resources/mcao-eng.gtkrc')
    rc_xtra = '/export/home/mcao/mcao-mascot/resources/mcao-eng.gtkrc'
    if rc_xtra not in rc_defs: rc_defs.append(rc_xtra)
    gtk.rc_set_default_files(rc_defs)
    settings = gtk.settings_get_default()
    gtk.rc_reparse_all_for_settings(settings, force_load=True)
示例#5
0
 def action_apply(self,widget=None,name=None):
     if not name:
         name = self.gtkThemes_selector.get_active_text()
     self.gtk_dict.set_active_item(name)
     item = self.gtk_dict.get(name)
     if item:
         self.gtkThemes_save = item.dirname
         #Preview
         files = [item.rcfile]
         gtk.rc_set_default_files(files)
         settings = self.window.get_settings()
         gtk.rc_reparse_all_for_settings(settings, 1)
示例#6
0
 def action_apply(self, widget=None, name=None):
     if not name:
         name = self.gtkThemes_selector.get_active_text()
     self.gtk_dict.set_active_item(name)
     item = self.gtk_dict.get(name)
     if item:
         self.gtkThemes_save = item.dirname
         #Preview
         files = [item.rcfile]
         gtk.rc_set_default_files(files)
         settings = self.window.get_settings()
         gtk.rc_reparse_all_for_settings(settings, 1)
示例#7
0
def use_theme(style_str):
	"""
	Use the GTK+ style in @style_str,
	or unset if it is None
	"""
	filename = cache_filename()
	if style_str is None:
		filename = cache_filename()
		gtk.rc_set_default_files([f for f in gtk.rc_get_default_files()
		                          if f != filename])
	else:
		with open(filename, "wb") as rcfile:
			rcfile.write(style_str)
		gtk.rc_add_default_file(filename)
	re_read_theme()
示例#8
0
def use_theme(style_str):
    """
	Use the GTK+ style in @style_str,
	or unset if it is None
	"""
    filename = cache_filename()
    if style_str is None:
        filename = cache_filename()
        gtk.rc_set_default_files(
            [f for f in gtk.rc_get_default_files() if f != filename])
    else:
        with open(filename, "wb") as rcfile:
            rcfile.write(style_str)
        gtk.rc_add_default_file(filename)
    re_read_theme()
示例#9
0
    def gtk_preview(self,item):
        #self.gclient.set_string("/desktop/gnome/interface/gtk_theme", '')
        gtkThemes_index_rc = item.rcfile
        ## conteneur des informations du theme
        gtkThemes_index_metacity = item.metacity
        gtkThemes_index_gtk = item.name
        gtkThemes_dirname = item.path
        gtkThemes_comment = item.comment

        files=[]
        files.append(item.rcfile)
        gtk.rc_set_default_files(files)
        settings = gtk.settings_get_default()
        gtk.rc_reparse_all_for_settings(settings, 1)

        self.gtkpreview_infos.set_text("Theme : %(name)s \n\
Metacity : %(metacity)s \n\
Icones : %(gtk)s \n\
Comment : %(comment)s" % {'name' : gtkThemes_index_gtk,
                       'metacity' : gtkThemes_index_metacity ,
                       'gtk' : gtkThemes_index_gtk,
                       'comment': gtkThemes_comment
                       })
示例#10
0
import sys

import Character
import TreeModelHelpers as TMH
from Professions import LoadProfessions
from utils import resource

import LatexOutput

#Load the gtk theme for windows.
#Should this at some point no longer be the main script,
#  move this to be in the main script.
if (sys.platform=='win32') and hasattr(sys,'_MEIPASS'):
    basedir = sys._MEIPASS
    gtkrc = os.path.join(basedir,'gtkrc')
    gtk.rc_set_default_files([gtkrc])
    gtk.rc_reparse_all_for_settings(gtk.settings_get_default(),True)

def better_set_text(buff,text):
    buffText = buff.get_text(buff.get_start_iter(),buff.get_end_iter())
    if buffText!=text:
        buff.set_text(text)

class MainWindow(object):
    """
    The main window of the Rolemaster GUI.
    Front tab displays the overview.
    Individual tabs for stats, skills.
    """
    def __init__(self):
        builderfile = resource('resources','MainWindow.ui')
示例#11
0

if __name__ == "__main__":
        import gui.main_loop as main_loop
        #from gui.main_gui import Gui, excepthook, halt, init_gettext
        
        sys.excepthook = excepthook #capturar exceptiones unhandled.
        warnings.showwarning = self.redirect_warnings #capturar pygtk warnings.
        init_gettext() #internacionalization
        try:
            #select ms-windows theme (pyinstaller 1.5.1 fix)
            if cons.OS_WIN:
                try:
                    basedir = os.environ['_MEIPASS2']
                    gtkrc = os.path.join(basedir, 'share/themes/MS-Windows/gtk-2.0/gtkrc')
                    gtk.rc_set_default_files([gtkrc])
                    gtk.rc_reparse_all_for_settings(gtk.settings_get_default(), True)
                except KeyError as err:
                    #self.logger.warning(err)
                    pass
            #
            #self.logger.info("New app gui instance")
            gobject.threads_init() #permitir threading en pygtk
            
            gui_istance = Gui()
            main_loop.run()

        except Exception as err:
            #self.logger.exception(err)
            halt() #close gui.
示例#12
0
文件: app.py 项目: kucukkose/py-acqua
	def __init__(self):
		gtk.Window.__init__(self)
		
		self.set_title('Py-Acqua')
		self.set_size_request(467, 332)
		self.set_resizable(False)
		
		self.p_window = {
			"calcoli" : None,
			"test" : None,
			"popolazione" : None,
			"vasca" : None,
			"skin" : None,
			"plugin" : None,
			"lang" : None,
			"update" : None
		}
		
		utils.set_icon (self)
		
		image = gtk.Image()

		# Settiamo lo skin

		file = os.path.join (utils.SKIN_DIR, os.path.join (get ("skin"), "main.png"))
		
		if not os.path.exists (file):
			file = os.path.join (utils.DSKIN_DIR, os.path.join (get ("skin"), "main.png"))
		
		if os.path.exists (file):
			image.set_from_file(file)
		
		# Proviamo ad applicare lo stile gtk se presente
		path = os.path.join (get ("skin"), "gtkrc")
		
		if os.path.exists (os.path.join (utils.SKIN_DIR, path)):
			path = os.path.join (utils.SKIN_DIR, path)
		elif os.path.exists (os.path.join (utils.DSKIN_DIR, path)):
			path = os.path.join (utils.DSKIN_DIR, path)
		else:
			path = None
		
		if path:
			gtk.rc_set_default_files ([path])
			gtk.rc_reparse_all_for_settings (gtk.settings_get_default (), True)
		
		# Menu
		self._create_menu()
		
		vbox = gtk.VBox()
		
		vbox.pack_start(self.ui.get_widget('/Menubar'), False, False, 0)
		vbox.pack_start(image)
		
		self.add (vbox)
		self.realize ()
		self.show_all ()
		
		if os.name == 'nt':
			self.connect ('delete_event', self.exit)
		else:
			self.connect ('destroy', self.exit)
		
		if get ("show_tips"):
			import tips
			tips.TipsDialog()
示例#13
0
        """
        if self.sock.read():
            messages = []
            while self.sock.read():
                messages.append(self.sock.get_packet())
            for m in messages:
                parse_packet(self, m)
            self.sock.buf = ''
        return True

    def start_pings(self):
        pass#self.ping_timeout = gobject.timeout_add(6000, self.ping)
        

###############################################################################
################################################################  Main  #######
###############################################################################

if __name__ == '__main__':
    gtk.rc_set_default_files(['./themes/gnosis/gtkrc',])
    gtk.rc_parse('./themes/gnosis/gtkrc')
    sett = gtk.settings_get_default()
    sett.set_string_property('gtk-theme-name', 'Redmond', 'fun:time')
    c = Client()
    gtk.main()