rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
'If the program is already running you should be able to find the resource class name of the program from the dropdown list.')
'If the program is already running you should be able to find the identifier of the program from the dropdown list.')
def class_name_dialog(self, identifier=None): # Input dialog for inputting the res_class_name. dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, None) dialog.set_title('Resource Class') dialog.set_markup('<b>Enter the resource class name he...
hbox.pack_start(gtk.Label('Class Name:'), False, 5, 5)
hbox.pack_start(gtk.Label('Identifier:'), False, 5, 5)
def class_name_dialog(self, identifier=None): # Input dialog for inputting the res_class_name. dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, None) dialog.set_title('Resource Class') dialog.set_markup('<b>Enter the resource class name he...
identifier = self.class_name_dialog(identifier)
identifier = self.identifier_dialog(identifier)
def change_identifier(self, path, identifier=None): identifier = self.class_name_dialog(identifier) if not identifier: return False winlist = [] if identifier in self.groups.get_identifiers(): group = self.groups[identifier] # Get the windows for repopulation of the new button winlist = group.windows.keys() # Destroy t...
global settings
def __init__(self,applet): gobject.GObject.__init__(self) global settings print "Dockbarx init" self.applet = applet # self.dragging is used to tell functions wheter # a drag-and-drop is going on self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches...
self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches = None self.groups = None self.windows = None self.container = None self.theme = None wnck.set_client_type(wnck.CLIENT_TYPE_PAGER) self.screen = wnck.screen_get_default() self.root_xid = int(gtk...
def __init__(self,applet): gobject.GObject.__init__(self) global settings print "Dockbarx init" self.applet = applet # self.dragging is used to tell functions wheter # a drag-and-drop is going on self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches...
gobject.idle_add(self.reload)
self.reload()
def __init__(self,applet): gobject.GObject.__init__(self) global settings print "Dockbarx init" self.applet = applet # self.dragging is used to tell functions wheter # a drag-and-drop is going on self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches...
elif zg.workrounds[self.identifier] == 'all': mimetypes = self.desktop_entry.getMimeTypes()
def menu_get_zg_files(self): # Get information from zeitgeist appname = self.desktop_entry.getFileName().split('/')[-1] recent_files = zg.get_recent_for_app(appname, days=30, number_of_results=8) most_used_files = zg.get_most_used_for_app(appname, days=30, number_of_results=8) # For programs that work badly with zeitge...
mimetypes = self.desktop_entry.getMimeTypes()
try: mimetypes = self.desktop_entry.getMimeTypes() except AttributeError: mimetypes = None
def menu_get_zg_files(self): # Get information from zeitgeist appname = self.desktop_entry.getFileName().split('/')[-1] recent_files = zg.get_recent_for_app(appname, days=30, number_of_results=8) most_used_files = zg.get_most_used_for_app(appname, days=30, number_of_results=8) # For programs that work badly with zeitge...
try: self.add_launcher(identifier, path) except AttributeError: message = "%s %s %s"%( _("The launcher at path"), path, _("cant be found. Did you perhaps delete the file?") ) print message md = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, message) md.r...
self.add_launcher(identifier, path)
def reload(self, event=None, data=None): # Remove all old groupbuttons from container. for child in self.container.get_children(): self.container.remove(child) if self.windows: # Removes windows and unpinned group buttons for win in self.screen.get_windows(): self.on_window_closed(None, win) if self.groups is not None:...
desktop_entry = DesktopEntry(path)
try: desktop_entry = DesktopEntry(path) except ParsingError: print "Couldn't add launcher: %s is not an desktop file!" % \ path return except UnboundLocalError: print "Couldn't add launcher: path %s doesn't exist" % path return
def add_launcher(self, identifier, path): if path[:4] == "gio:": # This launcher is from an older version of dockbarx. # It will be updated to new form automatically. if path[4:] in self.apps_by_id: app = self.apps_by_id[path[4:]] desktop_entry = self.get_desktop_entry_for_id(app.get_id()) else: print "Couldn't find gi...
pinned=False, monitor=1):
pinned=False, monitor=0):
def __init__(self, identifier=None, desktop_entry=None, pinned=False, monitor=1): gobject.GObject.__init__(self)
w,h = self.popup.get_size()
w, h = self.popup.get_size() mgeo = gtk.gdk.screen_get_default().get_monitor_geometry(self.monitor)
def on_popup_size_allocate(self, widget, allocation): # Move popup to it's right spot offset = 3 x,y = self.button.window.get_origin() b_alloc = self.button.get_allocation() w,h = self.popup.get_size() if self.globals.orient == "h": if self.globals.settings['popup_align'] == 'left': x = b_alloc.x + x if self.globals.se...
if x+(w)>self.screen.get_width(): x=self.screen.get_width()-w if x<0: x = 0 if y-h >= 0: self.popup.move(x,y-h)
if x + w > mgeo.x + mgeo.width: x = mgeo.x + mgeo.width - w if x < mgeo.x: x = mgeo.x if y - h >= mgeo.y: self.popup.move(x, y - h)
def on_popup_size_allocate(self, widget, allocation): # Move popup to it's right spot offset = 3 x,y = self.button.window.get_origin() b_alloc = self.button.get_allocation() w,h = self.popup.get_size() if self.globals.orient == "h": if self.globals.settings['popup_align'] == 'left': x = b_alloc.x + x if self.globals.se...
if y+h>self.screen.get_height(): y=self.screen.get_height()-h if x+w >= self.screen.get_width(): self.popup.move(x - w - offset,y)
if y + h > mgeo.y + mgeo.height: y = mgeo.y + mgeo.height - h if x + w >= mgeo.x + mgeo.width: self.popup.move(x - w - offset, y)
def on_popup_size_allocate(self, widget, allocation): # Move popup to it's right spot offset = 3 x,y = self.button.window.get_origin() b_alloc = self.button.get_allocation() w,h = self.popup.get_size() if self.globals.orient == "h": if self.globals.settings['popup_align'] == 'left': x = b_alloc.x + x if self.globals.se...
self.globals.theme_name = self.theme.get_name() self.globals.update_colors(self.theme.get_name(), self.theme.get_default_colors(), self.theme.get_default_alphas())
def load_theme(self): self.themes = self.find_themes() default_theme_path = None for theme, path in self.themes.items(): if theme.lower() == self.globals.settings['theme'].lower(): self.theme = Theme(path) break if theme.lower == self.globals.DEFAULT_SETTINGS['theme'].lower(): default_theme_path = path else: if default...
self.name = self.desktop_entry.getName() elif self.windows:
try: self.name = self.desktop_entry.getName() except: pass if self.name is None and self.windows:
def update_name(self): if self.desktop_entry: self.name = self.desktop_entry.getName() elif self.windows: # Uses first half of the name, # like "Amarok" from "Amarok - [SONGNAME]" # A program that uses a name like "[DOCUMENT] - [APPNAME]" would be # totally screwed up. So far no such program has been reported. self.nam...
else: self.name = None
if self.name is None and self.identifier: self.name = self.identifier if self.name is None:
def update_name(self): if self.desktop_entry: self.name = self.desktop_entry.getName() elif self.windows: # Uses first half of the name, # like "Amarok" from "Amarok - [SONGNAME]" # A program that uses a name like "[DOCUMENT] - [APPNAME]" would be # totally screwed up. So far no such program has been reported. self.nam...
for g in self.dockbar.groups.get_groups(): if gb != g: for win in g.get_windows():
for gr in self.dockbar.groups.get_groups(): if gb != gr: for win in gr.windows.get_list():
def on_minimize_others(self, arg, gb): for g in self.dockbar.groups.get_groups(): if gb != g: for win in g.get_windows(): win.minimize()
if gr.list_hide_timeout is not None:
if gr.hide_list_sid is not None:
def gkey_select_next_group(self, previous=False): active_found = False gl = self.groups # Repeat list twice so we can get # back to the first group after the last gl = gl + gl if previous: gl.reverse() for gr in gl: if gr.list_hide_timeout is not None: # Hide the popup if it's opened # by keyboard shortcut. gr.hide_lis...
if active_found and gr.get_windows_count()>0:
if active_found and gr.windows.get_count() > 0:
def gkey_select_next_group(self, previous=False): active_found = False gl = self.groups # Repeat list twice so we can get # back to the first group after the last gl = gl + gl if previous: gl.reverse() for gr in gl: if gr.list_hide_timeout is not None: # Hide the popup if it's opened # by keyboard shortcut. gr.hide_lis...
self.window.disconnect(self.geometry_changed_event)
if self.geometry_changed_event is not None: self.window.disconnect(self.geometry_changed_event)
def del_button(self): self.window_button.destroy() self.window.disconnect(self.state_changed_event) self.window.disconnect(self.icon_changed_event) self.window.disconnect(self.name_changed_event) self.window.disconnect(self.geometry_changed_event) del self.icon del self.icon_transp del self.screen del self.window del s...
if self.has_active_window: icon_active = IconFactory.ACTIVE else: icon_active = 0
def update_state(self): # Checks button state and set the icon accordingly. if self.has_active_window: icon_active = IconFactory.ACTIVE else: icon_active = 0
if self.needs_attention:
if self.has_active_window and win_nr>0: icon_active = IconFactory.ACTIVE else: icon_active = 0 if self.needs_attention and win_nr>0:
def update_state(self): # Checks button state and set the icon accordingly. if self.has_active_window: icon_active = IconFactory.ACTIVE else: icon_active = 0
if win_nr == 0 and not self.launcher: self.button.hide() return else: self.button.show()
def update_state(self): # Checks button state and set the icon accordingly. if self.has_active_window: icon_active = IconFactory.ACTIVE else: icon_active = 0
if (self.pinned and len(self.windows)==1):
if len(self.windows)==1:
def add_window(self,window): if window in self.windows: return wb = WindowButton(window) self.windows[window] = wb self.winlist.pack_start(wb.window_button, False) if window.is_minimized(): self.minimized_windows_count += 1 if (self.pinned and len(self.windows)==1): if self.name is None: self.update_name() self.icon_fa...
colors['color%s']="
colors['color%s'%i]="
def get_colors(self): # Loads the colors from gconf if not self.theme: colors.clear() for i in range(1,9): colors['color%s']="#000000" return theme_colors = self.theme.get_default_colors() theme_alphas = self.theme.get_default_alphas() theme_name = self.theme.get_name().replace(' ', '_').encode() try: theme_name = them...
frame = gtk.Frame(_("Windowbutton actions"))
frame = gtk.Frame(_("Window item actions"))
def __init__ (self):
gtk.CheckButton(_('Close popup'))
gtk.CheckButton(_('Close window list'))
def __init__ (self):
"color1": 'Popup background',
"color1": 'Window list background',
def __init__ (self):
_('Show popup only if more than one window is open'))
_('Show window list only if more than one window is open'))
def __init__ (self):
spinlabel = gtk.Label(_("Delay for switching between popups"))
spinlabel = gtk.Label(_("Delay for switching between window lists"))
def __init__ (self):
self.select_multiple_cg.append_text(_("show popup"))
self.select_multiple_cg.append_text(_("show window list"))
def __init__ (self):
notebook.append_page(popup_box, gtk.Label(_("Popup Window")))
notebook.append_page(popup_box, gtk.Label(_("Window List")))
def __init__ (self):
notebook.append_page(windowbutton_box, gtk.Label(_("Window Button")))
notebook.append_page(windowbutton_box, gtk.Label(_("Window Item")))
def __init__ (self):
"show popup": _("show popup")
"show popup": _("show window list")
def update(self, arg=None): """Set widgets according to settings."""
_("show popup"): "show popup"
_("show window list"): "show popup"
def cb_changed(self, combobox): # Read the value of the combo box and write to gconf # Groupbutton settings for name, cb in self.gb_combos.items(): if cb == combobox: setting_name = self.gb_labels_and_settings[name] value = combobox.get_active_text() if value is None: return for (action, translation) in self.gb_actions...
self.name = self.windows[0].get_class_group.get_name()
self.name = self.windows.keys()[0].get_class_group.get_name()
def update_name(self): if self.desktop_entry: self.name = self.desktop_entry.getName() elif self.windows: # Uses first half of the name, # like "Amarok" from "Amarok - [SONGNAME]" # A program that uses a name like "[DOCUMENT] - [APPNAME]" would be # totally screwed up. So far no such program has been reported. self.nam...
om = ["!(class=%s"%self.window[0].get_class_group.get_res_class() + \
om = ["!(class=%s" % \ self.windows.keys[0].get_class_group.get_res_class() + \
def opacify(self): # Makes all windows but the one connected to this windowbutton # transparent if self.globals.opacity_values is None: try: self.globals.opacity_values = \ compiz_call('obs/screen0/opacity_values','get') except: try: self.globals.opacity_values = \ compiz_call('core/screen0/opacity_values','get') excep...
'iclass=%s'%self.windows[0].get_class_group.get_res_class())
'iclass=%s'%wins[0].get_class_group.get_res_class())
def action_compiz_scale_windows(self, widget, event): wins = self.get_unminimized_windows() if not wins: return if len(wins) == 1: self.windows[wins[0]].action_select_window(widget, event) return if self.globals.settings['show_only_current_desktop']: path = 'scale/allscreens/initiate_key' else: path = 'scale/allscreens...
'iclass=%s'%self.windows[0].get_class_group.get_res_class())
'iclass=%s'%wins[0].get_class_group.get_res_class())
def action_compiz_shift_windows(self, widget, event): wins = self.get_unminimized_windows() if not wins: return if len(wins) == 1: self.windows[wins[0]].action_select_window(widget, event) return
if not os.path.exists(launcher_dir): os.makedirs(launcher_dir)
def edit_launcher(self, arg, path, identifier): launcher_dir = os.path.join(os.path.expanduser('~'), '.dockbarx', 'launchers') if path: if not os.path.exists(path): print "Error: file %s doesn't exist."%path if not os.path.exists(launcher_dir): os.makedirs(launcher_dir) new_path = os.path.join(launcher_dir, os.path.bas...
elf.theme_colors = {}
self.theme_colors = {}
def update(self): """Set widgets according to settings."""
return self.pixbufs[name]
return self.pixbufs[name].copy()
def get_pixbuf(self, name): return self.pixbufs[name]
p1 = self.temp[pix1]
p1 = self.temp[pix1].copy()
def command_combine(self, pixbuf, pix1, pix2, degrees=90): # Combines left half of pixbuf with right half of pixbuf2. # The transition between the two halves are soft. if pix1=="self": p1 = pixbuf elif pix1 in self.temp: p1 = self.temp[pix1] elif self.theme.has_pixbuf(pix1): bg = self.theme.get_pixbuf(pix1) else: print...
p2 = self.temp[pix2]
p2 = self.temp[pix2].copy()
def command_combine(self, pixbuf, pix1, pix2, degrees=90): # Combines left half of pixbuf with right half of pixbuf2. # The transition between the two halves are soft. if pix1=="self": p1 = pixbuf elif pix1 in self.temp: p1 = self.temp[pix1] elif self.theme.has_pixbuf(pix1): bg = self.theme.get_pixbuf(pix1) else: print...
fg = self.temp[fg]
fg = self.temp[fg].copy()
def command_composite(self, pixbuf, bg, fg, opacity=100, xoffset=0, yoffset=0): if fg=="self": fg = pixbuf elif fg in self.temp: fg = self.temp[fg] elif self.theme.has_pixbuf(fg): fg = self.theme.get_pixbuf(fg) fg = fg.scale_simple(pixbuf.get_width(), pixbuf.get_height(), gtk.gdk.INTERP_BILINEAR) else: print "theme err...
bg = self.temp[bg]
bg = self.temp[bg].copy()
def command_composite(self, pixbuf, bg, fg, opacity=100, xoffset=0, yoffset=0): if fg=="self": fg = pixbuf elif fg in self.temp: fg = self.temp[fg] elif self.theme.has_pixbuf(fg): fg = self.theme.get_pixbuf(fg) fg = fg.scale_simple(pixbuf.get_width(), pixbuf.get_height(), gtk.gdk.INTERP_BILINEAR) else: print "theme err...
mask = self.temp[mask]
mask = self.temp[mask].copy()
def command_alpha_mask(self, pixbuf, mask): if mask in self.temp: mask = self.temp[mask] elif self.theme.has_pixbuf(mask): mask = self.theme.get_pixbuf(mask) mask = mask.scale_simple(pixbuf.get_width(), pixbuf.get_height(), gtk.gdk.INTERP_BILINEAR) pixbuf = pixbuf.copy() rows = pixbuf.get_pixels_array() mask_rows = mas...
self.lastlaunch = None
def __init__(self, res_class, path, dockbar=None): self.res_class = res_class self.lastlaunch = None self.path = path self.app = None if path[:4] == "gio:": if path[4:] in dockbar.apps_by_id: self.app = dockbar.apps_by_id[path[4:]] else: raise Exception("gio-app "+path[4:]+" doesn't exist.") elif os.path.exists(path): ...
if self.lastlaunch != None: if time() - self.lastlaunch < 2: return
def launch(self): if self.lastlaunch != None: if time() - self.lastlaunch < 2: return os.chdir(os.path.expanduser('~')) if self.app: print "Executing", self.app.get_name() self.lastlaunch = time() return self.app.launch(None, None) else: print 'Executing ' + self.desktop_entry.getExec() self.execute(self.desktop_entry....
self.lastlaunch = time()
def launch(self): if self.lastlaunch != None: if time() - self.lastlaunch < 2: return os.chdir(os.path.expanduser('~')) if self.app: print "Executing", self.app.get_name() self.lastlaunch = time() return self.app.launch(None, None) else: print 'Executing ' + self.desktop_entry.getExec() self.execute(self.desktop_entry....
self.launch_effect_timeout = gobject.timeout_add(10000, self.remove_launch_effect)
if self.windows: self.launch_effect_timeout = gobject.timeout_add(2000, self.remove_launch_effect) else: self.launch_effect_timeout = gobject.timeout_add(10000, self.remove_launch_effect)
def action_launch_application(self, widget=None, event=None): if self.launcher: self.launcher.launch() elif self.app: self.app.launch(None, None) else: return self.launch_effect = True self.update_state() self.launch_effect_timeout = gobject.timeout_add(10000, self.remove_launch_effect)
if c in self.theme_alphas \ and "no" in self.theme_alphas[c]: self.color_buttons[c].set_use_alpha(False) elif c in self.theme_alphas \ or a in DEFAULT_COLORS:
if a in colors \ and not (c in self.theme_alphas \ and "no" in self.theme_alphas[c]):
def update(self): """Set widgets according to settings."""
gobject.idle_add(self.show_list_request)
gobject.idle_add(self.show_list)
def add_window(self,window): if window in self.windows: return wb = WindowButton(window) self.windows[window] = wb self.winlist.pack_start(wb.window_button, False) if window.is_minimized(): self.minimized_windows_count += 1 if len(self.windows)==1: if self.name is None: self.update_name() self.icon_factory.set_class_gr...
offset = 3
def show_list(self): # Move popup to it's right spot and show it. offset = 3
x,y = self.button.window.get_origin() b_alloc = self.button.get_allocation() w,h = self.popup.get_size() if self.globals.orient == "h": if self.globals.settings['popup_align'] == 'left': x = b_alloc.x + x if self.globals.settings['popup_align'] == 'center': x = b_alloc.x + x + (b_alloc.width/2)-(w/2) if self.globals.se...
def show_list(self): # Move popup to it's right spot and show it. offset = 3
if os.path.isdir(cmd.split()[0]): os.system("xdg-open '%s' &"%cmd) else: os.system("/bin/sh -c '%s' &"%cmd)
os.system("/bin/sh -c '%s' &"%cmd)
def launch(self, uri=None): os.chdir(os.path.expanduser('~')) command = self.getExec() # Replace arguments if "%i" in command: icon = self.getIcon() if icon: command = command.replace("%i","--icon %s"%icon) else: command = command.replace("%i", "") command = command.replace("%c", self.getName()) command = command.repla...
raise
color = "
def get_color(self, color): if color == "active_color": color = 'color5' if color in ['color%s'%i for i in range(1, 9)]: color = colors[color] if color == "icon_average": color = self.get_average_color() else: try: if len(color) != 7: raise ValueError('The string has the wrong lenght') t = int(color[1:], 16) except: pr...
pb = self.surface2pixbuf(pb)
pb = self.surface2pixbuf(self.icon)
def get_average_color(self): if self.average_color != None: return self.average_color r = 0 b = 0 g = 0 i = 0 pb = self.surface2pixbuf(pb) for row in pb.get_pixels_array(): for pix in row: if pix[3] > 30: i += 1 r += pix[0] g += pix[1] b += pix[2] if i > 0: r = int(float(r) / i + 0.5) g = int(float(g) / i + 0.5) b = in...
ctx = cairo.Context(surface)
w = surface.get_width() h = surface.get_height() new = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h) ctx = cairo.Context(new) ctx.set_source_surface(surface) ctx.paint()
def command_fill(self, surface, color, opacity=100): ctx = cairo.Context(surface) alpha = self.get_alpha(opacity) c = self.get_color(color) r = float(int(c[1:3], 16))/255 g = float(int(c[3:5], 16))/255 b = float(int(c[5:7], 16))/255 ctx.set_source_rgba(r, g, b) ctx.set_operator(cairo.OPERATOR_SOURCE) ctx.paint_with_alp...
return surface
return new
def command_fill(self, surface, color, opacity=100): ctx = cairo.Context(surface) alpha = self.get_alpha(opacity) c = self.get_color(color) r = float(int(c[1:3], 16))/255 g = float(int(c[3:5], 16))/255 b = float(int(c[5:7], 16))/255 ctx.set_source_rgba(r, g, b) ctx.set_operator(cairo.OPERATOR_SOURCE) ctx.paint_with_alp...
pixbuf = self.surface2pixbuf(surface)
sio = StringIO() surface.write_to_png(sio) sio.seek(0) loader = gtk.gdk.PixbufLoader() loader.write(sio.getvalue()) loader.close() sio.close() pixbuf = loader.get_pixbuf()
def command_transp_sat(self, surface, opacity=100, saturation=100): # Makes the icon desaturized and/or transparent. w = surface.get_width() h = surface.get_height() new = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h) ctx = gtk.gdk.CairoContext(cairo.Context(new)) alpha = self.get_alpha(opacity) # Todo: Add error check...
ctx = cairo.Context(surface)
new = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h) ctx = cairo.Context(new) ctx.set_source_surface(surface) ctx.paint()
def command_bright(self, surface, strength = None, strenght = None):
return surface
return new
def command_bright(self, surface, strength = None, strenght = None):
self.window.connect("state-changed",self.on_window_state_changed) self.window.connect("icon-changed",self.on_window_icon_changed) self.window.connect("name-changed",self.on_window_name_changed)
self.state_changed_event = self.window.connect("state-changed",self.on_window_state_changed) self.icon_changed_event = self.window.connect("icon-changed",self.on_window_icon_changed) self.name_changed_event = self.window.connect("name-changed",self.on_window_name_changed)
def __init__(self,window,groupbutton): self.groupbutton = groupbutton self.dockbar = groupbutton.dockbar self.screen = self.groupbutton.screen self.name = window.get_name() self.window = window self.locked = False self.is_active_window = False self.needs_attention = False self.opacified = False self.button_pressed = Fa...
print "dockbar init"
print "Dockbarx init"
def __init__(self,applet): gobject.GObject.__init__(self) global settings print "dockbar init" self.applet = applet # self.dragging is used to tell functions wheter # a drag-and-drop is going on self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches ...
message = _("Error: DockbarX couldn't set global keybinding '%(keystr)' for %(function).")%{'keystr':keystr, 'function':translations[s]}
message = _("Error: DockbarX couldn't set global keybinding '%(keystr)s' for %(function)s.")%{'keystr':keystr, 'function':translations[s]}
def on_gkeys_changed(self, arg=None, dialog=True): functions = { "gkeys_select_next_group": self.gkey_select_next_group, "gkeys_select_previous_group": self.gkey_select_previous_group, "gkeys_select_next_window": self.gkey_select_next_window_in_group, "gkeys_select_previous_window": self.gkey_select_previous_window_in_...
else:
elif l:
def add_launcher(self, identifier, path): if path[:4] == "gio:": # This launcher is from an older version of dockbarx. # It will be updated to new form automatically. if path[4:] in self.apps_by_id: app = self.apps_by_id[path[4:]] desktop_entry = self.get_desktop_entry_for_id(app.get_id()) if desktop_entry is None: ret...
if not self.windows and not self.launcher: self.hide_list()
if self.get_unminimized_windows_count() == 0:
def del_window(self,window): if window.is_minimized(): self.minimized_windows_count -= 1 if self.nextlist and window in self.nextlist: self.nextlist.remove(window) self.windows[window].del_button() del self.windows[window] if self.needs_attention: self.on_needs_attention_changed() self.update_state_request() if not sel...
elif not self.windows and self.launcher and self.popup_showing: self.popup.resize(10,10) gobject.idle_add(self.show_list_request)
def del_window(self,window): if window.is_minimized(): self.minimized_windows_count -= 1 if self.nextlist and window in self.nextlist: self.nextlist.remove(window) self.windows[window].del_button() del self.windows[window] if self.needs_attention: self.on_needs_attention_changed() self.update_state_request() if not sel...
self.reload()
gobject.idle_add(self.reload)
def __init__(self,applet): gobject.GObject.__init__(self) global settings print "Dockbarx init" self.applet = applet # self.dragging is used to tell functions wheter # a drag-and-drop is going on self.dragging = False self.right_menu_showing = False self.opacified = False self.opacity_values = None self.opacity_matches...
return self.surfaces[type] surface = None commands = self.theme.get_icon_dict() self.ar = self.theme.get_aspect_ratio() self.type = type for command, args in commands.items(): try: f = getattr(self,"command_%s"%command) except: raise else: surface = f(surface, **args) if type & self.DRAG_DROPP:
surface = self.surfaces[type] else: surface = None commands = self.theme.get_icon_dict() self.ar = self.theme.get_aspect_ratio() self.type = type for command, args in commands.items(): try: f = getattr(self,"command_%s"%command) except: raise else: surface = f(surface, **args) self.surfaces[type] = surface if dnd:
def surface_update(self, type = 0): # Checks if the requested pixbuf is already # drawn and returns it if it is. # Othervice the surface is drawn, saved and returned.
self.surfaces[type] = surface
def surface_update(self, type = 0): # Checks if the requested pixbuf is already # drawn and returns it if it is. # Othervice the surface is drawn, saved and returned.
xid = self.window.get_xid() self.opacify_obj.opacify("!(xid=%s)" % xid,
self.xid = self.window.get_xid() self.opacify_obj.opacify("!(xid=%s)" % self.xid,
def opacify(self): xid = self.window.get_xid() self.opacify_obj.opacify("!(xid=%s)" % xid, self.globals.settings['opacify_alpha'], xid)
xid)
self.xid)
def opacify(self): xid = self.window.get_xid() self.opacify_obj.opacify("!(xid=%s)" % xid, self.globals.settings['opacify_alpha'], xid)
xid = self.window.get_xid() self.opacify_obj.deopacify(xid)
self.opacify_obj.deopacify(self.xid)
def deopacify(self): if self.deopacify_request_sid: gobject.source_remove(self.deopacify_request_sid) self.deopacify_request_sid = None if self.deopacify_sid: self.deopacify_sid = None xid = self.window.get_xid() self.opacify_obj.deopacify(xid)
languages = languages,
def load_theme_translation(): global theme gettext.bindtextdomain ('dockbarx-themes', mo_location) theme = gettext.translation ( 'dockbarx-themes', mo_location, languages = languages, fallback = True)
cmd = u""+app.get_commandline()
cmd = u""+app.get_commandline().lower()
def reload(self, event=None, data=None): # Remove all old groupbuttons from container. for child in self.container.get_children(): self.container.remove(child) if self.windows: # Removes windows and unpinned group buttons for win in self.screen.get_windows(): self.on_window_closed(None, win) if self.groups is not None:...
if cmd.find('.exe')>0: program = \ cmd[cmd.rfind('\\')+1:cmd.rfind('.')+4].lower()
if cmd.find('.exe') > 0: program = cmd[:cmd.rfind('.exe')+4] program = program[program.rfind('\\')+1:]
def reload(self, event=None, data=None): # Remove all old groupbuttons from container. for child in self.container.get_children(): self.container.remove(child) if self.windows: # Removes windows and unpinned group buttons for win in self.screen.get_windows(): self.on_window_closed(None, win) if self.groups is not None:...
and "wine" in exe and ".exe" in exe: exe = exe[:exe.rfind('.exe')+4][exe.rfind('\\')+1:].lower()
and "wine" in exe and ".exe" in exe.lower(): exe = exe.lower() exe = exe[:exe.rfind('.exe')+4] exe = exe[exe.rfind('\\')+1:]
def on_launcher_dropped(self, arg, path, calling_button): # Creates a new launcher with a desktop file located at path. # The new launcher is inserted at the right (or under) # the group button that the launcher was dropped on. try: desktop_entry = DesktopEntry(path) except Exception, detail: print "ERROR: Couldn't rea...
path = os.path.join(folder, "applications", id) if os.path.isfile(path): try: return DesktopEntry(path) except: break
dirname = os.path.join(folder, "applications") basename = id run = True while run: run = False path = os.path.join(dirname, basename) if os.path.isfile(path): try: return DesktopEntry(path) except: pass if "-" in basename: parts = basename.split('-') for n in range(1, len(parts)): subfolder = "-".join(parts[:n]) if ...
def get_desktop_entry_for_id(self, id): # Search for the desktop id first in ~/.local/share/applications # and then in XDG_DATA_DIRS/applications user_folder = os.environ.get('XDG_DATA_HOME', os.path.join(os.path.expanduser('~'), '.local', 'share')) data_folders = os.environ.get("XDG_DATA_DIRS", '/usr/local/share/:/usr...
else:
if pixbuf == None:
def update_preview(self, size=200): if not self.preview: return False pixbuf = None scn = gtk.gdk.screen_get_default() if not self.window.is_minimized() and scn.is_composited(): try: pixbuf = self.get_screenshot_xcomposite(scn, self.window, size) except: print "Error: couldn't get preview for %s"%self.name raise else: ...
attr_list.insert(pango.AttrStyle(pango.STYLE_ITALIC, 0, 50))
attr_list.insert(pango.AttrStyle(pango.STYLE_ITALIC, 0, 200))
def update_label_state(self, arg=None): """Updates the style of the label according to window state.""" attr_list = pango.AttrList() if self.needs_attention: attr_list.insert(pango.AttrStyle(pango.STYLE_ITALIC, 0, 50)) if self.is_active_window: color = self.globals.colors['color3'] elif self.window.is_minimized(): colo...
attr_list.insert(pango.AttrForeground(r, g, b, 0, 50))
attr_list.insert(pango.AttrForeground(r, g, b, 0, 200))
def update_label_state(self, arg=None): """Updates the style of the label according to window state.""" attr_list = pango.AttrList() if self.needs_attention: attr_list.insert(pango.AttrStyle(pango.STYLE_ITALIC, 0, 50)) if self.is_active_window: color = self.globals.colors['color3'] elif self.window.is_minimized(): colo...
return _get(name, datamodel.ResultType.MostRecentSubjects, days)
return _get(name, datamodel.ResultType.MostRecentSubjects, days, number_of_results)
def get_recent_for_app(name, days=14, number_of_results=5): if iface is None: return [] return _get(name, datamodel.ResultType.MostRecentSubjects, days)
return _get(name, datamodel.ResultType.MostPopularSubjects,days)
return _get(name, datamodel.ResultType.MostPopularSubjects, days, number_of_results)
def get_most_used_for_app(name, days=14, number_of_results=5): if iface is None: return [] return _get(name, datamodel.ResultType.MostPopularSubjects,days)
self.settings = xbmcaddon.Addon(id='plugin.video.Mediathek');
self.settings = xbmcaddon.Addon(id='plugin.video.mediathek');
def __init__(self): self.settings = xbmcaddon.Addon(id='plugin.video.Mediathek'); self.quality = int(xbmcplugin.getSetting(int(sys.argv[1]), "quality" )); self.directAccess = xbmcplugin.getSetting(int(sys.argv[1]), "mode" ) == "0"; self.preferedStreamTyp = int(xbmcplugin.getSetting(int(sys.argv[1]), "preferedStreamType...
rootPath = os.path.join(xbmcaddon.getAddonInfo('path'),"resources/logos/");
rootPath = os.path.join(self.settings.getAddonInfo('path'),"resources/logos/");
def listAvaibleMediathekes(self, mediathekNames): rootPath = os.path.join(xbmcaddon.getAddonInfo('path'),"resources/logos/"); for name in mediathekNames: listItem=xbmcgui.ListItem(name, iconImage="DefaultFolder.png",thumbnailImage=os.path.join(rootPath,name+".jpg")) url = "%s?type=%s" % (sys.argv[0], name) xbmcplugin....
if not exists(d): c('mkdir %s') % d
if not exists(d): c('mkdir %s' % d)
def main(): """Set up home dir. Creates directories, downloads conf, and creates appropriate symlinks. It's idempotent, meaning you can rerun it to update an existing install. """ cur = realpath('') home = realpath(getenv('HOME')) if cur != home: raise Exception('You should run this from your home dir.\n%s!=%s' % (...
if not exists('%(home)s/local/more-scripts' % locals()): print """You may need to download v/docs and create a link from v/docs/scripts to ~/local/more-scripts (or not ...)."""
shell = getenv('SHELL') if 'zsh' not in shell: print '''You are using "%(shell)s" but this conf is for zsh. Changing shell to zsh ...''' c('chsh -s /bin/zsh')
def main(): """Set up home dir. Creates directories, downloads conf, and creates appropriate symlinks. It's idempotent, meaning you can rerun it to update an existing install. """ cur = realpath('') home = realpath(getenv('HOME')) if cur != home: raise Exception('You should run this from your home dir.\n%s!=%s' % (...
def __init__(self): """ class initialisation, this class should not be used """ self.unix_socket = None self.host = None self.port = None self.timeout = None self.clamd_socket = None return
def __init__(self): """ class initialisation, this class should not be used """ self.unix_socket = None self.host = None self.port = None self.timeout = None self.clamd_socket = None return
- ScanError: if the server do not reply by PONG
- ConnectionError: if the server do not reply by PONG
def ping(self): """ Send a PING to the clamav server, which should reply by a PONG.
raise ScanError('Could not ping clamd server')
raise ConnectionError('Could not ping clamd server')
def ping(self): """ Send a PING to the clamav server, which should reply by a PONG.
- ScanError: in case of communication problem
- ConnectionError: in case of communication problem
def version(self): """ Get Clamscan version
raise ScanError('Could not get version information from server')
raise ConnectionError('Could not get version information from server')
def version(self): """ Get Clamscan version
- ScanError: in case of communication problem
- ConnectionError: in case of communication problem
def stats(self): """ Get Clamscan stats
raise ScanError('Could not get version information from server')
raise ConnectionError('Could not get version information from server')
def stats(self): """ Get Clamscan stats
- ScanError: in case of communication problem
- ConnectionError: in case of communication problem
def reload(self): """ Force Clamd to reload signature database
raise ScanError('Could probably not reload signature database')
raise ConnectionError('Could probably not reload signature database')
def reload(self): """ Force Clamd to reload signature database
- ScanError: in case of communication problem
- ConnectionError: in case of communication problem
def shutdown(self): """ Force Clamd to shutdown and exit