コード例 #1
0
ファイル: gonvert_glade.py プロジェクト: epage/gonvert-gtk
def run_gonvert():
	gtk.gdk.threads_init()
	if hildonize.IS_HILDON_SUPPORTED:
		gtk.set_application_name(constants.__pretty_app_name__)
	handle = Gonvert()
	if not constants.PROFILE_STARTUP:
		gtk.main()
コード例 #2
0
def run(widget):
    if has_hildon:
        print "+++ Hildon, yay!"
        widget.app = hildon.Program()
        window = hildon.Window()
        gtk.set_application_name(widget.display_name)
    else:
        print "--- No Hildon, sorry"
        window = gtk.Window()
        window.set_title(widget.display_name)

    widget.app_window = window
    window.resize(800, 480)
    window.add(widget)

    window.connect("delete-event", gtk.main_quit)
    window.connect("window-state-event", widget.do_window_state_event)
    window.connect("focus-in-event", widget.do_focus_in_event)
    window.connect("property-notify-event", widget.do_property_event)

    if has_osso:
        print "+++ Have osso, yay!"
        try:
            osso_context = osso.Context(widget.dbus_name, widget.version, False)
            device = osso.DeviceState(osso_context)
            device.set_device_state_callback(state_change, system_inactivity=True, user_data=widget)
        except:
            print "*** Failed to initialise OSSO context. Power management disabled..."
            has_osoo = False

    window.present()
    widget.show()
    gtk.main()
コード例 #3
0
def run(widget):
    if (has_hildon):
      print "+++ Hildon, yay!"
      widget.app = hildon.Program()
      window = hildon.Window()
      gtk.set_application_name(widget.display_name)
    else:
      print "--- No Hildon, sorry"
      window = gtk.Window()
      window.set_title(widget.display_name)
      
    widget.app_window = window
    window.resize(800, 480)
    window.add(widget)

    window.connect("delete-event", gtk.main_quit)
    window.connect("window-state-event", widget.do_window_state_event)
    window.connect("focus-in-event", widget.do_focus_in_event)
    window.connect("property-notify-event", widget.do_property_event)
    
    if (has_osso):
      print "+++ Have osso, yay!"
      try:
        osso_context = osso.Context(widget.dbus_name, widget.version, False)
        device = osso.DeviceState(osso_context)
        device.set_device_state_callback(state_change, system_inactivity=True, user_data=widget)
      except:
        print "*** Failed to initialise OSSO context. Power management disabled..."
        has_osoo = False

    window.present()
    widget.show()
    gtk.main()
コード例 #4
0
ファイル: error.py プロジェクト: thomasvs/mushin
def main():
    import datetime

    gtk.set_application_name('show an error')

    window = ErrorWindow('reactor meltdown. fatal radiation imminent')
    window.connect('destroy', lambda _: gtk.main_quit())

    window.show_all()
コード例 #5
0
ファイル: ejpi_glade.py プロジェクト: epage/ejpi-gtk
def run():
	gtk.gdk.threads_init()

	gtkpie.IMAGES.add_path(os.path.join(os.path.dirname(__file__), "libraries/images"), )
	if hildonize.IS_HILDON_SUPPORTED:
		gtk.set_application_name(constants.__pretty_app_name__)
	handle = Calculator()
	if not PROFILE_STARTUP:
		gtk.main()
コード例 #6
0
ファイル: main.py プロジェクト: thomasvs/mushin
def start():
    from mushin.common import log
    log.debug('main', 'starting')
    gtk.set_application_name('mushin')

    from mushin.maemo import start
    log.debug('main', 'creating window')
    window = start.StartWindow()
    log.debug('main', 'created window %r', window)
    window.connect('destroy', lambda _: gtk.main_quit())
コード例 #7
0
        def __init__(self, config):

            # Create the hildon program and setup the title
            program = hildon.Program.get_instance()
            gtk.set_application_name("Fuelpad")

            # Create HildonWindow and set it to HildonProgram
            hildon.StackableWindow.__init__(self)
            program.add_window(self)

            FuelpadAbstractWindow.__init__(self, config)
コード例 #8
0
ファイル: guihandler.py プロジェクト: proximate/proximate
    def __init__(self):
        """Constructor for Proximate_GUI."""

        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)

        settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS)

        self.width_setting = settings.register("gui.width", int, None, 0)
        self.height_setting = settings.register("gui.height", int, None, 0)

        self.page_history = []
        self.main_window = None

        self.initialize_menu()

        try:
            # This only seem to only exists on Maemo
            gtk.set_application_name(APP_NAME)
        except AttributeError:
            pass

        button = gtk.Button()
        button.get_settings().set_property("gtk-button-images", True)

        if have_hildon:
            self.initialize_hildon_program()
        else:
            self.initialize_gtk_program()

        self.main_loop = gobject.MainLoop()

        self.fullscreen_mode = False

        self.keybindings = []
        self.add_key_binding(None, gtk.keysyms.F6, self.key_pressed_F6)
        self.add_key_binding(gtk.gdk.CONTROL_MASK, gtk.keysyms.q, self.key_pressed_ctrl_q)

        self.popup_timeout_id = None
        self.event_clicked_at = None

        self.statusbar_timeout_id = None

        self.tbitems = {}

        # Signal Ids for connecting communities' userlists
        self.userlist_drag_data_get_signal_ids = {}
        self.userlists_button_press_signal_ids = {}

        # Initialize menu
        self.connect_default_menu_signals()

        self.notification.register_progress_update(self.handle_progress_update)
コード例 #9
0
def main():
    program = hildon.Program.get_instance()
    gtk.set_application_name("hildon-touch-selector example program")
 
    window = hildon.StackableWindow()
    program.add_window(window)
 
    # Create touch selector
    selector = create_simple_selector()
    window.add(selector)
 
    window.connect("destroy", app_quit)
 
    window.show_all()
 
    gtk.main()
コード例 #10
0
ファイル: lists.py プロジェクト: thomasvs/mushin
def main():
    gtk.set_application_name("example lists")

    window = ListsWindow()

    window.connect("destroy", lambda _: gtk.main_quit())

    def selected_cb(window, list_name):
        print "selected list name", list_name
        gtk.main_quit()

    window.connect("selected", selected_cb)

    window.show_all()

    for i in range(3):
        window.add_list("list %d" % i, i ** 2)
コード例 #11
0
ファイル: things.py プロジェクト: thomasvs/mushin
def main():
    gtk.set_application_name('example list of things')

    class OldThing(couch.Thing):
        title = 'a thing'
        projects = ['mushin', ]
        contexts = ['home', 'hacking']
        
    window = ThingsWindow()
    window.connect('destroy', lambda _: gtk.main_quit())

    window.show_all()

    for i in range(3):
        t = OldThing()
        t.title = 'thing %d' % i
        window.add_thing(t)
コード例 #12
0
ファイル: show.py プロジェクト: thomasvs/mushin
def main():
    import datetime

    gtk.set_application_name('show a thing')

    thing = couch.Thing(
        title='a thing',
        projects=['mushin', ],
        contexts=['home', 'hacking'],
        statuses=['waitingfor'],
        start=datetime.datetime(year=2009, month=1, day=1),
        due=datetime.datetime(year=2035, month=1, day=1),
        )
    window = ShowWindow(thing)
    window.connect('destroy', lambda _: gtk.main_quit())

    window.show_all()
コード例 #13
0
def main():
    Setup()

    logging.basicConfig(filename=os.path.expanduser(settings.log_file),
                        filemode='w',
                        format=settings.log_format,
                        level=logging.getLevelName(settings.log_level))

    gtk.set_application_name(settings.app_name)
    program = hildon.Program.get_instance()

    win = hildon.StackableWindow()
    win.set_title(settings.app_name)
    win.connect("destroy", gtk.main_quit, None)

    hildon.hildon_gtk_window_set_progress_indicator(win, 1)
    win.show_all()

    pannable_area = hildon.PannableArea()

    conn = sqlite3.connect(settings.db_path)
    c = conn.execute("select value from config where name=?", ('user',))
    user = c.fetchone()
    conn.close()

    if user is None:
        message = "No user set up in database."
        logging.error("%s" % message)
        message += " Please go to Settings and enter a username."
        info = hildon.hildon_note_new_information(win, message)
        response = gtk.Dialog.run(info)
        if response == gtk.RESPONSE_DELETE_EVENT:
            info.destroy()

    try:
        if user is not None:
            user = user[0]
            logging.info("Loading notices for %s" % user)
            nf = NoticeFetcher(user)
            nf.fetch()
    except Exception, e:
        message = "Problem loading notices. Is the network down?"
        logging.error("%s | %s" % (message, e))
        hildon.hildon_banner_show_information(pannable_area, '', message)
コード例 #14
0
ファイル: maemogst.py プロジェクト: zhangzhe1103/gst-python
 def __init__(self):
     # hildon has one program instance per app, so get instance
     self.p = hildon.Program.get_instance()
     # set name of application: this shows in titlebar
     gtk.set_application_name("Maemo GStreamer VideoTest")
     # stackable window in case we want more windows in future in app
     self.w = hildon.StackableWindow()
     box = gtk.VBox()
     self.video_widget = VideoWidget()
     # video widget we want to expand to size
     box.pack_start(self.video_widget, True, True, 0)
     # a button finger height to play/pause 
     self.button = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
         hildon.BUTTON_ARRANGEMENT_VERTICAL, title="Pause")
     self.button.connect_after("clicked", self.on_button_clicked)
     # don't want button to expand or fill, just stay finger height
     box.pack_start(self.button, False, False, 0)
     self.w.add(box)
     self.w.connect("delete-event", gtk.main_quit)
     self.p.add_window(self.w)
     self.w.show_all()
     self.start_streaming()
コード例 #15
0
ファイル: stationstat.py プロジェクト: emresaglam/wmatastats
def main ():
    w = Wmata()
    stations = w.stations(1).keys()
    stations.sort()

    program = hildon.Program.get_instance()
    gtk.set_application_name("wmata station picker")

    window = hildon.StackableWindow()
    program.add_window(window)

    # Create a picker button
    picker_button = hildon.PickerButton(gtk.HILDON_SIZE_AUTO,
		                                            hildon.BUTTON_ARRANGEMENT_VERTICAL)

    # Set a title to the button 
    picker_button.set_title("Pick a station")

    # Create a touch selector entry
    selector = hildon.TouchSelectorEntry(text=True)
       
    # Populate the selector
    for station in stations:
	            selector.append_text(station)

    # Attach the touch selector to the picker button
    picker_button.set_selector(selector)

    # Attach callback to the "value-changed" signal
    picker_button.connect("value-changed", on_picker_value_changed)

    # Add button to main window
    window.add(picker_button)

    window.connect("destroy", app_quit)
    window.show_all()
    gtk.main()
コード例 #16
0
def _hildon_set_application_name(name):
    gtk.set_application_name(name)
コード例 #17
0
ファイル: HapticGuide.py プロジェクト: mikeedwards/C3_N900
 def __init__(self):     
   self.save_file = False
   self.screen_sink = None
   self.screen_set_xid = False
   
   try:
       self.app = hildon.Program.get_instance()    
   except:
       self.app = hildon.Program()

   try:
       gtk.set_application_name("C3 Prototype v0.3")
   except:
       pass

   # This is the brilliant GTK+ Glade builder that lets me keep the entire UI
   # code in a .glade (xml) file to be loaded dynamically.
   builder = gtk.Builder()
   builder.add_from_file("sensor.glade") 

   # Get variables to each of the ui widgets we will need to work with
   self.window = builder.get_object("windowMain")
   self.sensor1Data = builder.get_object("labelSensor1Data")
   self.sensor2Data = builder.get_object("labelSensor2Data")
   self.labelCounterData = builder.get_object("labelCounterData")
   self.labelDebugData = builder.get_object("labelDebugData")
   self.labelLatData = builder.get_object("labelLatData")
   self.labelLonData = builder.get_object("labelLonData")
   self.labelDatetime = builder.get_object("labelDatetime")
   self.screen = builder.get_object("screen")
   self.buttonReport = builder.get_object("buttonReport")
   
   self.screen.set_size_request(640, 350)
   self.screen.add_events(gtk.gdk.BUTTON_PRESS_MASK)
   self.screen.connect("expose-event", self.expose_cb, self.screen_sink)
   #self.screen.connect("button_press_event", self.on_report_click)


   # Create the belt object to handle data communication
   self.belt = BeltConnection()

   # Initialize tracking variables
   self.sensor1 = 0
   self.sensor2 = 0
   
   self.counter = 0

   # Connect signals exposed in the glade file to local functions
   signals = { "on_windowMain_destroy_event" : self.on_window_destroy,
               "on_windowMain_delete_event" : self.on_window_delete, 
               "on_buttonBtConnect_clicked" : self.on_connect_click,
               "on_buttonGpsConnect_clicked" : self.on_GpsConnect_click,
               "on_buttonReport_clicked": self.on_report_click
               }
   builder.connect_signals(signals)
   
   if has_location:
       self.control = location.GPSDControl.get_default()
       
       self.device = location.GPSDevice()
       self.control.set_properties(preferred_method=location.METHOD_USER_SELECTED,
                              preferred_interval=location.INTERVAL_DEFAULT)
        
       self.control.connect("error-verbose", self.on_error, self)
       self.device.connect("changed", self.on_changed, self.control)
       self.control.connect("gpsd-stopped", self.on_stop, self)
       
   self.pipeline = gst.Pipeline("c3_camera_pipeline")
   self.labelDebugData.set_text("try")
   self.create_pipeline()
コード例 #18
0
ファイル: new.py プロジェクト: thomasvs/mushin
def main():
    gtk.set_application_name('add/edit thing')

    # compare with mushin.model.couch.Thing
    # FIXME: flags or statuses ? 

    class Thing(object):
        pass

    class OldThing(couch.Thing):
        title = 'a thing'
        projects = [u'mushin', u'newproject']
        contexts = [u'home', u'hacking']
        statuses = [u'waitingon']
        # march
        # due = datetime.datetime(2011, 3, 20)
        complete = 50
        urgency = 2
        importance = 4

        time = 3600
        recurrence = 60 * 60 * 24 * 7
        
    def done_cb(window):
        t = Thing()
        window.get_thing(t)

        print 'Title:', t.title
        print 'Projects:', t.projects
        print 'Contexts:', t.contexts
        print 'Flags:', t.statuses
        print 'Start date:', t.start
        print 'Due date:', t.due

        print 'Urgency:', t.urgency
        print 'Importance:', t.importance
        print 'Duration:', t.time
        print 'Recurrence:', t.recurrence
        print '% complete:', t.complete

        window.destroy()

    new = False
    if len(sys.argv) > 1:
        new = True

    window = NewWindow(new)

    window.add_contexts(['hack', 'shop', 'work', 'home'])
    window.add_projects(['mushin', 'moap', 'mach'])
    window.add_statuses(['next', ])
    window.loaded()

    if not new:
        t = OldThing()
        window.add_thing(t)

    window.connect('done', done_cb)
    window.connect('destroy', lambda _: gtk.main_quit())

    window.show_all()
コード例 #19
0
ファイル: ankimaemi.py プロジェクト: jamesjrg/ankimaemi
import gtkhtml2
import gtk
import hildon

import time, cgi, sys, os, re, subprocess
from anki import DeckStorage as ds
from anki.sync import SyncClient, HttpSyncServerProxy
from anki.media import mediaRefs
from anki.utils import parseTags, joinTags

from gnome import gconf 

def request_object(*args):
    print 'request object', args

gtk.set_application_name(appname)

class AnkiMiniApp(hildon.Program):

    currentCard = None
    deck = None
    played = False

    conf_client = None

    DECK_PATH = ""
    SYNC_USERNAME = ""
    SYNC_PASSWORD = ""

    recent_decks = []
    recent_sub_menu = None
コード例 #20
0
ファイル: gui.py プロジェクト: localhorse/desktop-mevemon
 def __init__(self, controller):
     self.controller = controller
     gtk.set_application_name("mEveMon")
コード例 #21
0
ファイル: multilist_gtk.py プロジェクト: epage/multilist
def run_multilist():
	if hildonize.IS_HILDON_SUPPORTED:
		gtk.set_application_name(constants.__pretty_app_name__)
	app = Multilist()
	if not PROFILE_STARTUP:
		gtk.main()
コード例 #22
0
def _hildon_set_application_name(name):
	gtk.set_application_name(name)
コード例 #23
0
ファイル: main.py プロジェクト: danni/tramtracker
                    dialog.setStops(stops)

        control.connect('error-verbose', gps_error)
        device.connect('changed', location_updated)

        control.start()

        # FIXME: does changed ever get called?
        location_updated(device)

if __name__ == '__main__':
    gobject.threads_init()

    osso_context = osso.Context('au.id.madeley.danni.tramtracker',
                                '0.1.2', False)
    gtk.set_application_name("Tram Tracker")

    try:
        Client()
    except KeyboardException:
        gtk.main_quit()
    except Exception, e:
        from traceback import format_exc

        dialog = gtk.Dialog(title="Exception")
        dialog.vbox.pack_start(gtk.Label(format_exc()))
        dialog.show_all()
        dialog.run()
        gtk.main_quit()

    gtk.main()
コード例 #24
0
    def __init__(self):
        """ Initializes the GUI, creating all widgets. """
        self.cont = fMMSController.fMMS_controllerGTK()
        self.config = self.cont.config
        self.ch = ContactH.ContactHandler()

        self.osso_c = osso.Context("se.frals.fmms", self.config.get_version(),
                                   False)
        self.osso_rpc = osso.Rpc(self.osso_c)
        self.osso_rpc.set_rpc_callback("se.frals.fmms", "/se/frals/fmms",
                                       "se.frals.fmms", self.cb_open_fmms,
                                       self.osso_c)

        self.refreshlistview = True
        self.viewerimported = False
        self.senderimported = False
        self._screenwidth = 800

        self.avatarlist = {}
        self.namelist = {}
        self.nrlist = {}

        hildon.Program.__init__(self)
        program = hildon.Program.get_instance()

        self.window = hildon.StackableWindow()
        hildon.hildon_gtk_window_set_portrait_flags(
            self.window, hildon.PORTRAIT_MODE_SUPPORT)
        gtk.set_application_name("fMMS")
        self.window.set_title("fMMS")
        program.add_window(self.window)
        self.window.connect("delete_event", self.quit)

        self.pan = hildon.PannableArea()
        self.pan.set_property("mov-mode", hildon.MOVEMENT_MODE_VERT)

        # wonder how much memory this is wasting
        self.iconcell = gtk.CellRendererPixbuf()
        self.photocell = gtk.CellRendererPixbuf()
        self.textcell = gtk.CellRendererText()
        self.photocell.set_property('xalign', 1.0)
        self.textcell.set_property('mode', gtk.CELL_RENDERER_MODE_INERT)
        self.textcell.set_property('xalign', 0.0)

        self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf,
                                       str, str, str)
        self.treeview = hildon.GtkTreeView(gtk.HILDON_UI_MODE_NORMAL)
        self.treeview.set_property("fixed-height-mode", True)
        self.treeview.set_model(self.liststore)

        # create ui
        self._create_ui()

        self.treeview.tap_and_hold_setup(self.liststore_mms_menu())
        self.treeview.tap_and_hold_setup(None)
        self.tapsignal = self.treeview.connect('hildon-row-tapped',
                                               self.show_mms)
        self.treeview.connect('button-press-event', self.cb_button_press)

        mmsBox = gtk.HBox()
        icon_theme = gtk.icon_theme_get_default()
        envelopePixbuf = icon_theme.load_icon("general_sms_button", 48, 0)
        envelopeImage = gtk.Image()
        envelopeImage.set_from_pixbuf(envelopePixbuf)
        envelopeImage.set_alignment(1, 0.5)
        mmsLabel = gtk.Label(
            gettext.ldgettext('rtcom-messaging-ui', "messaging_ti_new_mms"))
        mmsLabel.set_alignment(0, 0.5)

        mmsBox.pack_start(envelopeImage, True, True, 0)
        mmsBox.pack_start(mmsLabel, True, True, 0)
        newMsgButton = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
                                     hildon.BUTTON_ARRANGEMENT_HORIZONTAL)

        newMsgButton.add(mmsBox)
        newMsgButton.connect('clicked', self.new_mms_button_clicked)
        """ gets the newMsgButton on top of the treeview """
        actionbox = self.treeview.get_action_area_box()
        self.treeview.set_action_area_visible(True)
        actionbox.add(newMsgButton)

        self.pan.add(self.treeview)

        self.livefilter = hildon.LiveSearch()
        modelfilter = self.liststore.filter_new()
        modelfilter.set_visible_func(self.cb_filter_row)
        self.treeview.set_model(modelfilter)
        self.livefilter.set_filter(modelfilter)
        self.livefilter.widget_hook(self.window, self.treeview)

        contBox = gtk.VBox()
        contBox.pack_start(self.pan, True, True, 0)
        contBox.pack_start(self.livefilter, False, False, 0)

        align = gtk.Alignment(1, 1, 1, 1)
        align.set_padding(2, 2, 10, 10)
        align.add(contBox)
        self.window.add(align)

        menu = self.cont.create_menu(self.window)
        self.window.set_app_menu(menu)
        self.window.connect('focus-in-event', self.cb_on_focus)
        self.window.connect('configure-event', self._onOrientationChange)
        self.window.show_all()
        self.add_window(self.window)
コード例 #25
0
def run_quicknote():
	if hildonize.IS_HILDON_SUPPORTED:
		gtk.set_application_name(constants.__pretty_app_name__)
	app = QuicknoteProgram()
	if not PROFILE_STARTUP:
		gtk.main()