Example #1
0
 def __init__(self):
     fileDirectory = os.path.dirname(__file__)
     self.preferences = GFrameCatcher.libs.preferences.Preferences()
     gobject.set_application_name(self.preferences.ProgramName)
     gettext.bindtextdomain(self.preferences.ProgramName, self.preferences.LocalePath)
     gettext.textdomain(self.preferences.ProgramName)
     gettext.install(self.preferences.ProgramName, localedir= self.preferences.LocalePath,unicode= True)
     self.builder = gtk.Builder()
     self.builder.add_from_file(os.path.join(fileDirectory , "ui/mainWindow.ui"))
     self.builder.set_translation_domain(self.preferences.ProgramName)
     self.builder.connect_signals(self)
     self.window = self.builder.get_object("window1")
     self.window.set_icon(GdkPixbuf.Pixbuf.new_from_file(os.path.join(fileDirectory , "../icons/gframecatcher16.png")))
     self.window.set_default_size(int(self.preferences.getValue("Window", "width")), int(self.preferences.getValue("Window", "height")))
     self.builder.get_object("toolZoomFitButton").set_active(bool(int(self.preferences.getValue("Window", "zoomFit"))))
     self.window.show_all()
     self.MediaInfo = GFrameCatcher.media.mediaLibrary.MediaInfo()
     self.model = gtk.ListStore(GdkPixbuf.Pixbuf, str)
     self.builder.get_object("frameView").set_from_pixbuf(None)
     videoDrop = [("text/uri-list" , 0 , 82 )]
     # self.builder.get_object("frameIconView").set_model(self.model)
     # self.builder.get_object("frameIconView").drag_dest_set(
     #     gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, videoDrop , gtk.gdk.ACTION_COPY
     # )
     self.__imageDrag = [("text/uri-list", 0, 81), ("image/png", 0, 82)]
     # self.builder.get_object("viewPort").drag_source_set(gtk.gdk.BUTTON1_MASK, self.__imageDrag, gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_COPY)
     self.builder.get_object("viewPort").drag_dest_unset()
     self.window.connect("configure-event", self.on_configure_event)
     self.window.connect("window-state-event", self.on_window_state_event)
     self.window.connect("destroy", self.on_imageQuit_activate)
Example #2
0
   def __init__(self,gyotoytop):
      GObject.set_application_name("Gyotoy")
      GObject.set_prgname("Gyotoy")

      self.gyotoytop = gyotoytop
      self._pyk_blocked=0
      self.length_unit="geometrical"

      # read GUI definition
      self.builder = Gtk.Builder()
      self.builder.add_from_file(os.path.join(self.gyotoytop,'gyotoy.xml'))
      
      # handle destroy event (so that we can kill the window through window bar)
      self.window = self.builder.get_object('window1')
      if (self.window):
         self.window.connect('destroy', self.destroy)

      # autoconnect to callback functions
      # this will automatically connect the event handler "on_something_event"
      # to the here-defined function of the same name. This avoid defining a
      # long dictionary that serves the same purpose
      self.builder.connect_signals(self)

      # set stdin non blocking, this will prevent readline to block
      # stdin is coming from yorick (yorick spawned this python process)
      fd = sys.stdin.fileno()
      flags = fcntl.fcntl(fd, fcntl.F_GETFL)
      fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
      
      # ... and add stdin to the event loop (yorick input pipe by spawn)
      GObject.io_add_watch(sys.stdin,GObject.IO_IN|GObject.IO_HUP,self.yo2py,None)

      # run: realize the interface, start event management
      Gtk.main()
Example #3
0
def set_application_name(app_name):
    """Set the name of the application."""
    if has_gi:
        from gi.repository import GObject
        GObject.set_application_name(app_name)
    else:
        import gobject
        gobject.set_application_name(app_name)
Example #4
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, data=None):
            if model.get_value(iter, 0) is self.current_song:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.ACTIVE)
            else:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.NORMAL)
            cell.set_property("cell-background-rgba", bgcolor)

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, 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.EllipsizeMode.END
        title_col.pack_start(render_text, 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, True)
        self.stations_combo.add_attribute(render_text, "text", 1)
        self.stations_combo.set_row_separator_func(lambda model, iter, data=None: model.get_value(iter, 0) is None, None)
Example #5
0
 def __init__(self):
     fileDirectory = os.path.dirname(__file__)
     self.preferences = GFrameCatcher.libs.preferences.Preferences()
     gobject.set_application_name(self.preferences.ProgramName)
     gettext.bindtextdomain(self.preferences.ProgramName,
                            self.preferences.LocalePath)
     gettext.textdomain(self.preferences.ProgramName)
     gettext.install(self.preferences.ProgramName,
                     localedir=self.preferences.LocalePath,
                     unicode=True)
     self.builder = gtk.Builder()
     self.builder.add_from_file(
         os.path.join(fileDirectory, "ui/mainWindow.ui"))
     self.builder.set_translation_domain(self.preferences.ProgramName)
     self.builder.connect_signals(self)
     self.window = self.builder.get_object("window1")
     self.window.set_icon(
         GdkPixbuf.Pixbuf.new_from_file(
             os.path.join(fileDirectory, "../icons/gframecatcher16.png")))
     self.window.set_default_size(
         int(self.preferences.getValue("Window", "width")),
         int(self.preferences.getValue("Window", "height")))
     self.builder.get_object("toolZoomFitButton").set_active(
         bool(int(self.preferences.getValue("Window", "zoomFit"))))
     self.window.show_all()
     self.MediaInfo = GFrameCatcher.media.mediaLibrary.MediaInfo()
     self.model = gtk.ListStore(GdkPixbuf.Pixbuf, str)
     self.builder.get_object("frameView").set_from_pixbuf(None)
     videoDrop = [("text/uri-list", 0, 82)]
     # self.builder.get_object("frameIconView").set_model(self.model)
     # self.builder.get_object("frameIconView").drag_dest_set(
     #     gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, videoDrop , gtk.gdk.ACTION_COPY
     # )
     self.__imageDrag = [("text/uri-list", 0, 81), ("image/png", 0, 82)]
     # self.builder.get_object("viewPort").drag_source_set(gtk.gdk.BUTTON1_MASK, self.__imageDrag, gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_COPY)
     self.builder.get_object("viewPort").drag_dest_unset()
     self.window.connect("configure-event", self.on_configure_event)
     self.window.connect("window-state-event", self.on_window_state_event)
     self.window.connect("destroy", self.on_imageQuit_activate)
Example #6
0
        when the engine is running
        """
        return "%s insert %s clicks every %s sec." % (self.publicname,
                                                      self.msgsize,
                                                      self.period)

    def get_random_webhistory_click (self):
        TEMPLATE = """<%s> a nfo:WebHistory;
            nie:title "This is one random title";
            nie:contentCreated "%s";
            nfo:domain "%s";
            nfo:uri "%s".
        """
        today = datetime.datetime.today ()
        date = today.isoformat () + "+00:00"
        click_no = str(random.randint (100, 1000000))
        resource = "urn:uuid:1234" + click_no
        uri = "http://www.maemo.org/" + click_no
        domain = "http://www.maemo.org"
        return TEMPLATE % (resource, date, domain, uri)

if __name__ == "__main__":

    gobject.set_application_name ("Web Browser saving clicks (inefficiently)")
    engine = WebBrowserEngine ("Naughty Web Browser",
                               options['period'],
                               options['msgsize'],
                               options['timeout'])
    mainloop ()

Example #7
0
def main(options=None):
    GObject.set_application_name('gPodder')

    gp = gPodderApplication(options)
    gp.run()
    sys.exit(0)
Example #8
0
        """
        self.publicname
        self.msgsize
        self.period contains these values for the subclasses
        """
        superKlass.__init__(self, name, period, msgsize, timeout)
        self.run()

    def get_insert_sparql(self):
        """
        This method returns an string with the sparQL we will send
        to tracker.SparqlUpdate method
        """
        return "INSERT { put here your triplets }"

    def get_running_label(self):
        """
        This method returns the string showing the current status
        when the engine is running
        """
        return "%s sends %s items every %s sec." % (self.publicname,
                                                    self.msgsize, self.period)


if __name__ == "__main__":

    gobject.set_application_name("Here the title of the window")
    engine = MockEngine("My mock stuff", options['period'], options['msgsize'],
                        options['timeout'])
    mainloop()
Example #9
0
        """
        superKlass.__init__ (self, name, period, msgsize, timeout)
        self.run ()
        
    def get_insert_sparql (self):
        """
        This method returns an string with the sparQL we will send
        to tracker.SparqlUpdate method
        """
        return "INSERT { put here your triplets }"

    def get_running_label (self):
        """
        This method returns the string showing the current status
        when the engine is running
        """
        return "%s sends %s items every %s sec." % (self.publicname,
                                                          self.msgsize,
                                                          self.period)


if __name__ == "__main__":

    gobject.set_application_name ("Here the title of the window")
    engine = MockEngine ("My mock stuff",
                         options['period'],
                         options['msgsize'],
                         options['timeout'])
    mainloop ()

Example #10
0
                             signal_name="SubjectsAdded",
                             dbus_interface="org.freedesktop.Tracker1.Resources.Class",
                             path="/org/freedesktop/Tracker1/Resources/Classes/mfo/FeedMessage")

    bus.add_signal_receiver (notification_removal,
                             signal_name="SubjectsRemoved",
                             dbus_interface="org.freedesktop.Tracker1.Resources.Class",
                             path="/org/freedesktop/Tracker1/Resources/Classes/mfo/FeedMessage")

    bus.add_signal_receiver (notification_update,
                             signal_name="SubjectsChanged",
                             dbus_interface="org.freedesktop.Tracker1.Resources.Class",
                             path="/org/freedesktop/Tracker1/Resources/Classes/mfo/FeedMessage")

    window = ui.get_object ("main_window")
    gobject.set_application_name ("Rss/tracker")
    create_posts_tree_view ()
    ui.get_object("posts_treeview").set_model (posts_model)

    channels_treeview = create_channels_tree_view ()
    channels_treeview.set_model (channels_model)
    
    dialog = gtk.Dialog ("Sources", window,
                         gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
                         (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                          gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
    dialog.vbox.add (channels_treeview)


    ui.get_object ("button_toggle").connect ("clicked", clicked_toggle_cb)
    ui.get_object ("notebook1").connect ("switch-page", change_tab_cb)
 def setUp(self):
     GObject.set_application_name(self.APP)
Example #12
0
        query = "INSERT {" + triplets + "}"
        return query

    def get_running_label(self):
        return "%s sends %s rss entries every %s sec." % (
            self.publicname, self.msgsize, self.period)

    def gen_new_post(self):
        SINGLE_POST = """
        <%s> a nmo:FeedMessage ;
        nie:contentLastModified "%s" ;
        nmo:communicationChannel <http://maemo.org/news/planet-maemo/atom.xml>;
        nie:title "%s".
        """
        today = datetime.datetime.today()
        date = today.isoformat() + "+00:00"
        post_no = str(random.randint(100, 1000000))
        uri = "http://test.maemo.org/feed/" + post_no
        title = "Title %s" % (post_no)

        return SINGLE_POST % (uri, date, title)


if __name__ == "__main__":

    gobject.set_application_name("Feeds engine/signals simulator")
    engine = RSSEngine("RSS", options['period'], options['msgsize'],
                       options['timeout'])
    mainloop()
Example #13
0
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.


import sys, os, subprocess
from gettext import gettext as _

from gi.repository import Gtk, Gdk,GObject

from . import config

from . import control
#import ctxsearch.etc as etc

# If you are only interested in Ctrl-c finishing your application and you don't
# need special cleanup handlers, the following will perhaps work for you:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

GObject.set_application_name('Context Search')
GObject.set_prgname('ctxsearch')

cfgdir = os.path.join(os.getenv("HOME"), ".ctxsearch")
#cfgdir = "_config"

cfg = config.Config(cfgdir)

control.Control(cfg)

Gtk.main()
Example #14
0
import gettext
from gi.repository import Gtk, GObject, Notify

from gmailwatcher.app.preferences import new_preferences_dialog
from gmailwatcher.app.webview import new_webview
from gmailwatcher.app.indicator import new_application_indicator
from gmailwatcher.lib import gmail_imap as gmail_watcher
from gmailwatcher.lib.helpers import get_builder
from gmailwatcher.lib import consts

#gettext.bindtextdomain("gmailwatcher", "/usr/share/locale")
gettext.textdomain('gmailwatcher')
Notify.init('gmailwatcher')
GObject.set_prgname('gmailwatcher')
GObject.set_application_name('Gmail Watcher')


class MainApp(object):
    """
    Main class that of the applications
    Handles all the callbacks and main window UI chrome
    """

    def __init__(self, main_loop, application, args=[]):
        self.main_loop = main_loop
        self.builder = Gtk.Builder()
        self.builder.add_from_file(get_builder('MainApp.glade'))
        self.builder.connect_signals(self)

        # Setup main widgets
Example #15
0
def main(options=None):
    GObject.set_application_name('gPodder')

    gp = gPodderApplication(options)
    gp.run()
    sys.exit(0)
Example #16
0
    def get_running_label (self):
        return "%s sends %s rss entries every %s sec." % (self.publicname,
                                                          self.msgsize,
                                                          self.period)

    def gen_new_post (self):
        SINGLE_POST = """
        <%s> a nmo:FeedMessage ;
        nie:contentLastModified "%s" ;
        nmo:communicationChannel <http://maemo.org/news/planet-maemo/atom.xml>;
        nie:title "%s".
        """
        today = datetime.datetime.today ()
        date = today.isoformat () + "+00:00"
        post_no = str(random.randint (100, 1000000))
        uri = "http://test.maemo.org/feed/" + post_no
        title = "Title %s" % (post_no)
        
        return SINGLE_POST % (uri, date, title)
        

if __name__ == "__main__":

    gobject.set_application_name ("Feeds engine/signals simulator")
    engine = RSSEngine ("RSS",
                        options['period'],
                        options['msgsize'],
                        options['timeout'])
    mainloop ()