Exemplo n.º 1
0
	def __init__(self):
		self.menu = gtk.Menu()
		self._app_indicator = None
		self._status_icon = None
		
		try:
			import appindicator
		except ImportError:
			self._status_icon = StatusIcon()
			self._status_icon.set_menu(self.menu)
		else:
			self._app_indicator = appindicator.Indicator("glipper", "glipper", appindicator.CATEGORY_APPLICATION_STATUS)
			self._app_indicator.set_status(appindicator.STATUS_ACTIVE)
			self._app_indicator.set_menu(self.menu)

		glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MARK_DEFAULT_ENTRY, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
		glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MAX_ITEM_LENGTH, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
		
		gtk.window_set_default_icon_name("glipper")
		
		get_glipper_keybinder().connect('activated', self.on_key_combination_press)
		get_glipper_keybinder().connect('changed', self.on_key_combination_changed)
		get_glipper_history().connect('changed', self.on_history_changed)
		get_glipper_plugins_manager().load()
		get_glipper_history().load()
		get_glipper_plugins_manager().connect('menu-items-changed', self.on_plugins_menu_items_changed)
Exemplo n.º 2
0
 def __init__(self, datadir, version, argv):
     self.file_path = datadir
     self.version = version
     self.editor = MenuEditor()
     gtk.window_set_default_icon_name("mozo")
     self.tree = gtk.Builder()
     self.tree.set_translation_domain(config.GETTEXT_PACKAGE)
     self.tree.add_from_file(os.path.join(self.file_path, "mozo.ui"))
     self.tree.connect_signals(self)
     self.setupMenuTree()
     self.setupItemTree()
     self.tree.get_object("edit_delete").set_sensitive(False)
     self.tree.get_object("edit_revert_to_original").set_sensitive(False)
     self.tree.get_object("edit_properties").set_sensitive(False)
     self.tree.get_object("move_up_button").set_sensitive(False)
     self.tree.get_object("move_down_button").set_sensitive(False)
     self.tree.get_object("new_separator_button").set_sensitive(False)
     accelgroup = gtk.AccelGroup()
     keyval, modifier = gtk.accelerator_parse("<Ctrl>Z")
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, self.on_mainwindow_undo)
     keyval, modifier = gtk.accelerator_parse("<Ctrl><Shift>Z")
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, self.on_mainwindow_redo)
     keyval, modifier = gtk.accelerator_parse("F1")
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, self.on_help_button_clicked)
     self.tree.get_object("mainwindow").add_accel_group(accelgroup)
Exemplo n.º 3
0
    def create_hamster_window(self):
        if self.window is None:
            # load window of activity switcher and todays view
            self._gui = load_ui_file("today.ui")
            self.window = self._gui.get_object('hamster-window')
            self.window.connect("delete_event", self.on_delete_window)

            gtk.window_set_default_icon_name("hamster-time-tracker")

            self.new_name = widgets.ActivityEntry()
            self.new_name.connect("value-entered", self.on_switch_activity_clicked)
            widgets.add_hint(self.new_name, _("Activity"))
            self.get_widget("new_name_box").add(self.new_name)
            self.new_name.connect("changed", self.on_activity_text_changed)

            self.new_tags = widgets.TagsEntry()
            self.new_tags.connect("tags_selected", self.on_switch_activity_clicked)
            widgets.add_hint(self.new_tags, _("Tags"))
            self.get_widget("new_tags_box").add(self.new_tags)

            self.tag_box = widgets.TagBox(interactive = False)
            self.get_widget("tag_box").add(self.tag_box)

            self.treeview = widgets.FactTree()
            self.treeview.connect("key-press-event", self.on_todays_keys)
            self.treeview.connect("edit-clicked", self._open_edit_activity)
            self.treeview.connect("row-activated", self.on_today_row_activated)

            self.get_widget("today_box").add(self.treeview)

            # connect the accelerators
            self.accel_group = self.get_widget("accelgroup")
            self.window.add_accel_group(self.accel_group)

            self._gui.connect_signals(self)
Exemplo n.º 4
0
    def __init__(self, ui_file="avahi-discover.ui", **kwargs):
        ui_path = os.path.join(os.path.dirname(__file__), ui_file)
        gtk.window_set_default_icon_name("network-wired")
        self.ui = gtk.Builder()
        self.ui.add_from_file(ui_path)
        self.ui.connect_signals(self)
        self.tree_view = self.ui.get_object("tree_view")
        self.info_label = self.ui.get_object("info_label")
        self.treemodel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
        self.tree_view.set_model(self.treemodel)
        #creating the columns headers
        self.tree_view.set_headers_visible(False)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("", renderer, text=0)
        column.set_resizable(True)
        column.set_sizing("GTK_TREE_VIEW_COLUMN_GROW_ONLY")
        column.set_expand(True)
        self.tree_view.append_column(column)

        # Tree domain -> type -> service
        self.domain_iters = {}
        self.type_iters = {}
        self.service_iters = {}
        super(MainWindow, self).__init__(**kwargs)

        # Some "improvements"
        # Don't unfold .local if there are other domains
        self.unfold_local = True
    def __init__(self):
        # Default values
        self.filename = None
        self.about_dialog = None

        # use GtkBuilder to build our interface from the XML file
        try:
            builder = gtk.Builder()
            builder.add_from_file("res/texteditor.glade")
        except:
            self.error_message("Failed to load UI XML file: texteditor.glade")
            sys.exit(1)

        # get the widgets which will be referenced in callbacks
        self.window = builder.get_object("window")
        self.statusbar = builder.get_object("statusbar")
        self.text_view = builder.get_object("text_view")

        # connect signals
        builder.connect_signals(self)

        # set the text view font
        self.text_view.modify_font(pango.FontDescription("monospace 10"))

        # set the default icon to the GTK "edit" icon
        gtk.window_set_default_icon_name(gtk.STOCK_EDIT)

        # setup and initialize our statusbar
        self.statusbar_cid = self.statusbar.get_context_id("Tutorial GTK+ Text Editor")
        self.reset_default_status()
Exemplo n.º 6
0
def main():
    signal.signal(signal.SIGHUP, signal.SIG_IGN)
    gtk.window_set_default_icon_name("gnome-terminal")
    parts = {"history": shell.History()}
    make_terminal(parts).get_widget().show_all()
    errorgui.set_excepthook()
    gtk.main()
Exemplo n.º 7
0
 def __init__(self, datadir, version, argv):
     self.file_path = datadir
     self.version = version
     self.editor = MenuEditor()
     gtk.window_set_default_icon_name('mozo')
     self.tree = gtk.Builder()
     self.tree.set_translation_domain(config.GETTEXT_PACKAGE)
     self.tree.add_from_file(os.path.join(self.file_path, 'mozo.ui'))
     self.tree.connect_signals(self)
     self.setupMenuTree()
     self.setupItemTree()
     self.tree.get_object('edit_delete').set_sensitive(False)
     self.tree.get_object('edit_revert_to_original').set_sensitive(False)
     self.tree.get_object('edit_properties').set_sensitive(False)
     self.tree.get_object('move_up_button').set_sensitive(False)
     self.tree.get_object('move_down_button').set_sensitive(False)
     self.tree.get_object('new_separator_button').set_sensitive(False)
     accelgroup = gtk.AccelGroup()
     keyval, modifier = gtk.accelerator_parse('<Ctrl>Z')
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE,
                              self.on_mainwindow_undo)
     keyval, modifier = gtk.accelerator_parse('<Ctrl><Shift>Z')
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE,
                              self.on_mainwindow_redo)
     keyval, modifier = gtk.accelerator_parse('F1')
     accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE,
                              self.on_help_button_clicked)
     self.tree.get_object('mainwindow').add_accel_group(accelgroup)
Exemplo n.º 8
0
	def __init__(self):
		self.menu = gtk.Menu()
		self._app_indicator = None
		self._status_icon = None
		
		try:
			import appindicator
		except ImportError:
			self._status_icon = StatusIcon()
			self._status_icon.set_menu(self.menu)
		else:
			self._app_indicator = appindicator.Indicator("glipper", "glipper", appindicator.CATEGORY_APPLICATION_STATUS)
			self._app_indicator.set_status(appindicator.STATUS_ACTIVE)
			self._app_indicator.set_menu(self.menu)

		glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MARK_DEFAULT_ENTRY, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
		glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MAX_ITEM_LENGTH, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
		
		gtk.window_set_default_icon_name("glipper")
		
		get_glipper_keybinder().connect('activated', self.on_key_combination_press)
		get_glipper_keybinder().connect('changed', self.on_key_combination_changed)
		get_glipper_history().connect('changed', self.on_history_changed)
		get_glipper_plugins_manager().load()
		get_glipper_history().load()
		get_glipper_plugins_manager().connect('menu-items-changed', self.on_plugins_menu_items_changed)
    def __init__(self):
        # Default values
        self.filename = None
        self.about_dialog = None

        # use GtkBuilder to build our interface from the XML file
        try:
            builder = gtk.Builder()
            builder.add_from_file("res/texteditor.glade")
        except:
            self.error_message("Failed to load UI XML file: texteditor.glade")
            sys.exit(1)

        # get the widgets which will be referenced in callbacks
        self.window = builder.get_object("window")
        self.statusbar = builder.get_object("statusbar")
        self.text_view = builder.get_object("text_view")

        # connect signals
        builder.connect_signals(self)

        # set the text view font
        self.text_view.modify_font(pango.FontDescription("monospace 10"))

        # set the default icon to the GTK "edit" icon
        gtk.window_set_default_icon_name(gtk.STOCK_EDIT)

        # setup and initialize our statusbar
        self.statusbar_cid = self.statusbar.get_context_id(
            "Tutorial GTK+ Text Editor")
        self.reset_default_status()
Exemplo n.º 10
0
 def setup_main_window (self):
     gtk.window_set_default_icon_name('mate-sudoku')
     self.w = gtk.Window()
     self.w.set_default_size(self.mateconf['width'], self.mateconf['height'])
     self.w.set_title(APPNAME_SHORT)
     self.w.connect('configure-event', self.resize_cb)
     self.w.connect('delete-event', self.quit_cb)
     self.uimanager = gtk.UIManager()
Exemplo n.º 11
0
def init():
    from blamainwindow import BlaMainWindow

    gtk.icon_theme_get_default().append_search_path(blaconst.ICONS_PATH)
    theme = gtk.icon_theme_get_default()
    gtk.window_set_default_icon_name(blaconst.APPNAME)

    return BlaMainWindow()
Exemplo n.º 12
0
 def setup_main_window (self):
     gtk.window_set_default_icon_name('gnome-sudoku')
     self.w = gtk.Window()
     self.w.set_default_size(self.gconf['width'], self.gconf['height'])
     self.w.set_title(APPNAME_SHORT)
     self.w.connect('configure-event', self.resize_cb)
     self.w.connect('delete-event', self.quit_cb)
     self.uimanager = gtk.UIManager()
Exemplo n.º 13
0
    def __init__(self, datadir=None, options=None, file=None, parent=None):
        """ Provide a GTK based graphical user interface to configure
        the used software repositories, corresponding authentication keys
        and update automation """
        SoftwareProperties.__init__(self, options=options, datadir=datadir)
        gtk.window_set_default_icon_name("software-properties")

        SimpleGladeApp.__init__(self,
                                datadir + "glade/main.glade",
                                None,
                                domain="software-properties")

        if parent:
            self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
            self.window_main.show()
            self.window_main.set_transient_for(parent)

        # If externally called, reparent to external application.
        self.options = options
        if options and options.toplevel != None:
            self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
            self.window_main.show()
            toplevel = gtk.gdk.window_foreign_new(int(options.toplevel))
            if (toplevel):
                self.window_main.window.set_transient_for(toplevel)

        # Show what we have early
        self.window_main.show()

        # used to store the handlers of callbacks
        self.handlers = []

        # Put some life into the user interface:
        self.init_popcon()
        self.init_auto_update()
        self.show_auto_update_level()
        # Setup the key list
        self.init_keys()
        self.show_keys()
        # Setup the ISV sources list
        self.init_isv_sources()
        self.show_isv_sources()
        self.show_cdrom_sources()
        # Setup and show the distro elements
        self.init_distro()
        self.show_distro()

        # Show the import/replace sources.list dialog if a file different
        # to the default sources.list was specified
        # NOTE: If the file path points to the default sources.list the user
        #       perhaps assumed that s-p would act like a normal editor.
        #       We have got some bug reports from users calling
        #       "sudo software-properties-gtk /etc/apt/sources.list" from the
        #       command line.
        if file != None and \
           os.path.abspath(file) !=  "%s%s" % (apt_pkg.Config.FindDir("Dir::Etc"),
                                               apt_pkg.Config.Find("Dir::Etc::sourcelist")):
            self.open_file(file)
Exemplo n.º 14
0
 def __init__(self, path="avahi-discover.ui", root="main_window", domain=None, **kwargs):
     path = os.path.join(ui_dir, path)
     gtk.window_set_default_icon_name("network-wired")
     self.ui = gtk.Builder()
     self.ui.add_from_file(path)
     self.ui.connect_signals(self)
     self.tree_view = self.ui.get_object("tree_view")
     self.info_label = self.ui.get_object("info_label")
     self.new()
Exemplo n.º 15
0
 def __init__(self, path="avahi-discover.ui", root="main_window", domain=None, **kwargs):
     path = os.path.join(ui_dir, path)
     gtk.window_set_default_icon_name("network-wired")
     self.ui = gtk.Builder()
     self.ui.add_from_file(path)
     self.ui.connect_signals(self)
     self.tree_view = self.ui.get_object("tree_view")
     self.info_label = self.ui.get_object("info_label")
     self.new()
Exemplo n.º 16
0
    def create_hamster_window(self):
        if self.window is None:
            # load window of activity switcher and todays view
            self._gui = load_ui_file("today.ui")
            self.window = self._gui.get_object('hamster-window')
            self.window.connect("delete_event", self.on_delete_window)

            gtk.window_set_default_icon_name("hamster-time-tracker")

            self.new_name = widgets.ActivityEntry()
            self.new_name.connect("value-entered",
                                  self.on_switch_activity_clicked)
            widgets.add_hint(self.new_name, _("Activity"))
            self.get_widget("new_name_box").add(self.new_name)
            self.new_name.connect("changed", self.on_activity_text_changed)

            self.new_tags = widgets.TagsEntry()
            self.new_tags.connect("tags_selected",
                                  self.on_switch_activity_clicked)
            widgets.add_hint(self.new_tags, _("Tags"))
            self.get_widget("new_tags_box").add(self.new_tags)

            self.tag_box = widgets.TagBox(interactive=False)
            self.get_widget("tag_box").add(self.tag_box)

            self.treeview = widgets.FactTree()
            self.treeview.connect("key-press-event", self.on_todays_keys)
            self.treeview.connect("edit-clicked", self._open_edit_activity)
            self.treeview.connect("row-activated", self.on_today_row_activated)

            self.get_widget("today_box").add(self.treeview)

            # connect the accelerators
            self.accel_group = self.get_widget("accelgroup")
            self.window.add_accel_group(self.accel_group)

            self._gui.connect_signals(self)

            # Signal for Redmine issue combo
            self.get_widget("issue_combo").connect(
                "changed", self.on_redmine_issue_combo_change)

            # Signal for Redmine arbitrary issue id entry
            self.get_widget("arbitrary_issue_id_entry").connect(
                "changed", self.on_redmine_arbitrary_issue_id_entry_change)

            # Redmine combos additional setup
            cell = gtk.CellRendererText()
            self.get_widget("issue_combo").pack_start(cell, True)
            self.get_widget("issue_combo").add_attribute(cell, 'text', 0)
            cell = gtk.CellRendererText()
            self.get_widget("time_activity_combo").pack_start(cell, True)
            self.get_widget("time_activity_combo").add_attribute(
                cell, 'text', 0)
Exemplo n.º 17
0
    def __init__(self, filename=None):
        # Default values
        self.filename = None
        self.about_dialog = None

        # use GtkBuilder to build our interface from the XML file

        builder = gtk.Builder()
        builder.add_from_file(
            os.path.join(EasyHybrid_ROOT, 'TextEditor',
                         "TextEditorWindow.glade"))
        #builder.add_from_string(glade)

        # get the widgets which will be referenced in callbacks
        self.window = builder.get_object("window1")
        self.statusbar = builder.get_object("statusbar1")
        self.text_view = builder.get_object("textview1")

        # connect signals
        builder.connect_signals(self)

        # set the text view font
        self.text_view.modify_font(pango.FontDescription("monospace 10"))
        #self.text_view.modify_font(pango.weight( 'bold'))

        # set the default icon to the GTK "edit" icon
        gtk.window_set_default_icon_name(gtk.STOCK_EDIT)

        # setup and initialize our statusbar
        self.statusbar_cid = self.statusbar.get_context_id(
            "Tutorial GTK+ Text Editor")
        #self.reset_default_status()

        if filename != None:
            TheFile = os.path.split(filename)

            fin = open(filename, "r")

            text = fin.read()
            fin.close()

            # disable the text view while loading the buffer with the text
            self.text_view.set_sensitive(False)
            buff = self.text_view.get_buffer()
            buff.set_text(text)
            buff.set_modified(False)
            self.text_view.set_sensitive(True)

            self.window.set_title(TheFile[-1])
            # now we can set the current filename since loading was a success
            self.filename = filename

        print filename
        self.main()
Exemplo n.º 18
0
    def init_ui(self):
        gobject.set_application_name("Pithos")
        gtk.window_set_default_icon_name('pithos')
        os.environ['PULSE_PROP_media.role'] = 'music'

        self.playpause_button = self.builder.get_object('playpause_button')

        self.volume = self.builder.get_object('volume')
        self.volume.set_property("value", math.pow(float(self.preferences['volume']), 1.0/3.0))

        self.statusbar = self.builder.get_object('statusbar1')

        self.song_menu = self.builder.get_object('song_menu')
        self.song_menu_love = self.builder.get_object('menuitem_love')
        self.song_menu_unlove = self.builder.get_object('menuitem_unlove')
        self.song_menu_ban = self.builder.get_object('menuitem_ban')
        self.song_menu_unban = self.builder.get_object('menuitem_unban')

        self.songs_treeview = self.builder.get_object('songs_treeview')
        self.songs_treeview.set_model(self.songs_model)

        title_col   = gtk.TreeViewColumn()

        def bgcolor_data_func(column, cell, model, iter):
            if model.get_value(iter, 0) is self.current_song:
                bgcolor = column.get_tree_view().get_style().mid[gtk.STATE_NORMAL]
            else:
                bgcolor = column.get_tree_view().get_style().base[gtk.STATE_NORMAL]
            cell.set_property("cell-background-gdk", bgcolor)

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, expand=False)
        title_col.add_attribute(render_icon, "icon", 2)
        title_col.add_attribute(render_icon, "pixbuf", 3)
        title_col.set_cell_data_func(render_icon, bgcolor_data_func)

        render_text = gtk.CellRendererText()
        render_text.props.ellipsize = pango.ELLIPSIZE_END
        title_col.pack_start(render_text, expand=True)
        title_col.add_attribute(render_text, "markup", 1)
        title_col.set_cell_data_func(render_text, bgcolor_data_func)

        self.songs_treeview.append_column(title_col)

        self.songs_treeview.connect('button_press_event', self.on_treeview_button_press_event)

        self.stations_combo = self.builder.get_object('stations')
        self.stations_combo.set_model(self.stations_model)
        render_text = gtk.CellRendererText()
        self.stations_combo.pack_start(render_text, expand=True)
        self.stations_combo.add_attribute(render_text, "text", 1)
        self.stations_combo.set_row_separator_func(lambda model, iter: model.get_value(iter, 0) is None)

        buttonMenu(self.builder.get_object("toolbutton_options"), self.builder.get_object("menu_options"))
Exemplo n.º 19
0
 def _init_window(self):
     """Initialize the main window."""
     self.window = gtk.Window()
     self.window.set_icon_name("gaupol")
     gtk.window_set_default_icon_name("gaupol")
     self.window.resize(*gaupol.conf.application_window.size)
     self.window.move(*gaupol.conf.application_window.position)
     if gaupol.conf.application_window.maximized:
         self.window.maximize()
     aeidon.util.connect(self, "window", "delete-event")
     aeidon.util.connect(self, "window", "window-state-event")
Exemplo n.º 20
0
 def __init__(self):
     gobject.GObject.__init__(self)
     gobject.set_application_name("Meld")
     gtk.window_set_default_icon_name("meld")
     self.version = version
     self.prefs = preferences.MeldPreferences()
     self.prefs.notify_add(self.on_preference_changed)
     self.file_filters = self._parse_filters(self.prefs.filters,
                                             FilterEntry.SHELL)
     self.text_filters = self._parse_filters(self.prefs.regexes,
                                             FilterEntry.REGEX)
Exemplo n.º 21
0
    def __init__(self, filename = None):
        # Default values
        self.filename     = None
        self.about_dialog = None
        
        # use GtkBuilder to build our interface from the XML file 

        builder = gtk.Builder()
        builder.add_from_file(os.path.join(EasyHybrid_ROOT, 'TextEditor',"TextEditorWindow.glade")) 
        #builder.add_from_string(glade)
            
        # get the widgets which will be referenced in callbacks
        self.window    = builder.get_object("window1")
        self.statusbar = builder.get_object("statusbar1")
        self.text_view = builder.get_object("textview1")
        
        # connect signals
        builder.connect_signals(self)
        
        # set the text view font
        self.text_view.modify_font(pango.FontDescription("monospace 10"))
        #self.text_view.modify_font(pango.weight( 'bold'))
        
        # set the default icon to the GTK "edit" icon
        gtk.window_set_default_icon_name(gtk.STOCK_EDIT)
        
        # setup and initialize our statusbar
        self.statusbar_cid = self.statusbar.get_context_id("Tutorial GTK+ Text Editor")
        #self.reset_default_status()
        
        if filename != None:
            TheFile = os.path.split(filename)
            
            fin = open(filename, "r")
            
            text = fin.read()
            fin.close()
            
            # disable the text view while loading the buffer with the text
            self.text_view.set_sensitive(False)
            buff = self.text_view.get_buffer()
            buff.set_text(text)
            buff.set_modified(False)
            self.text_view.set_sensitive(True)
            
            
            
            self.window.set_title(TheFile[-1])
            # now we can set the current filename since loading was a success
            self.filename = filename

        print filename
        self.main()
Exemplo n.º 22
0
 def __init__(self):
     gobject.GObject.__init__(self)
     gobject.set_application_name("Meld")
     gtk.window_set_default_icon_name("meld")
     self.version = version
     self.prefs = preferences.MeldPreferences()
     self.prefs.notify_add(self.on_preference_changed)
     self.file_filters = self._parse_filters(self.prefs.filters,
                                             filters.FilterEntry.SHELL)
     self.text_filters = self._parse_filters(self.prefs.regexes,
                                             filters.FilterEntry.REGEX)
     self.recent_comparisons = recent.RecentFiles(sys.argv[0])
Exemplo n.º 23
0
 def __init__(self):
     gtk.window_set_default_icon_name(gtk.STOCK_MEDIA_RECORD)
     self.tray_image = gtk.Image()
     self.tray_image.set_from_stock(gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_SMALL_TOOLBAR)
     self.event_box.add(self.tray_image)
     self.tooltips = gtk.Tooltips()
     self.tooltips.set_tip(self.event_box,
         _("Left click to start screencast.  Right click for menu."))
     self.tray_container = egg.trayicon.TrayIcon("istanbul")
     self.tray_container.add(self.event_box)
     self.event_box.connect("button-press-event", self._trayicon_clicked)
     self.tray_container.show_all()
Exemplo n.º 24
0
    def __init__ (self, uid, panel_id, media_button_type):
        """
        Creating the applet's core
        """
        awn.AppletSimple.__init__(self, 'media-icon' + media_button_type[1:], \
          uid, panel_id)

        self.icon_names = {}
        self.icon_names["--next"] = "media-skip-forward"
        self.icon_names["--previous"] = "media-skip-backward"
        self.icon_names["--pp"] = "media-playback-start"

        self.tooltips = {}
        self.tooltips["--next"] = _("Next")
        self.tooltips["--previous"] = _("Previous")
        self.tooltips["--pp"] = _("Play/Pause")

        self.funcs = {}
        self.funcs["--next"] = self.button_next_press
        self.funcs["--previous"] = self.button_previous_press
        self.funcs["--pp"] = self.button_pp_press

        #(Same as desktop files so there's only one string each for i18n)
        self.desc = {}
        self.desc["--next"] = _("A media-control applet (Next Track)")
        self.desc["--previous"] = _("A media-control applet (Previous Track)")
        self.desc["--pp"] = _("A media-control applet (Play/Pause)")

        #(Also same as desktop files)
        self.titles = {}
        self.titles["--next"] = _("Media Icons Next")
        self.titles["--previous"] = _("Media Icons Previous")
        self.titles["--pp"] = _("Media Icons Play/Pause")

        gtk.window_set_default_icon_name(self.icon_names[media_button_type])

        self.media_button_type = media_button_type
        self.set_icon_name(self.icon_names[media_button_type])

        self.what_app()
        self.set_tooltip_text(self.tooltips[media_button_type])

        self.popup_menu = self.create_default_menu()
        about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        self.popup_menu.append(about)

        gtk.about_dialog_set_url_hook(self.do_url, None)

        about.connect("activate", self.show_about)
        self.connect("clicked", lambda w: self.funcs[self.media_button_type]())
        self.connect("context-menu-popup", self.menu_popup)
Exemplo n.º 25
0
    def __init__(self, uid, panel_id, media_button_type):
        """
        Creating the applet's core
        """
        awn.AppletSimple.__init__(self, 'media-icon' + media_button_type[1:], \
          uid, panel_id)

        self.icon_names = {}
        self.icon_names["--next"] = "media-skip-forward"
        self.icon_names["--previous"] = "media-skip-backward"
        self.icon_names["--pp"] = "media-playback-start"

        self.tooltips = {}
        self.tooltips["--next"] = _("Next")
        self.tooltips["--previous"] = _("Previous")
        self.tooltips["--pp"] = _("Play/Pause")

        self.funcs = {}
        self.funcs["--next"] = self.button_next_press
        self.funcs["--previous"] = self.button_previous_press
        self.funcs["--pp"] = self.button_pp_press

        #(Same as desktop files so there's only one string each for i18n)
        self.desc = {}
        self.desc["--next"] = _("A media-control applet (Next Track)")
        self.desc["--previous"] = _("A media-control applet (Previous Track)")
        self.desc["--pp"] = _("A media-control applet (Play/Pause)")

        #(Also same as desktop files)
        self.titles = {}
        self.titles["--next"] = _("Media Icons Next")
        self.titles["--previous"] = _("Media Icons Previous")
        self.titles["--pp"] = _("Media Icons Play/Pause")

        gtk.window_set_default_icon_name(self.icon_names[media_button_type])

        self.media_button_type = media_button_type
        self.set_icon_name(self.icon_names[media_button_type])

        self.what_app()
        self.set_tooltip_text(self.tooltips[media_button_type])

        self.popup_menu = self.create_default_menu()
        about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        self.popup_menu.append(about)

        gtk.about_dialog_set_url_hook(self.do_url, None)

        about.connect("activate", self.show_about)
        self.connect("clicked", lambda w: self.funcs[self.media_button_type]())
        self.connect("context-menu-popup", self.menu_popup)
Exemplo n.º 26
0
    def create_hamster_window(self):
        if self.window is None:
            # load window of activity switcher and todays view
            self._gui = load_ui_file("today.ui")
            self.window = self._gui.get_object('hamster-window')
            self.window.connect("delete_event", self.on_delete_window)

            gtk.window_set_default_icon_name("hamster-time-tracker")

            self.new_name = widgets.ActivityEntry()
            self.new_name.connect("value-entered", self.on_switch_activity_clicked)
            widgets.add_hint(self.new_name, _("Activity"))
            self.get_widget("new_name_box").add(self.new_name)
            self.new_name.connect("changed", self.on_activity_text_changed)

            self.new_tags = widgets.TagsEntry()
            self.new_tags.connect("tags_selected", self.on_switch_activity_clicked)
            widgets.add_hint(self.new_tags, _("Tags"))
            self.get_widget("new_tags_box").add(self.new_tags)

            self.tag_box = widgets.TagBox(interactive = False)
            self.get_widget("tag_box").add(self.tag_box)

            self.treeview = widgets.FactTree()
            self.treeview.connect("key-press-event", self.on_todays_keys)
            self.treeview.connect("edit-clicked", self._open_edit_activity)
            self.treeview.connect("row-activated", self.on_today_row_activated)

            self.get_widget("today_box").add(self.treeview)

            # connect the accelerators
            self.accel_group = self.get_widget("accelgroup")
            self.window.add_accel_group(self.accel_group)

            self._gui.connect_signals(self)
            
            # Signal for Redmine issue combo
            self.get_widget("issue_combo").connect("changed", self.on_redmine_issue_combo_change)
            
            # Signal for Redmine arbitrary issue id entry
            self.get_widget("arbitrary_issue_id_entry").connect("changed", self.on_redmine_arbitrary_issue_id_entry_change)
            
            # Redmine combos additional setup
            cell = gtk.CellRendererText()
            self.get_widget("issue_combo").pack_start(cell, True)
            self.get_widget("issue_combo").add_attribute(cell, 'text',0)
            cell = gtk.CellRendererText()
            self.get_widget("time_activity_combo").pack_start(cell, True)
            self.get_widget("time_activity_combo").add_attribute(cell, 'text',0)
Exemplo n.º 27
0
    def __init__ (self, paths):
        assert len (paths) > 0
        self.__fields = []
        for p in paths:
            self.__fields.append (FieldData.open (p))

        self.builder = gtk.Builder ()
        #dirname = os.path.realpath (os.path.dirname (sys.argv[0]))
        dirname = os.path.dirname (sys.argv[0])
        self.builder.add_from_file (os.path.join (dirname, "show-field.glade"))

        self.builder.connect_signals (self)
        for obj in self.builder.get_objects ():
            name = gtk.Buildable.get_name (obj)
            assert name not in self.__dict__
            self.__dict__[name] = obj

        plotters = [(AmplitudePlotter, True), (FFTPlotter, False)]
        if len (self.__fields) == 2:
            plotters.append ((RelErrorPlotter, True))
        self.plotViewer = PlotViewer (plotters, self.__fields)
        self.plotViewer.onUpdateInfo (self.updateInfo)
        self.amplBox.pack_start (self.plotViewer, True, True)
        self.plotViewer.show ()

        self.pol2CB = gtk.CheckButton ("Second polarization")
        self.plotViewer.checkboxes.pack_start (self.pol2CB, False, False)
        self.plotViewer.checkboxes.reorder_child (self.pol2CB, 0)
        self.pol2CB.connect ("toggled", self.__on_pol2cb_toggled)
        self.pol2CB.show ()

        font_desc = pango.FontDescription('monospace')
        self.infoLabel.modify_font (font_desc)

        gtk.window_set_default_icon_name (gtk.STOCK_DIALOG_INFO)

        self.statusbar_cid = self.statusbar.get_context_id ("Foo bar")
        self.statusbar.push (self.statusbar_cid, "")

        self.pol = PolEntry ()
        self.pol.onUpdate (self.plotViewer.setPol)
        self.paramHBox.pack_start (self.pol)

        self.pol2 = PolEntry ()
        self.pol2.onUpdate (self.plotViewer.setPol2)
        self.paramHBox2.pack_start (self.pol2)
        self.expander2.hide ()
Exemplo n.º 28
0
    def __init__(self, paths):
        assert len(paths) > 0
        self.__fields = []
        for p in paths:
            self.__fields.append(FieldData.open(p))

        self.builder = gtk.Builder()
        #dirname = os.path.realpath (os.path.dirname (sys.argv[0]))
        dirname = os.path.dirname(sys.argv[0])
        self.builder.add_from_file(os.path.join(dirname, "show-field.glade"))

        self.builder.connect_signals(self)
        for obj in self.builder.get_objects():
            name = gtk.Buildable.get_name(obj)
            assert name not in self.__dict__
            self.__dict__[name] = obj

        plotters = [(AmplitudePlotter, True), (FFTPlotter, False)]
        if len(self.__fields) == 2:
            plotters.append((RelErrorPlotter, True))
        self.plotViewer = PlotViewer(plotters, self.__fields)
        self.plotViewer.onUpdateInfo(self.updateInfo)
        self.amplBox.pack_start(self.plotViewer, True, True)
        self.plotViewer.show()

        self.pol2CB = gtk.CheckButton("Second polarization")
        self.plotViewer.checkboxes.pack_start(self.pol2CB, False, False)
        self.plotViewer.checkboxes.reorder_child(self.pol2CB, 0)
        self.pol2CB.connect("toggled", self.__on_pol2cb_toggled)
        self.pol2CB.show()

        font_desc = pango.FontDescription('monospace')
        self.infoLabel.modify_font(font_desc)

        gtk.window_set_default_icon_name(gtk.STOCK_DIALOG_INFO)

        self.statusbar_cid = self.statusbar.get_context_id("Foo bar")
        self.statusbar.push(self.statusbar_cid, "")

        self.pol = PolEntry()
        self.pol.onUpdate(self.plotViewer.setPol)
        self.paramHBox.pack_start(self.pol)

        self.pol2 = PolEntry()
        self.pol2.onUpdate(self.plotViewer.setPol2)
        self.paramHBox2.pack_start(self.pol2)
        self.expander2.hide()
Exemplo n.º 29
0
    def _set_default_icon(self):
        # set the icon so that it doesn't flash when the window is
        # realized in Application.build_window().
        # if this isn't a themed Miro, then we use the default icon set
        ico_path = resources.share_path("icons/hicolor/24x24/apps/miro.png")
        if app.config.get(prefs.THEME_NAME) != prefs.THEME_NAME.default and app.config.get(options.WINDOWS_ICON):
            theme_ico_path = resources.theme_path(
                app.config.get(prefs.THEME_NAME), app.config.get(options.WINDOWS_ICON)
            )
            if os.path.exists(theme_ico_path):
                ico_path = theme_ico_path
                gtk.window_set_default_icon_from_file(ico_path)
        else:
            gtk.icon_theme_get_default().append_search_path(resources.share_path("icons"))
            gtk.window_set_default_icon_name("miro")

        return ico_path
Exemplo n.º 30
0
    def _set_default_icon(self):
        # set the icon so that it doesn't flash when the window is
        # realized in Application.build_window().
        # if this isn't a themed Miro, then we use the default icon set
        ico_path = resources.share_path("icons/hicolor/24x24/apps/miro.png")
        if ((app.config.get(prefs.THEME_NAME) != prefs.THEME_NAME.default
             and app.config.get(options.WINDOWS_ICON))):
            theme_ico_path = resources.theme_path(
                app.config.get(prefs.THEME_NAME),
                app.config.get(options.WINDOWS_ICON))
            if os.path.exists(theme_ico_path):
                ico_path = theme_ico_path
                gtk.window_set_default_icon_from_file(ico_path)
        else:
            gtk.icon_theme_get_default().append_search_path(
                resources.share_path('icons'))
            gtk.window_set_default_icon_name("miro")

        return ico_path
Exemplo n.º 31
0
	def __init__(self):
		
		# Default values
		self.filename= None
		self.about_dialog = None
		#self.__gobject_init__()
		# Using Gtk builder to build the application from XML code which is present in "text.glade" 			
		try :			
			builder = gtk.Builder()
	    		builder.add_from_file("text.glade")
	    	except : 
			self.error_message("Unable to load XML file: text.xml")			
			sys.exit(1)
		# connects signal
		# builder.connect_signals({ "on_window_destroy" : gtk.main_quit })
		builder.connect_signals(self)
	    	
		# get the widgets which will be referenced in callbacks
        	self.window = builder.get_object("window")
        	self.statusbar = builder.get_object("statusbar")
       		self.text_view = builder.get_object("text_view")	
		
		# sets the text view background 
		self.text_view.modify_base(gtk.STATE_NORMAL,gtk.gdk.color_parse("Black"))		
		
		# sets the text view font	        
		self.text_view.modify_font(pango.FontDescription("monospace 10"))
        	
		# sets the text colour
		self.text_view.modify_text(gtk.STATE_NORMAL,gtk.gdk.color_parse("White"))		
		
		# sets the default icon to the "texter_icon.jpeg" icon
        	gtk.window_set_default_icon_name("texter_icon.jpeg")
        	
		# setup and initialize our statusbar
        	self.statusbar_cid = self.statusbar.get_context_id("statusbar")
        	self.reset_default_status()
			
		# For Syntax Highlighting
		self.language_cats = categories[:]
        	self.languages = []
        	self.add_languages(languages)
Exemplo n.º 32
0
def main():
    gobject.threads_init()
    gtk.window_set_default_icon_name(gtk.STOCK_FILE)
    settings = gtk.settings_get_default()
    settings.props.gtk_toolbar_style = gtk.TOOLBAR_ICONS
    settings.props.gtk_toolbar_icon_size = gtk.ICON_SIZE_SMALL_TOOLBAR
    ## proxy settings
    proxies = urllib.getproxies()
    if 'http' in proxies:
        webkit_set_proxy_uri(proxies['http'])
    elif 'https' in proxies:
        webkit_set_proxy_uri(proxies['https'])
    ##
    if sys.argv[1:]:
        url = sys.argv[1]
        if os.path.exists(url):
            url = 'file://' + os.path.abspath(url)
        webbrowser = BrowserWindow(url)
    else:
        webbrowser = BrowserWindow(url = 'about:blank')
    gtk.main()
    pass
Exemplo n.º 33
0
def run(args, datadir):
    '''
    Executes the properties dialog.
    '''

    import logging

    # Support full tracing when --debug switch is passed:
    if '--debug' in args or '-d' in args:
        logging.getLogger().setLevel(logging.NOTSET)

    # Integrate DBus with GLib main loop
    from dbus.mainloop.glib import DBusGMainLoop
    DBusGMainLoop(set_as_default=True)

    # Initialize user interface
    import pygtk

    pygtk.require('2.0')

    from gettext               import gettext as _
    from gnome_lirc_properties import ui

    import gobject, gtk, gtk.gdk, os.path

    # Setup defaut properties:
    gobject.threads_init()
    gobject.set_application_name(_('Infrared Remote Control Properties'))
    gtk.window_set_default_icon_name('gnome-lirc-properties')

    # Enable thread support:
    gtk.gdk.threads_init()

    # Load the user interface:
    ui_filename = os.path.join(datadir, 'gnome-lirc-properties.ui')
    builder = gtk.Builder()
    builder.add_from_file(ui_filename)
    return ui.RemoteControlProperties(builder, datadir).run()
Exemplo n.º 34
0
def main (args):
    import gettext
    import locale
    import sys

    import pygtk; pygtk.require('2.0');

    import gtk

    import maindialog
    import lockdownappliergconf
    import config

    try:
        locale.setlocale (locale.LC_ALL, "")
    except locale.Error:
        print >> sys.stderr, "Warning: unsupported locale"
    gettext.install (config.PACKAGE, config.LOCALEDIR)

    gtk.window_set_default_icon_name ("pessulus")

    applier = lockdownappliergconf.PessulusLockdownApplierGconf ()

    if not applier.supports_normal_settings () and not applier.supports_mandatory_settings ():
        dialog = gtk.MessageDialog (type = gtk.MESSAGE_ERROR,
                                    buttons = gtk.BUTTONS_CLOSE,
                                    message_format = _("Cannot contact the GConf server"))
        dialog.format_secondary_text (_("This usually happens when running this application with 'su' instead of 'su -'.\nIf this is not the case, you can look at the output of the application to get more details."))

        # this is a dialog with no parent
        dialog.set_skip_taskbar_hint (False)
        dialog.set_title (_("Lockdown Editor"))
        dialog.run ()
        return

    dialog = maindialog.PessulusMainDialog (applier)

    gtk.main ()
Exemplo n.º 35
0
	def __init__(self, datadir, version, argv):
		self.file_path = datadir
		self.version = version
		self.editor = MenuEditor()
		gtk.window_set_default_icon_name('alacarte')
		self.tree = gtk.Builder()
		self.tree.set_translation_domain(config.GETTEXT_PACKAGE)
		self.tree.add_from_file('/usr/lib/cinnamon-menu-editor/cinnamon-menu-editor.ui')
		self.tree.connect_signals(self)
		self.setupMenuTree()
		self.setupItemTree()
		self.tree.get_object('edit_delete').set_sensitive(False)
		self.tree.get_object('edit_revert_to_original').set_sensitive(False)
		self.tree.get_object('edit_properties').set_sensitive(False)
		self.tree.get_object('move_up_button').set_sensitive(False)
		self.tree.get_object('move_down_button').set_sensitive(False)
		self.tree.get_object('new_separator_button').set_sensitive(False)
		accelgroup = gtk.AccelGroup()
		keyval, modifier = gtk.accelerator_parse('<Ctrl>Z')
		accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, self.on_mainwindow_undo)
		keyval, modifier = gtk.accelerator_parse('<Ctrl><Shift>Z')
		accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, self.on_mainwindow_redo)		
		self.tree.get_object('mainwindow').add_accel_group(accelgroup)
Exemplo n.º 36
0
   def __init__(self, applet):
      self.applet = applet
      self.size = 24
      self.menu = gtk.Menu()
      self.tooltips = gtk.Tooltips()
      self.image = gtk.Image()
      self.image.set_from_pixbuf(gtk.IconTheme.load_icon(gtk.icon_theme_get_default(), "glipper", self.size - 2, 0))
      self.tooltips.set_tip(self.applet, _("Glipper - Popup shortcut: ") + get_glipper_keybinder().get_key_combination())

      glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MARK_DEFAULT_ENTRY, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
      glipper.GCONF_CLIENT.notify_add(glipper.GCONF_MAX_ITEM_LENGTH, lambda x, y, z, a: self.update_menu(get_glipper_history().get_history()))
      
      gtk.window_set_default_icon_name("glipper")
      
      get_glipper_keybinder().connect('activated', self.on_key_combination_press)
      get_glipper_keybinder().connect('changed', self.on_key_combination_changed)
      get_glipper_history().connect('changed', self.on_history_changed)
      get_glipper_plugins_manager().load()
      get_glipper_history().load()
      get_glipper_plugins_manager().connect('menu-items-changed', self.on_plugins_menu_items_changed)
      
      self.applet.connect('size-allocate', self.on_size_allocate)
      self.applet.connect('button-press-event', self.on_clicked)
      self.applet.connect('destroy', self.on_destroy)
      
      self.applet.setup_menu_from_file (
         glipper.SHARED_DATA_DIR, "Glipper.xml",
         None, [
         ("Properties", self.on_properties),
         ("Help", self.on_help),
         ("About", self.on_about),
         ("Plugins", self.on_plugins),
         ])

      self.applet.add(self.image)
      self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR)
      self.applet.show_all()
Exemplo n.º 37
0
    def __init__(self, languagefrom="de", languageto="en"):
        gtk.StatusIcon.__init__(self)

        self._langfrom = languagefrom
        self._langto = languageto

        if libtranstray.is_installed():
            self.set_from_icon_name(self.APP_ICON)
            gtk.window_set_default_icon_name(self.get_icon_name())
        else:
            self.set_from_file("%s.svg" % self.APP_ICON)
            gtk.window_set_default_icon(self.get_pixbuf())

        self.set_visible(True)
        self.connect('activate', self._on_activate)
        self.connect('popup-menu', self._on_popup_menu)

        self._create_right_menu()

        self._nl = NetworkListener()
        #monitor the selection clipboard
        self._clip_selection = gtk.clipboard_get("PRIMARY")

        pynotify.init(self.APP_NAME)
Exemplo n.º 38
0
	def __init__(self):
		self.engine = ContactEngine.ContactDB()

		gtk.window_set_default_icon_name("address-book")
		self.widgets = gtk.glade.XML(find_path("arkadas.glade"))

		signals = {}
		for attr in dir(self.__class__):
			signals[attr] = getattr(self, attr)
		self.widgets.signal_autoconnect(signals)

		self.tooltips = gtk.Tooltips()
		self.clipboard = gtk.Clipboard()
		self.load_fallbackprefs()
		self.load_prefs()
		self.load_widgets()
		self.build_list()
		self.build_table()
		self.build_prefs()

		self.window.set_app_paintable(True)
		self.window.show_all()

		def load_db():
			self.engine.load(os.path.join(self.data_dir, "contacts.db"))
			self.clear()
			self.load_groups()

		gobject.idle_add(load_db)
		
		args = sys.argv[1:]
		if args and HAVE_VOBJECT:
			if question(_("Import contacts to the contactlist?"), self.window):
				for arg in args:
					for contact in import_vcard(arg, self.engine, self.photo_dir):
						self.add_to_list(contact, True)
Exemplo n.º 39
0
    def __init__(self):
        gtk.Window.__init__(self)
        _logger.debug("Entered in __init__")
        self.keyboard = None
        self.set_accept_focus(False)
        self.grab_remove()
        self.set_keep_above(True)

        gtk.window_set_default_icon_name("onboard")
        self.set_title(_("Onboard"))

        config.geometry_notify_add(self.resize)
        self.set_default_size(config.keyboard_width, config.keyboard_height)
        config.position_notify_add(self.move)
        self.move(config.x_position, config.y_position)

        self.connect("window-state-event", self.cb_state_change)

        self.icp = IconPalette()
        self.icp.connect_object("activated", gtk.Window.deiconify, self)

        self.show_all()
        if config.start_minimized: self.iconify()
        _logger.debug("Leaving __init__")
                                                  month=selected_date.month,
                                                  day=selected_date.day)
        fact.end_time = fact.end_time.replace(year=selected_date.year,
                                              month=selected_date.month,
                                              day=selected_date.day)
        new_id = runtime.storage.add_fact(fact)

        # You can do that?! - copy/pasted an activity
        trophies.unlock("can_do_that")

        if new_id:
            self.fact_tree.select_fact(new_id)


if __name__ == "__main__":
    gtk.window_set_default_icon_name("hamster-applet")
    window = gtk.Window()
    window.set_title("Hamster - reports")
    window.set_size_request(800, 600)
    overview = OverviewBox()
    window.add(overview)
    window.connect("delete_event", lambda *args: gtk.main_quit())
    window.show_all()

    start_date = dt.date.today() - dt.timedelta(days=30)
    end_date = dt.date.today()
    facts = runtime.storage.get_facts(start_date, end_date)
    overview.search(start_date, end_date, facts)

    gtk.main()
Exemplo n.º 41
0
    def __init__(self, th, port, server):
        self.th = th
        self.port = port
        self.server = server  # we need this to quit the server when closing main window
        gtk.window_set_default_icon_name('thawab')
        gtk.Window.__init__(self)
        self.set_title(_('Thawab'))
        self.set_default_size(600, 480)

        self.import_w = None
        self.fixes_w = None
        self.ix_w = ThIndexerWindow(self)

        vb = gtk.VBox(False, 0)
        self.add(vb)

        tools = gtk.Toolbar()
        vb.pack_start(tools, False, False, 2)

        self._content = ContentPane("http://127.0.0.1:%d/" % port, _("Thawab"))
        vb.pack_start(self._content, True, True, 2)

        b = gtk.ToolButton(gtk.STOCK_NEW)
        b.connect('clicked', lambda bb: self._content.new_tab())
        b.set_tooltip_text(_("Open a new tab"))
        tools.insert(b, -1)

        # TODO: add navigation buttons (back, forward ..etc.) and zoom buttons
        tools.insert(gtk.SeparatorToolItem(), -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_CONVERT, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Import"))
        b.set_tooltip_text(_("Import .bok files"))
        b.connect('clicked', self.import_cb)
        tools.insert(b, -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_FIND_AND_REPLACE, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Index"))
        b.set_is_important(True)
        b.set_tooltip_text(_("Create search index"))
        b.connect('clicked', lambda *a: self.ix_w.show_all())
        tools.insert(b, -1)

        tools.insert(gtk.SeparatorToolItem(), -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_ZOOM_IN, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Zoom in"))
        b.set_is_important(True)
        b.set_tooltip_text(_("Makes things appear bigger"))
        b.connect('clicked', lambda a: self._do_in_current_view("zoom_in"))
        tools.insert(b, -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_ZOOM_OUT, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Zoom out"))
        b.set_tooltip_text(_("Makes things appear smaller"))
        b.connect('clicked', lambda a: self._do_in_current_view("zoom_out"))
        tools.insert(b, -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_ZOOM_100, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("1:1 Zoom"))
        b.set_tooltip_text(_("restore original zoom factor"))
        b.connect('clicked',
                  lambda a: self._do_in_current_view("set_zoom_level", 1.0))
        tools.insert(b, -1)

        tools.insert(gtk.SeparatorToolItem(), -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Fixes"))
        b.set_is_important(True)
        b.set_tooltip_text(_("Misc Fixes"))
        b.connect('clicked', self.fixes_cb)
        tools.insert(b, -1)

        tools.insert(gtk.SeparatorToolItem(), -1)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_HELP, gtk.ICON_SIZE_BUTTON)
        b = gtk.ToolButton(icon_widget=img, label=_("Help"))
        b.set_tooltip_text(_("Show user manual"))
        b.connect(
            'clicked', lambda a: self._content.new_tab(
                "http://127.0.0.1:%d/_theme/manual/manual.html" % port))
        tools.insert(b, -1)

        self._content.new_tab()

        self.connect("delete_event", self.quit)
        self.drag_dest_set(gtk.DEST_DEFAULT_ALL, targets_l, (1 << 5) - 1)
        self.connect('drag-data-received', self.drop_data_cb)

        self.show_all()
Exemplo n.º 42
0
    config.askpass_package = askpass_package

    import virtManager.guidiff
    virtManager.guidiff.is_gui(True)

    # Now we've got basic environment up & running we can fork
    if not options.nofork and not options.debug:
        drop_tty()
        drop_stdio()

        # Ignore SIGHUP, otherwise a serial console closing drops the whole app
        signal.signal(signal.SIGHUP, signal.SIG_IGN)

    from virtManager.engine import vmmEngine

    gtk.window_set_default_icon_name(appname)

    if options.show and options.uri == None:
        raise optparse.OptionValueError("can't use --show-* options "
                                        "without --connect")

    engine = vmmEngine()

    if not options.nodbus:
        try:
            managerObj = dbus_config(engine)
            if managerObj:
                # yes, we exit completely now - remote service is in charge
                logging.debug("Connected to already running instance.")
                show_remote(managerObj, options.show, options.uri,
                            options.uuid)
Exemplo n.º 43
0
                                                  month=selected_date.month,
                                                  day=selected_date.day)
        fact.end_time = fact.end_time.replace(year=selected_date.year,
                                              month=selected_date.month,
                                              day=selected_date.day)
        new_id = runtime.storage.add_fact(fact)

        # You can do that?! - copy/pasted an activity
        trophies.unlock("can_do_that")

        if new_id:
            self.fact_tree.select_fact(new_id)


if __name__ == "__main__":
    gtk.window_set_default_icon_name("hamster-time-tracker")
    window = gtk.Window()
    window.set_title("Hamster - reports")
    window.set_size_request(800, 600)
    overview = OverviewBox()
    window.add(overview)
    window.connect("delete_event", lambda *args: gtk.main_quit())
    window.show_all()

    start_date = dt.date.today() - dt.timedelta(days=30)
    end_date = dt.date.today()
    facts = runtime.storage.get_facts(start_date, end_date)
    overview.search(start_date, end_date, facts)

    gtk.main()
Exemplo n.º 44
0
SAMPLE_RATES = [8000, 11025, 22050, 32000, 44100, 48000, 96000, 192000]

PLAYBACK_BACKENDS = [(_("Autodetect"), "autoaudiosink"),
                     (_("Use GNOME Settings"), "gconfaudiosink"),
                     ("ALSA", "alsasink"), ("OSS", "osssink"),
                     ("JACK", "jackaudiosink"), ("PulseAudio", "pulsesink"),
                     ("Direct Sound", "directsoundsink"),
                     ("Core Audio", "osxaudiosink")]

CAPTURE_BACKENDS = [(_("GNOME Settings"), "gconfaudiosrc"),
                    ("ALSA", "alsasrc"), ("OSS", "osssrc"),
                    ("JACK", "jackaudiosrc"), ("PulseAudio", "pulsesrc"),
                    ("Direct Sound", "dshowaudiosrc"),
                    ("Core Audio", "osxaudiosrc")]
""" Default Instruments """
DEFAULT_INSTRUMENTS = []
""" init Settings """
settings = Settings()
""" Cache Instruments """
gobject.idle_add(idleCacheInstruments)

gobject.set_application_name(_("Jokosher Audio Editor"))
gobject.set_prgname(LOCALE_APP)
gtk.window_set_default_icon_name("jokosher")
# environment variable for pulseaudio type
os.environ["PULSE_PROP_media.role"] = "production"

# I have decided that Globals.py is a boring source file. So, here is a little
# joke. What does the tax office and a pelican have in common? They can both stick
# their bills up their arses. Har har har.
Exemplo n.º 45
0
from glchess.defaults import *
import LaunchpadIntegration

# Stop PyGTK from catching exceptions
os.environ['PYGTK_FATAL_EXCEPTIONS'] = '1'

import glchess.config
import glchess.ui
import glchess.chess.board
import dialogs
import log
import chessview
import network

# Mark all windows with our icon
gtk.window_set_default_icon_name(ICON_NAME)


def loadUIFile(name, root=None):
    ui = gtk.Builder()
    ui.set_translation_domain(DOMAIN)
    ui.add_from_file(os.path.join(UI_DIR, name))
    return ui


class GLibTimer(glchess.ui.Timer):
    """
    """

    # FIXME: time.time() is _not_ monotonic so this is not really safe at all...
Exemplo n.º 46
0
        for opt, args in opts:
            if opt in ("-w", "--window"):
                standalone = True
            elif opt in ("-s", "--start"):
                start_window = args
            elif opt in ("-t", "--trace-sql"):
                runtime.trace_sql = True
                
            
    except getopt.GetoptError:
        usage()
        print "Starting nevertheless, because applet dies otherwise (TODO)"


    gtk.window_set_default_icon_name("hamster-applet")

    if standalone:
        gnome.init(defs.PACKAGE, defs.VERSION)

        app = gtk.Window(gtk.WINDOW_TOPLEVEL)
        app.set_title(_(u"Time Tracker"))
    
        applet = gnomeapplet.Applet()
        applet_factory(applet, None)
        applet.reparent(app)
        app.show_all()

        gtk.main()

    elif start_window:
Exemplo n.º 47
0
 def set_default_icon_name(cls, icon_name):
     window_set_default_icon_name(icon_name)
Exemplo n.º 48
0
    def __init__(self, exaile):
        """
            Initializes the GUI

            @param exaile: The Exaile instance
        """
        from xlgui import icons, main, panels, tray, progress

        gtk.gdk.set_program_class("Exaile")

        self.exaile = exaile
        self.first_removed = False
        self.tray_icon = None

        self.builder = gtk.Builder()
        self.builder.add_from_file(xdg.get_data_path('ui', 'main.ui'))
        self.progress_box = self.builder.get_object('progress_box')
        self.progress_manager = progress.ProgressManager(self.progress_box)

        for name in ('exaile', 'exaile-pause', 'exaile-play', 'folder-music',
                     'audio-x-generic', 'office-calendar', 'extension',
                     'music-library', 'artist', 'genre'):
            icons.MANAGER.add_icon_name_from_directory(
                name, xdg.get_data_path('images'))
        gtk.window_set_default_icon_name('exaile')

        for name in ('dynamic', 'repeat', 'shuffle'):
            icon_name = 'media-playlist-%s' % name
            icons.MANAGER.add_icon_name_from_directory(
                icon_name, xdg.get_data_path('images'))

        logger.info("Using GTK+ %s" % '.'.join(map(str, gtk.gtk_version)))

        logger.info("Loading main window...")
        self.main = main.MainWindow(self, self.builder, exaile.collection)

        if self.exaile.options.StartMinimized:
            self.main.window.iconify()

        self.play_toolbar = self.builder.get_object('play_toolbar')

        panel_notebook = self.builder.get_object('panel_notebook')
        self.panel_notebook = panels.PanelNotebook(exaile, self)

        self.device_panels = {}

        # add the device panels
        for device in self.exaile.devices.list_devices():
            if device.connected:
                self.add_device_panel(None, None, device)

        logger.info("Connecting panel events...")
        self.main._connect_panel_events()

        guiutil.gtk_widget_replace(panel_notebook, self.panel_notebook)

        if settings.get_option('gui/use_tray', False):
            self.tray_icon = tray.TrayIcon(self.main)

        from xl import event
        event.add_callback(self.add_device_panel, 'device_connected')
        event.add_callback(self.remove_device_panel, 'device_disconnected')
        event.add_callback(self.on_gui_loaded, 'gui_loaded')

        logger.info("Done loading main window...")
        Main._main = self
Exemplo n.º 49
0
    def __init__(self, conduitApplication, moduleManager, typeConverter,
                 syncManager):
        """
        Constructs the mainwindow. Throws up a splash screen to cover 
        the most time consuming pieces
        """
        #add some additional dirs to the icon theme search path so that
        #modules can provider their own icons
        icon_dirs = [
            conduit.SHARED_DATA_DIR, conduit.SHARED_MODULE_DIR,
            os.path.join(conduit.SHARED_DATA_DIR, "icons"),
            os.path.join(conduit.USER_DIR, "modules")
        ]
        for i in icon_dirs:
            gtk.icon_theme_get_default().prepend_search_path(i)
        gtk.window_set_default_icon_name("conduit")

        signals = {
            "on_mainwindow_delete": self.on_window_closed,
            "on_mainwindow_state_event": self.on_window_state_event,
            "on_synchronize_activate": self.on_synchronize_all_clicked,
            "on_cancel_activate": self.on_cancel_all_clicked,
            "on_quit_activate": self.on_window_closed,
            "on_clear_canvas_activate": self.on_clear_canvas,
            "on_preferences_activate": self.on_conduit_preferences,
            "on_about_activate": self.on_about_conduit,
            "on_contents_activate": self.on_help,
            "on_save1_activate": self.save_settings,
        }

        self.conduitApplication = conduitApplication
        self.builder = _GtkBuilderWrapper(conduit.SHARED_DATA_DIR,
                                          "conduit.ui")
        self.builder.connect_signals(signals)

        #type converter and sync manager
        self.type_converter = typeConverter
        self.sync_manager = syncManager

        #Initialize the mainWindow
        self.mainWindow = self.builder.get_object("MainWindow")
        #Enable RGBA colormap
        if conduit.GLOBALS.settings.get("gui_use_rgba_colormap") == True:
            screen = self.mainWindow.get_screen()
            colormap = screen.get_rgba_colormap()
            if colormap:
                gtk.widget_set_default_colormap(colormap)
        self.mainWindow.set_position(gtk.WIN_POS_CENTER)
        title = "Conduit"
        if conduit.IS_DEVELOPMENT_VERSION:
            title = title + _(" - %s (Development Version)") % conduit.VERSION
        if not conduit.IS_INSTALLED:
            title = title + _(" - Running Uninstalled")
        self.mainWindow.set_title(title)

        #Configure canvas
        self.canvasSW = self.builder.get_object("canvasScrolledWindow")
        self.hpane = self.builder.get_object("hpaned1")

        #start up the canvas
        msg = MsgArea.MsgAreaController()
        self.builder.get_object("mainVbox").pack_start(msg, False, False)
        self.canvas = Canvas.Canvas(parentWindow=self.mainWindow,
                                    typeConverter=self.type_converter,
                                    syncManager=self.sync_manager,
                                    gtkbuilder=self.builder,
                                    msg=msg)
        self.canvasSW.add(self.canvas)
        self.canvas.connect('drag-drop', self.drop_cb)
        self.canvas.connect("drag-data-received", self.drag_data_received_data)

        # Populate the tree model
        self.dataproviderTreeModel = Tree.DataProviderTreeModel()
        dataproviderScrolledWindow = self.builder.get_object("scrolledwindow2")
        self.dataproviderTreeView = Tree.DataProviderTreeView(
            self.dataproviderTreeModel)
        dataproviderScrolledWindow.add(self.dataproviderTreeView)

        #Set up the expander used for resolving sync conflicts
        self.conflictResolver = ConflictResolver.ConflictResolver(self.builder)

        #Preferences manager
        self.preferences = PreferencesWindow(self.builder)

        #add the preconfigured Conduit menu
        if conduit.GLOBALS.settings.get("gui_show_hints"):
            self.preconfiguredConduitsMenu = _PreconfiguredConduitMenu()
            self.builder.get_object("file_menu").insert(
                self.preconfiguredConduitsMenu.item, 3)
        else:
            self.preconfiguredConduitsMenu = None

        #if running a development version, add some developer specific links
        #to the help menu
        if conduit.IS_DEVELOPMENT_VERSION:
            helpMenu = self.builder.get_object("help_menu")
            developersMenuItem = gtk.ImageMenuItem(_("Developers"))
            developersMenuItem.set_image(
                gtk.image_new_from_icon_name("applications-development",
                                             gtk.ICON_SIZE_MENU))
            developersMenu = gtk.Menu()
            developersMenuItem.set_submenu(developersMenu)
            helpMenu.prepend(developersMenuItem)
            for name, url in DEVELOPER_WEB_LINKS:
                item = gtk.ImageMenuItem(_(name))
                item.set_image(
                    gtk.image_new_from_icon_name("applications-internet",
                                                 gtk.ICON_SIZE_MENU))
                item.connect("activate", self.on_developer_menu_item_clicked,
                             _(name), url)
                developersMenu.append(item)

        #final GUI setup
        self.cancelSyncButton = self.builder.get_object('cancel')
        self.hpane.set_position(
            conduit.GLOBALS.settings.get("gui_hpane_postion"))
        self.dataproviderTreeView.set_expand_rows()
        self.window_state = 0
        log.info("Main window constructed  (thread: %s)" % thread.get_ident())
Exemplo n.º 50
0
 def __init__(self, controller, model):
     self._controller = controller
     self._model = model
     gtk.window_set_default_icon_name("deskbar-applet")
Exemplo n.º 51
0
from subscription_manager.gui.about import AboutDialog
from subscription_manager.gui.allsubs import AllSubscriptionsTab
from subscription_manager.gui.importsub import ImportSubDialog
from subscription_manager.gui.installedtab import InstalledProductsTab
from subscription_manager.gui.mysubstab import MySubscriptionsTab
from subscription_manager.gui.preferences import PreferencesDialog
from subscription_manager.gui.utils import handle_gui_exception, linkify
from subscription_manager.gui.reposgui import RepositoriesDialog
from subscription_manager.overrides import Overrides

_ = gettext.gettext

gettext.textdomain("rhsm")

gtk.glade.bindtextdomain("rhsm")
gtk.window_set_default_icon_name("subscription-manager")

log = logging.getLogger('rhsm-app.' + __name__)

cfg = config.initConfig()

ONLINE_DOC_URL_TEMPLATE = "https://access.redhat.com/knowledge/docs/Red_Hat_Subscription_Management/?locale=%s"
ONLINE_DOC_FALLBACK_URL = "https://access.redhat.com/knowledge/docs/Red_Hat_Subscription_Management/"


class Backend(object):
    """
    Wrapper for sharing UEP connections to Candlepin.

    Reference to a Backend object will be passed around UI components, so
    the UEP connection it contains can be modified/recreated and all
Exemplo n.º 52
0
def main():
    # When changing this, make sure to update configure.ac as well
    if sys.version_info < (2, 6, 1):
        message = "Reinteract requires Python 2.6.1 or newer"
        print >> sys.stderr, message
        try:
            dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK,
                                       type=gtk.MESSAGE_ERROR,
                                       message_format=message)
            dialog.run()
        finally:
            sys.exit(1)

    # When launched from the finder on OS X, the command line will have a
    # -psx (process serial number) argument. Strip that out.
    sys.argv = filter(lambda x: not x.startswith("-psn"), sys.argv)

    parser = OptionParser()
    parser.add_option("-u",
                      "--ui",
                      choices=("standard", "mini"),
                      default="standard",
                      help="the user interface mode (standard or mini)")
    parser.add_option("-d",
                      "--debug",
                      action="store_true",
                      help="enable internal debug messages")

    options, args = parser.parse_args()

    if options.debug:
        logging.basicConfig(level=logging.DEBUG)

    global_settings.mini_mode = options.ui == "mini"

    user_ext_path = os.path.expanduser(
        os.path.join('~', '.reinteract', 'modules'))
    if os.path.exists(user_ext_path):
        sys.path[0:0] = [user_ext_path]

    gtk.window_set_default_icon_name("reinteract")
    glib.set_application_name("Reinteract")

    if len(args) > 0:
        if sys.platform == 'win32':
            args = [a.decode("mbcs") for a in args]
        else:
            args = [a.decode("UTF-8") for a in args]

        if options.ui == "standard":
            for arg in args:
                application.open_path(os.path.abspath(arg))
            if len(application.windows) == 0:  # nothing opened successfully
                sys.exit(1)
        else:  # mini-mode, can specify one notebook
            if len(args) > 1:
                print >> sys.stderr, "Ignoring extra command line arguments."

            absolute = os.path.abspath(args[0].decode("UTF-8"))

            # We look to see if we can find the specified notebook so that we can
            # produce a good error message instead of opening a worksheet window
            notebook_path, relative = application.find_notebook_path(absolute)
            if not notebook_path:
                if os.path.isdir(absolute):
                    error_message = "'%s' is not a Reinteract notebook" % args[
                        0]
                else:
                    error_message = "'%s' is not inside a Reinteract notebook" % args[
                        0]

                dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK,
                                           type=gtk.MESSAGE_ERROR,
                                           message_format=error_message)
                dialog.run()
                sys.exit(1)

            if not application.open_path(absolute):
                sys.exit(1)
    else:
        recent_notebooks = application.state.get_recent_notebooks()
        window = None
        for notebook in recent_notebooks:
            notebook_dir = notebook.path
            try:
                window = application.open_notebook(notebook_dir)
            except OSError:
                pass
            else:
                break
        if window is None:
            notebook_dir = os.path.expanduser(
                os.path.join(global_settings.notebooks_dir, "Main"))
            if not os.path.exists(notebook_dir):
                window = application.create_notebook(
                    notebook_dir,
                    description=
                    "Notebook for scratch work.\nCreate worksheets here if they are not part of a larger project, or for quick experiments."
                )
            else:
                window = application.open_notebook(notebook_dir)

        # This really should be a more general check for "is writeable"
        if notebook_dir != global_settings.examples_dir:
            window.add_initial_worksheet()

    gtk.main()
Exemplo n.º 53
0
    def __init__(self):
        gladefile = paths.ui_dir("meldapp.glade")
        gtk.window_set_default_icon_name("icon")
        if getattr(gobject, "pygobject_version", ()) >= (2, 16, 0):
            gobject.set_application_name("Meld")
        gnomeglade.Component.__init__(self, gladefile, "meldapp")
        self.prefs = MeldPreferences()

        actions = (
            ("FileMenu", None, _("_File")),
            ("New", gtk.STOCK_NEW, _("_New..."), "<control>N",
             _("Start a new comparison"), self.on_menu_file_new_activate),
            ("Save", gtk.STOCK_SAVE, None, None, _("Save the current file"),
             self.on_menu_save_activate),
            ("SaveAs", gtk.STOCK_SAVE_AS, None, "<control><shift>S",
             "Save the current file with a different name",
             self.on_menu_save_as_activate),
            ("Close", gtk.STOCK_CLOSE, None, None, _("Close the current file"),
             self.on_menu_close_activate),
            ("Quit", gtk.STOCK_QUIT, None, None, _("Quit the program"),
             self.on_menu_quit_activate),
            ("EditMenu", None, _("_Edit")),
            ("Undo", gtk.STOCK_UNDO, None, "<control>Z",
             _("Undo the last action"), self.on_menu_undo_activate),
            ("Redo", gtk.STOCK_REDO, None, "<control><shift>Z",
             _("Redo the last undone action"), self.on_menu_redo_activate),
            ("Cut", gtk.STOCK_CUT, None, None, _("Cut the selection"),
             self.on_menu_cut_activate),
            ("Copy", gtk.STOCK_COPY, None, None, _("Copy the selection"),
             self.on_menu_copy_activate),
            ("Paste", gtk.STOCK_PASTE, None, None, _("Paste the clipboard"),
             self.on_menu_paste_activate),
            ("Find", gtk.STOCK_FIND, None, None, _("Search for text"),
             self.on_menu_find_activate),
            ("FindNext", None, _("Find Ne_xt"), "<control>G",
             _("Search forwards for the same text"),
             self.on_menu_find_next_activate),
            ("Replace",
             gtk.STOCK_FIND_AND_REPLACE, _("_Replace"), "<control>H",
             _("Find and replace text"), self.on_menu_replace_activate),
            ("Down", gtk.STOCK_GO_DOWN, None, "<control>D",
             _("Go to the next difference"), self.on_menu_edit_down_activate),
            ("Up", gtk.STOCK_GO_UP, None, "<control>E",
             _("Go to the previous difference"),
             self.on_menu_edit_up_activate),
            ("Preferences", gtk.STOCK_PREFERENCES, _("Prefere_nces"), None,
             _("Configure the application"),
             self.on_menu_preferences_activate),
            ("ViewMenu", None, _("_View")),
            ("FileStatus", None, _("File status")),
            ("VcStatus", None, _("Version status")),
            ("FileFilters", None, _("File filters")),
            ("Stop", gtk.STOCK_STOP, None, "Escape",
             _("Stop the current action"), self.on_toolbar_stop_clicked),
            ("Refresh", gtk.STOCK_REFRESH, None, "<control>R",
             _("Refresh the view"), self.on_menu_refresh_activate),
            ("Reload", gtk.STOCK_REFRESH, _("Reload"), "<control><shift>R",
             _("Reload the comparison"), self.on_menu_reload_activate),
            ("HelpMenu", None, _("_Help")),
            ("Help", gtk.STOCK_HELP, _("_Contents"), "F1",
             _("Open the Meld manual"), self.on_menu_help_activate),
            ("BugReport", gtk.STOCK_DIALOG_WARNING, _("Report _Bug"), None,
             _("Report a bug in Meld"), self.on_menu_help_bug_activate),
            ("About", gtk.STOCK_ABOUT, None, None, _("About this program"),
             self.on_menu_about_activate),
        )
        toggleactions = (("Fullscreen", None, _("Full Screen"), "F11",
                          _("View the comparison in full screen"),
                          self.on_action_fullscreen_toggled, False),
                         ("ToolbarVisible", None, _("_Toolbar"), None,
                          _("Show or hide the toolbar"),
                          self.on_menu_toolbar_toggled,
                          self.prefs.toolbar_visible),
                         ("StatusbarVisible", None, _("_Statusbar"), None,
                          _("Show or hide the statusbar"),
                          self.on_menu_statusbar_toggled,
                          self.prefs.statusbar_visible))
        ui_file = paths.ui_dir("meldapp-ui.xml")
        self.actiongroup = gtk.ActionGroup('MainActions')
        self.actiongroup.set_translation_domain("meld")
        self.actiongroup.add_actions(actions)
        self.actiongroup.add_toggle_actions(toggleactions)
        self.ui = gtk.UIManager()
        self.ui.insert_action_group(self.actiongroup, 0)
        self.ui.add_ui_from_file(ui_file)
        self.ui.connect("connect-proxy", self._on_uimanager_connect_proxy)
        self.ui.connect("disconnect-proxy",
                        self._on_uimanager_disconnect_proxy)

        for menuitem in ("Save", "Undo"):
            self.actiongroup.get_action(menuitem).props.is_important = True
        self.widget.add_accel_group(self.ui.get_accel_group())
        self.menubar = self.ui.get_widget('/Menubar')
        self.toolbar = self.ui.get_widget('/Toolbar')
        self.appvbox.pack_start(self.menubar, expand=False)
        self.appvbox.pack_start(self.toolbar, expand=False)
        # TODO: should possibly use something other than doc_status
        self._menu_context = self.doc_status.get_context_id("Tooltips")
        self.statusbar = MeldStatusBar(self.task_progress, self.task_status,
                                       self.doc_status)
        self.widget.drag_dest_set(
            gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT
            | gtk.DEST_DEFAULT_DROP, [('text/uri-list', 0, 0)],
            gtk.gdk.ACTION_COPY)
        if gnomevfs_available:
            self.widget.connect('drag_data_received',
                                self.on_widget_drag_data_received)
        self.toolbar.set_style(self.prefs.get_toolbar_style())
        self.toolbar.props.visible = self.prefs.toolbar_visible
        self.status_box.props.visible = self.prefs.statusbar_visible
        self.prefs.notify_add(self.on_preference_changed)
        self.idle_hooked = 0
        self.scheduler = task.LifoScheduler()
        self.scheduler.connect("runnable", self.on_scheduler_runnable)
        self.widget.set_default_size(self.prefs.window_size_x,
                                     self.prefs.window_size_y)
        self.ui.ensure_update()
        self.widget.show()
        self.widget.connect('focus_in_event', self.on_focus_change)
        self.widget.connect('focus_out_event', self.on_focus_change)
Exemplo n.º 54
0
            rightWidget.hide_all()
            self.LeftPane.remove(leftWidget)
            self.RightPane.remove(rightWidget)
            if self.CurrentPage != self.MainPage:
                leftWidget.destroy()
                rightWidget.destroy()

        self.LeftPane.pack_start(page.LeftWidget, True, True)
        self.RightPane.pack_start(page.RightWidget, True, True)
        self.CurrentPage = page
        self.show_all()

    def BackToMain(self, widget):
        self.SetPage(self.MainPage)
        self.MainPage.filterEntry.grab_focus()

    def RefreshPage(self, updatedPlugin):
        currentPage = self.CurrentPage

        if isinstance(currentPage, PluginPage) and currentPage.Plugin:
            for basePlugin in updatedPlugin.GetExtensionBasePlugins():
                # If updatedPlugin is an extension plugin and a base plugin
                # is currently being displayed, then update its current page
                if currentPage.Plugin.Name == basePlugin.Name:
                    if currentPage.CheckDialogs(basePlugin, self):
                        currentPage.RefreshPage(basePlugin, self)
                    break


gtk.window_set_default_icon_name('ccsm')
Exemplo n.º 55
0
Arquivo: UI.py Projeto: nzjrs/conduit
    def __init__(self, conduitApplication, moduleManager, typeConverter, syncManager):
        """
        Constructs the mainwindow. Throws up a splash screen to cover 
        the most time consuming pieces
        """
        #add some additional dirs to the icon theme search path so that
        #modules can provider their own icons
        icon_dirs = [
                    conduit.SHARED_DATA_DIR,
                    conduit.SHARED_MODULE_DIR,
                    os.path.join(conduit.SHARED_DATA_DIR,"icons"),
                    os.path.join(conduit.USER_DIR, "modules")
                    ]
        for i in icon_dirs:                    
            gtk.icon_theme_get_default().prepend_search_path(i)
        gtk.window_set_default_icon_name("conduit")

        signals = { 
                "on_mainwindow_delete" : self.on_window_closed,
                "on_mainwindow_state_event" : self.on_window_state_event,
                "on_synchronize_activate" : self.on_synchronize_all_clicked,
                "on_cancel_activate" : self.on_cancel_all_clicked,  
                "on_quit_activate" : self.on_window_closed,
                "on_clear_canvas_activate" : self.on_clear_canvas,
                "on_preferences_activate" : self.on_conduit_preferences,
                "on_about_activate" : self.on_about_conduit,
                "on_contents_activate" : self.on_help,
                "on_save1_activate" : self.save_settings,
                }

        self.conduitApplication = conduitApplication
        self.builder = _GtkBuilderWrapper(conduit.SHARED_DATA_DIR, "conduit.ui")
        self.builder.connect_signals(signals)

        #type converter and sync manager
        self.type_converter = typeConverter
        self.sync_manager = syncManager
        
        #Initialize the mainWindow
        self.mainWindow = self.builder.get_object("MainWindow")
        #Enable RGBA colormap
        if conduit.GLOBALS.settings.get("gui_use_rgba_colormap") == True:
            screen = self.mainWindow.get_screen()
            colormap = screen.get_rgba_colormap()
            if colormap:
                gtk.widget_set_default_colormap(colormap)
        self.mainWindow.set_position(gtk.WIN_POS_CENTER)
        title = "Conduit"
        if conduit.IS_DEVELOPMENT_VERSION:
            title = title + _(" - %s (Development Version)") % conduit.VERSION
        if not conduit.IS_INSTALLED:
            title = title + _(" - Running Uninstalled")
        self.mainWindow.set_title(title)

        #Configure canvas
        self.canvasSW = self.builder.get_object("canvasScrolledWindow")
        self.hpane = self.builder.get_object("hpaned1")

        #start up the canvas
        msg = MsgArea.MsgAreaController()
        self.builder.get_object("mainVbox").pack_start(msg, False, False)
        self.canvas = Canvas.Canvas(
                        parentWindow=self.mainWindow,
                        typeConverter=self.type_converter,
                        syncManager=self.sync_manager,
                        gtkbuilder=self.builder,
                        msg=msg
                        )
        self.canvasSW.add(self.canvas)
        self.canvas.connect('drag-drop', self.drop_cb)
        self.canvas.connect("drag-data-received", self.drag_data_received_data)
        
        # Populate the tree model
        self.dataproviderTreeModel = Tree.DataProviderTreeModel() 
        dataproviderScrolledWindow = self.builder.get_object("scrolledwindow2")
        self.dataproviderTreeView = Tree.DataProviderTreeView(self.dataproviderTreeModel)
        dataproviderScrolledWindow.add(self.dataproviderTreeView)

        #Set up the expander used for resolving sync conflicts
        self.conflictResolver = ConflictResolver.ConflictResolver(self.builder)

        #Preferences manager
        self.preferences = PreferencesWindow(self.builder)
        
        #add the preconfigured Conduit menu
        if conduit.GLOBALS.settings.get("gui_show_hints"):
            self.preconfiguredConduitsMenu = _PreconfiguredConduitMenu()
            self.builder.get_object("file_menu").insert(self.preconfiguredConduitsMenu.item, 3)
        else:
            self.preconfiguredConduitsMenu = None

        #if running a development version, add some developer specific links
        #to the help menu
        if conduit.IS_DEVELOPMENT_VERSION:
            helpMenu = self.builder.get_object("help_menu")
            developersMenuItem = gtk.ImageMenuItem(_("Developers"))
            developersMenuItem.set_image(
                                gtk.image_new_from_icon_name(
                                        "applications-development",
                                        gtk.ICON_SIZE_MENU))
            developersMenu = gtk.Menu()
            developersMenuItem.set_submenu(developersMenu)
            helpMenu.prepend(developersMenuItem)
            for name,url in DEVELOPER_WEB_LINKS:
                item = gtk.ImageMenuItem(_(name))
                item.set_image(
                        gtk.image_new_from_icon_name(
                                "applications-internet",
                                gtk.ICON_SIZE_MENU))
                item.connect("activate",self.on_developer_menu_item_clicked,_(name),url)
                developersMenu.append(item)

        #final GUI setup
        self.cancelSyncButton = self.builder.get_object('cancel')
        self.hpane.set_position(conduit.GLOBALS.settings.get("gui_hpane_postion"))
        self.dataproviderTreeView.set_expand_rows()
        self.window_state = 0                
        log.info("Main window constructed  (thread: %s)" % thread.get_ident())
Exemplo n.º 56
0
    def __init__(self, exaile):
        """
            Initializes the GUI

            @param exaile: The Exaile instance
        """
        from xlgui import main, panel, tray, progress
        from xlgui.panel import collection, radio, playlists, files

        gtk.gdk.set_program_class("Exaile")

        self.exaile = exaile
        self.first_removed = False
        self.tray_icon = None
        self.panels = {}
        self.builder = gtk.Builder()
        self.builder.add_from_file(xdg.get_data_path("ui/main.ui"))
        self.progress_box = self.builder.get_object('progress_box')
        self.progress_manager = progress.ProgressManager(self.progress_box)

        icons.MANAGER.add_icon_name_from_directory('exaile',
                                                   xdg.get_data_path('images'))
        gtk.window_set_default_icon_name('exaile')
        icons.MANAGER.add_icon_name_from_directory('exaile-pause',
                                                   xdg.get_data_path('images'))
        icons.MANAGER.add_icon_name_from_directory('exaile-play',
                                                   xdg.get_data_path('images'))

        for name in ('dynamic', 'repeat', 'shuffle'):
            icon_name = 'media-playlist-%s' % name
            icons.MANAGER.add_icon_name_from_directory(
                icon_name, xdg.get_data_path('images'))

        logger.info("Loading main window...")
        self.main = main.MainWindow(self, self.builder, exaile.collection,
                                    exaile.player, exaile.queue,
                                    covers.MANAGER)
        self.panel_notebook = self.builder.get_object('panel_notebook')
        self.play_toolbar = self.builder.get_object('play_toolbar')

        logger.info("Loading panels...")
        self.panels['collection'] = collection.CollectionPanel(
            self.main.window,
            exaile.collection,
            _show_collection_empty_message=True)
        self.panels['radio'] = radio.RadioPanel(self.main.window,
                                                exaile.collection,
                                                exaile.radio, exaile.stations)
        self.panels['playlists'] = playlists.PlaylistsPanel(
            self.main.window, exaile.playlists, exaile.smart_playlists,
            exaile.collection)
        self.panels['files'] = files.FilesPanel(self.main.window,
                                                exaile.collection)

        for panel in ('collection', 'radio', 'playlists', 'files'):
            self.add_panel(*self.panels[panel].get_panel())

        # add the device panels
        for device in self.exaile.devices.list_devices():
            if device.connected:
                self.add_device_panel(None, None, device)

        logger.info("Connecting panel events...")
        self.main._connect_panel_events()

        if settings.get_option('gui/use_tray', False):
            self.tray_icon = tray.TrayIcon(self.main)

        self.device_panels = {}
        event.add_callback(self.add_device_panel, 'device_connected')
        event.add_callback(self.remove_device_panel, 'device_disconnected')
        event.add_callback(self.on_gui_loaded, 'gui_loaded')

        logger.info("Done loading main window...")
        Main._main = self