def __init__(self, builder): self.ui = ui(builder) self.page = self.ui['nb_compizsettings'] self.ui['scale_auto_raise_delay'].add_mark(500, Gtk.PositionType.BOTTOM, None) # Initialise Cairo bits self.window_snapping_drawable = self.ui['draw_window_snapping'] self._base_window_snapping_surface = cairo.ImageSurface.create_from_png(os.path.join(unitytweakconfig.get_data_path(), 'monitor-window-snapping.png')) self.hotcorners_drawable = self.ui['draw_hotcorners'] self._base_hotcorners_surface = cairo.ImageSurface.create_from_png(os.path.join(unitytweakconfig.get_data_path(), 'monitor-hotcorners.png')) self.window_snapping_cboxes = { 'cbox_window_snapping_top': [0, 'top-edge-action'], 'cbox_window_snapping_topleft': [0, 'top-left-corner-action'], 'cbox_window_snapping_left': [0, 'left-edge-action'], 'cbox_window_snapping_bottomleft': [0, 'bottom-left-corner-action'], 'cbox_window_snapping_bottom': [0, 'bottom-edge-action'], 'cbox_window_snapping_topright': [0, 'top-right-corner-action'], 'cbox_window_snapping_right': [0, 'right-edge-action'], 'cbox_window_snapping_bottomright': [0, 'bottom-right-corner-action'] } self.hotcorners_cboxes = { 'cbox_hotcorners_top': [0, 'Top'], 'cbox_hotcorners_topleft': [0, 'TopLeft'], 'cbox_hotcorners_left': [0, 'Left'], 'cbox_hotcorners_bottomleft': [0, 'BottomLeft'], 'cbox_hotcorners_bottom': [0, 'Bottom'], 'cbox_hotcorners_topright': [0, 'TopRight'], 'cbox_hotcorners_right': [0, 'Right'], 'cbox_hotcorners_bottomright': [0, 'BottomRight'] }
def __init__(self, builder): self.ui=ui(builder) self.gtkthemestore=Gtk.ListStore(str,str) self.windowthemestore=self.gtkthemestore self.ui['tree_gtk_theme'].set_model(self.gtkthemestore) self.ui['tree_window_theme'].set_model(self.windowthemestore) # Get all themes systhdir='/usr/share/themes' systemthemes=[(theme.capitalize(),os.path.join(systhdir,theme)) for theme in os.listdir(systhdir) if os.path.isdir(os.path.join(systhdir,theme))] try: uthdir=os.path.expanduser('~/.themes') userthemes=[(theme.capitalize(),os.path.join(uthdir,theme)) for theme in os.listdir(uthdir) if os.path.isdir(os.path.join(uthdir,theme))] except OSError as e: userthemes=[] allthemes=systemthemes+userthemes allthemes.sort() required=['gtk-2.0','gtk-3.0','metacity-1'] self.gtkthemes={} self.windowthemes={} for theme in allthemes: if all([os.path.isdir(os.path.join(theme[1],req)) for req in required]): iter=self.gtkthemestore.append(theme) themename=os.path.split(theme[1])[1] self.gtkthemes[themename]={'iter':iter,'path':theme[1]} self.windowthemes[themename]={'iter':iter,'path':theme[1]} self.iconthemestore=Gtk.ListStore(str,str) self.cursorthemestore=Gtk.ListStore(str,str) self.ui['tree_icon_theme'].set_model(self.iconthemestore) self.ui['tree_cursor_theme'].set_model(self.cursorthemestore) sysithdir='/usr/share/icons' systemiconthemes= [(theme.capitalize(),os.path.join(sysithdir,theme)) for theme in os.listdir(sysithdir) if os.path.isdir(os.path.join(sysithdir,theme))] to_be_hidden=[('Loginicons','/usr/share/icons/LoginIcons'),('Unity-webapps-applications','/usr/share/icons/unity-webapps-applications')] for item in to_be_hidden: try: systemiconthemes.remove(item) except ValueError as e: pass try: uithdir=os.path.expanduser('~/.icons') usericonthemes=[(theme.capitalize(),os.path.join(uithdir,theme)) for theme in os.listdir(uithdir) if os.path.isdir(os.path.join(uithdir,theme))] except OSError as e: usericonthemes=[] allithemes=systemiconthemes+usericonthemes allithemes.sort() self.iconthemes={} self.cursorthemes={} for theme in allithemes: iter=self.iconthemestore.append(theme) themename=os.path.split(theme[1])[1] self.iconthemes[themename]={'iter':iter,'path':theme[1]} if os.path.isdir(os.path.join(theme[1],'cursors')): iter=self.cursorthemestore.append(theme) self.cursorthemes[themename]={'iter':iter,'path':theme[1]} self.matchthemes=True
def __init__(self, builder): self.ui = ui(builder) if Gdk.Screen.get_default().get_n_monitors() == 1: dependants = [ 'l_launcher_visibility', 'radio_launcher_visibility_all', 'radio_launcher_visibility_primary', 'l_notifications', 'radio_active_monitor', 'radio_all_monitors' ] self.ui.unsensitize(dependants)
def __init__(self, builder): self.ui = ui(builder) if Gdk.Screen.get_default().get_n_monitors() == 1: dependants = ['l_launcher_visibility', 'radio_launcher_visibility_all', 'radio_launcher_visibility_primary', 'l_notifications', 'radio_active_monitor', 'radio_all_monitors'] self.ui.unsensitize(dependants)
def __init__(self, builder): self.ui = ui(builder) self.ui['sc_panel_transparency'].add_mark(.67, Gtk.PositionType.BOTTOM, None) if Gdk.Screen.get_default().get_n_monitors() == 1: dependants = ['l_launcher_visibility', 'radio_launcher_visibility_all', 'radio_launcher_visibility_primary', 'l_notifications', 'radio_active_monitor', 'radio_all_monitors'] self.ui.unsensitize(dependants)
def __init__(self, container, notebook): '''Handler Initialisations. Obtain all references here.''' self.builder = Gtk.Builder() self.container = container self.notebook = notebook self.glade = (os.path.join(unitytweakconfig.get_data_path(), 'startpage.ui')) self.builder.add_from_file(self.glade) self.ui = ui(self.builder) self.page = self.ui['box_startpage'] self.page.unparent() self.builder.connect_signals(self) # Symbolic icons self.icons = Gtk.IconTheme.get_default() self.style_context = self.ui['startpage_window'].get_style_context() self.style_context.connect('changed', self.on_style_context_change)
def __init__(self, builder): self.ui = ui(builder) self.page = self.ui['nb_compizsettings'] self.ui['scale_auto_raise_delay'].add_mark(500, Gtk.PositionType.BOTTOM, None) # Initialise Cairo bits self.window_snapping_drawable = self.ui['draw_window_snapping'] self._base_window_snapping_surface = cairo.ImageSurface.create_from_png( os.path.join(unitytweakconfig.get_data_path(), 'monitor-window-snapping.png')) self.hotcorners_drawable = self.ui['draw_hotcorners'] self._base_hotcorners_surface = cairo.ImageSurface.create_from_png( os.path.join(unitytweakconfig.get_data_path(), 'monitor-hotcorners.png')) self.window_snapping_cboxes = { 'cbox_window_snapping_top': [0, 'top-edge-action'], 'cbox_window_snapping_topleft': [0, 'top-left-corner-action'], 'cbox_window_snapping_left': [0, 'left-edge-action'], 'cbox_window_snapping_bottomleft': [0, 'bottom-left-corner-action'], 'cbox_window_snapping_bottom': [0, 'bottom-edge-action'], 'cbox_window_snapping_topright': [0, 'top-right-corner-action'], 'cbox_window_snapping_right': [0, 'right-edge-action'], 'cbox_window_snapping_bottomright': [0, 'bottom-right-corner-action'] } self.hotcorners_cboxes = { 'cbox_hotcorners_top': [0, 'Top'], 'cbox_hotcorners_topleft': [0, 'TopLeft'], 'cbox_hotcorners_left': [0, 'Left'], 'cbox_hotcorners_bottomleft': [0, 'BottomLeft'], 'cbox_hotcorners_bottom': [0, 'Bottom'], 'cbox_hotcorners_topright': [0, 'TopRight'], 'cbox_hotcorners_right': [0, 'Right'], 'cbox_hotcorners_bottomright': [0, 'BottomRight'] }
def init(page=0): print('Initialising...') from UnityTweakTool.config.data import get_data_path from UnityTweakTool.config.ui import ui global notebook builder = Gtk.Builder() glade = os.path.join(get_data_path(), 'unitytweak.ui') builder.add_from_file(glade) interface = ui(builder) # Symbolic icon def on_style_context_change(widget): main_fg_color = style_context.get_color(Gtk.StateFlags.ACTIVE) overview_symbolic_icon = icons.lookup_icon( 'unity-tweak-tool-overview-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE) if overview_symbolic_icon: overview_symbolic_icon_pixbuf, was_sym = overview_symbolic_icon.load_symbolic( main_fg_color, None, None, None) interface['image_overview'].set_from_pixbuf( overview_symbolic_icon_pixbuf) icons = Gtk.IconTheme.get_default() style_context = interface['toolbar_main'].get_style_context() style_context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR) style_context.connect('changed', on_style_context_change) notebook = builder.get_object('nb_unitytweak') connectpages() notebook.set_current_page(page) connecthandlers(builder) builder.get_object('unitytweak_main').show_all() builder.get_object('unitytweak_main').connect('delete-event', Gtk.main_quit) Gtk.main()
def init(page=0): print("Initialising...") from UnityTweakTool.config.data import get_data_path from UnityTweakTool.config.ui import ui global notebook builder = Gtk.Builder() glade = os.path.join(get_data_path(), "unitytweak.ui") builder.add_from_file(glade) interface = ui(builder) # Symbolic icon def on_style_context_change(widget): main_fg_color = style_context.get_color(Gtk.StateFlags.ACTIVE) overview_symbolic_icon = icons.lookup_icon( "unity-tweak-tool-overview-symbolic", 24, Gtk.IconLookupFlags.FORCE_SIZE ) if overview_symbolic_icon: overview_symbolic_icon_pixbuf, was_sym = overview_symbolic_icon.load_symbolic( main_fg_color, None, None, None ) interface["image_overview"].set_from_pixbuf(overview_symbolic_icon_pixbuf) icons = Gtk.IconTheme.get_default() style_context = interface["toolbar_main"].get_style_context() style_context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR) style_context.connect("changed", on_style_context_change) notebook = builder.get_object("nb_unitytweak") connectpages() notebook.set_current_page(page) connecthandlers(builder) builder.get_object("unitytweak_main").show_all() builder.get_object("unitytweak_main").connect("delete-event", Gtk.main_quit) Gtk.main()
def __init__(self, builder): self.ui = ui(builder) self.gtkthemestore = Gtk.ListStore(str, str) self.windowthemestore = self.gtkthemestore self.ui['tree_gtk_theme'].set_model(self.gtkthemestore) self.ui['tree_window_theme'].set_model(self.windowthemestore) # Get all themes systhdir = '/usr/share/themes' systemthemes = [(theme.capitalize(), os.path.join(systhdir, theme)) for theme in os.listdir(systhdir) if os.path.isdir(os.path.join(systhdir, theme))] try: uthdir = os.path.expanduser('~/.themes') userthemes = [(theme.capitalize(), os.path.join(uthdir, theme)) for theme in os.listdir(uthdir) if os.path.isdir(os.path.join(uthdir, theme))] except OSError as e: userthemes = [] allthemes = systemthemes + userthemes allthemes.sort() required = ['gtk-2.0', 'gtk-3.0', 'metacity-1'] self.gtkthemes = {} self.windowthemes = {} for theme in allthemes: if all([ os.path.isdir(os.path.join(theme[1], req)) for req in required ]): iter = self.gtkthemestore.append(theme) themename = os.path.split(theme[1])[1] self.gtkthemes[themename] = {'iter': iter, 'path': theme[1]} self.windowthemes[themename] = {'iter': iter, 'path': theme[1]} self.iconthemestore = Gtk.ListStore(str, str) self.cursorthemestore = Gtk.ListStore(str, str) self.ui['tree_icon_theme'].set_model(self.iconthemestore) self.ui['tree_cursor_theme'].set_model(self.cursorthemestore) sysithdir = '/usr/share/icons' systemiconthemes = [(theme.capitalize(), os.path.join(sysithdir, theme)) for theme in os.listdir(sysithdir) if os.path.isdir(os.path.join(sysithdir, theme))] to_be_hidden = [('Loginicons', '/usr/share/icons/LoginIcons'), ('Unity-webapps-applications', '/usr/share/icons/unity-webapps-applications')] for item in to_be_hidden: try: systemiconthemes.remove(item) except ValueError as e: pass try: uithdir = os.path.expanduser('~/.icons') usericonthemes = [(theme.capitalize(), os.path.join(uithdir, theme)) for theme in os.listdir(uithdir) if os.path.isdir(os.path.join(uithdir, theme))] except OSError as e: usericonthemes = [] allithemes = systemiconthemes + usericonthemes allithemes.sort() self.iconthemes = {} self.cursorthemes = {} for theme in allithemes: iter = self.iconthemestore.append(theme) themename = os.path.split(theme[1])[1] self.iconthemes[themename] = {'iter': iter, 'path': theme[1]} if os.path.isdir(os.path.join(theme[1], 'cursors')): iter = self.cursorthemestore.append(theme) self.cursorthemes[themename] = {'iter': iter, 'path': theme[1]} self.matchthemes = True