Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:PowerPC
computertemp
computertemp-better-theming-and-fixes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File computertemp-better-theming-and-fixes.patch of Package computertemp
Index: computertemp/computertemp_applet.py =================================================================== --- computertemp/computertemp_applet.py (révision 9) +++ computertemp/computertemp_applet.py (révision 10) @@ -394,11 +394,11 @@ class computertempApplet(gnomeapplet.App # Callback: panel background changed def change_background(self, panelapplet, backgroundtype, color, pixmap): self.applet.modify_bg(gtk.STATE_NORMAL, color) - self.box.modify_bg(gtk.STATE_NORMAL, color) + self.inside_applet.modify_bg(gtk.STATE_NORMAL, color) if pixmap is not None: s1 = self.applet.get_style() - s2 = self.box.get_style() + s2 = self.inside_applet.get_style() s1.bg_pixmap[gtk.STATE_NORMAL] = pixmap s2.bg_pixmap[gtk.STATE_NORMAL] = pixmap @@ -409,7 +409,7 @@ class computertempApplet(gnomeapplet.App self.inside_applet.remove(self.icon) self.inside_applet.remove(self.temp) - self.box.remove(self.inside_applet) + self.applet.remove(self.inside_applet) if self.orientation == 2 or self.orientation == 3: self.inside_applet = gtk.VBox() @@ -419,20 +419,14 @@ class computertempApplet(gnomeapplet.App self.inside_applet.pack_start(self.icon) self.inside_applet.pack_start(self.temp) self.inside_applet.show_all() - self.box.add(self.inside_applet) + self.applet.add(self.inside_applet) + # Draws applet def create_applet(self): app_window = self.applet - # Creates eventbox - event_box = gtk.EventBox() - event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.POINTER_MOTION_MASK | - gtk.gdk.POINTER_MOTION_HINT_MASK | - gtk.gdk.CONFIGURE ) - # Creates icon for applet self.icon = gtk.Image() self.update_icon() @@ -450,11 +444,9 @@ class computertempApplet(gnomeapplet.App self.tooltip = gtk.Tooltips() self.update_tooltip() - # Adds hbox to eventbox - event_box.add(self.inside_applet) - app_window.add(event_box) + # Adds hbox to applet + app_window.add(self.inside_applet) app_window.show_all() - return event_box def menu_set(self): @@ -557,7 +549,7 @@ class computertempApplet(gnomeapplet.App self.tempmon = tempf.TempFuncs(self) # Lets create the gui - self.box = self.create_applet() + self.create_applet() self.change_orientation(None, None) # Forcing to get panel position self.prefs = prefs.ComputertempPrefs(self) Index: computertemp/computertemp_applet.py =================================================================== --- computertemp/computertemp_applet.py (révision 13) +++ computertemp/computertemp_applet.py (révision 17) @@ -31,9 +31,12 @@ import gnomeapplet import time import sys import os +import os.path as ospath import string import gc +from xdg import BaseDirectory as bdir + # Import libraries try: import computertemp @@ -203,25 +206,36 @@ class computertempApplet(gnomeapplet.App if temp < self.min_temp+(diff*1) and self.tempzone != 1: self.tempzone = 1 - self.icon_path = glob.pixmaps_dir + "/" + prefix + "_25.png" + self.icon_path = self.get_icon_file(prefix + "_25.png") self.set_icon(self.icon_path) elif self.min_temp+(diff*1) <= temp < self.min_temp+(diff*2) and self.tempzone != 2: - self.icon_path = glob.pixmaps_dir + "/" + prefix + "_50.png" + self.icon_path = self.get_icon_file(prefix + "_50.png") self.tempzone = 2 self.set_icon(self.icon_path) elif self.min_temp+(diff*2) <= temp < self.min_temp+(diff*3) and self.tempzone != 3: - self.icon_path = glob.pixmaps_dir + "/" + prefix + "_75.png" + self.icon_path = self.get_icon_file(prefix + "_75.png") self.tempzone = 3 self.set_icon(self.icon_path) elif self.min_temp+(diff*3) <= temp and self.tempzone != 4: - self.icon_path = glob.pixmaps_dir + "/" + prefix + "_100.png" + self.icon_path = self.get_icon_file(prefix + "_100.png") self.tempzone = 4 self.set_icon(self.icon_path) else: - self.icon_path = glob.pixmaps_dir + "/temp_na.png" + self.icon_path = self.get_icon_file(prefix + "_na.png") self.tempzone = 0 self.set_icon(self.icon_path) + def get_icon_file(self, file): + localdir = ospath.join(bdir.xdg_data_home, glob.name) + if ospath.isdir(localdir): + localfile = ospath.join(localdir, file) + if ospath.isfile(localfile): + return ospath.join(localdir, file) + else: + return ospath.join(glob.pixmaps_dir, file) + else: + return ospath.join(glob.pixmaps_dir, file) + # Updates data shown on applet tooltip def update_tooltip(self): @@ -259,9 +273,9 @@ class computertempApplet(gnomeapplet.App text += "\n Icon: %s" % self.icon_path text += "\n Log: %s" % self.parselogfilename(self.log_filename) - self.tooltip.set_tip(self.applet, text) + self.applet.set_tooltip_text(text) else: - self.tooltip.set_tip(self.applet, _('No Thermal Monitor Support!')) + self.applet.set_tooltip_text(_('No Thermal Monitor Support!')) # Update text def update_text(self): @@ -420,12 +434,13 @@ class computertempApplet(gnomeapplet.App self.inside_applet.pack_start(self.temp) self.inside_applet.show_all() self.applet.add(self.inside_applet) - # Draws applet - def create_applet(self): + def create_applet(self, applet): - app_window = self.applet + # Set applet properties + applet.set_applet_flags (gnomeapplet.EXPAND_MINOR) + applet.connect('style-set', self.set_text_style) # Creates icon for applet self.icon = gtk.Image() @@ -433,6 +448,7 @@ class computertempApplet(gnomeapplet.App # Create label for temp self.temp = gtk.Label() + self.temp.set_padding(2, 0) self.update_text() # Creates hbox with icon and temp @@ -441,12 +457,16 @@ class computertempApplet(gnomeapplet.App self.inside_applet.pack_start(self.temp) # Creates tooltip - self.tooltip = gtk.Tooltips() self.update_tooltip() # Adds hbox to applet - app_window.add(self.inside_applet) - app_window.show_all() + applet.add(self.inside_applet) + applet.show_all() + + def set_text_style(self, widget, prev, *params): + settings = gtk.settings_get_default() + style = gtk.rc_get_style_by_paths(settings, "*PanelApplet*", "PanelApp*" , None) + self.temp.set_style(style) def menu_set(self): @@ -549,7 +569,7 @@ class computertempApplet(gnomeapplet.App self.tempmon = tempf.TempFuncs(self) # Lets create the gui - self.create_applet() + self.create_applet(applet) self.change_orientation(None, None) # Forcing to get panel position self.prefs = prefs.ComputertempPrefs(self) Index: computertemp/computertemp_prefs.py =================================================================== --- computertemp/computertemp_prefs.py (révision 13) +++ computertemp/computertemp_prefs.py (révision 17) @@ -509,9 +509,7 @@ class ComputertempPrefs: self.logentry.set_text(self.app.log_filename) self.logentry.set_sensitive(not self.app.autologname and self.app.logging) self.logentry.set_activates_default(True) - - self.logentrytooltip = gtk.Tooltips() - self.logentrytooltip.set_tip(self.logentry, self.app.tips_logname) + self.logentry.set_tooltip_text(self.app.tips_logname) self.lognamelabel = gtk.Label() self.lognamelabel.set_use_markup(True) @@ -529,9 +527,7 @@ class ComputertempPrefs: self.logformat_entry.set_text(self.app.log_info) self.logformat_entry.set_sensitive(self.app.logging) self.logformat_entry.set_activates_default(True) - - self.logformattooltip = gtk.Tooltips() - self.logformattooltip.set_tip(self.logformat_entry, self.app.tips_loginfo) + self.logformat_entry.set_tooltip_text(self.app.tips_loginfo) logformathbox = gtk.HBox() logformathbox.set_spacing(12)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor