Example #1
0
    def __init__(self):

        from mediabox import config
        from theme import theme
        import platforms
        from mediabox import values

    
        Component.__init__(self)
        
        # set theme
        try:
            theme.set_theme(config.theme())
        except:
            # theme could not be loaded; using default theme
            pass

        # utterly dirty hack no longer necessary when playing media through MAFW
        """
        # make MediaBox play sound in silent mode
        if (platforms.MAEMO5):
            import gobject
            gobject.set_application_name("FMRadio")
        """

        # satisfy maemo activation framework
        if (platforms.MAEMO4):
            platforms.create_osso_context(values.OSSO_NAME, "1.0", False)
            
        elif (platforms.MAEMO5):
            platforms.create_osso_context(values.OSSO_NAME, "1.0", False)
Example #2
0
    def __init__(self):

        # the current ID to be used for the identifying the next entry
        self.__current_id = 0

        # table: ID -> entry
        # an entry is a key-value dict
        self.__entries = {}

        # indices used for several properties
        self.__indices = {
            "File.Path": {},
            "Audio.Album": {},
            "Image.Month": {}
        }

        # list of properties that are to be compared case-insensitive
        self.__case_insensitive = [
            "Audio.Album", "Audio.Artist", "Audio.Title"
        ]

        # whether the index has unsaved changes
        self.__is_dirty = False

        # table: mimetype -> [inspectors]
        self.__inspectors = {}

        Component.__init__(self)
        self.__load_index()
Example #3
0
    def __init__(self):

        self.__last_progress_time = 0

        # table: download id -> handler
        self.__downloaders = {}

        Component.__init__(self)
Example #4
0
 def __init__(self):
 
     # table: prefix -> device
     self.__prefixes = {}
     # table: ID -> prefix
     self.__idents = {}
     
     Component.__init__(self)
Example #5
0
    def __init__(self):

        self.__pid = os.getpid()
        Component.__init__(self)

        self.__alloc()
        # TODO: shut down when idle
        gobject.timeout_add(5000, self.__alloc)
Example #6
0
 def __init__(self):
 
     self.__current_file = None
     self.__current_pos = 0
     self.__is_playing = False
     self.__to_seek = 0
     
 
     Component.__init__(self)
Example #7
0
    def __init__(self):

        self.__queue = Queue()

        Component.__init__(self)

        t = threading.Thread(target=self.__cover_thread)
        t.setDaemon(True)
        t.start()
Example #8
0
    def __init__(self):

        # table: MIME type -> [handlers]
        self.__mime_handlers = {}

        # table: name -> handler
        self.__thumbnailers = {}

        Component.__init__(self)
Example #9
0
    def __init__(self):

        self.__need_report_position = True
        self.__volume = 0

        Component.__init__(self)
        dbus.service.Object.__init__(
            self, dbus.service.BusName("de.pycage.mediabox",
                                       dbus.SessionBus()),
            "/de/pycage/mediabox/control")
Example #10
0
    def __init__(self):
    
        self.__is_automatic = False
    
        Component.__init__(self)

        bus = platforms.get_system_bus()
        obj = bus.get_object("com.nokia.mce", "/com/nokia/mce/signal")
        obj.connect_to_signal("sig_device_orientation_ind",
                              self.__on_rotate)
Example #11
0
    def __init__(self):

        self.__device = DVDDevice()

        Component.__init__(self)

        system_bus = maemo.get_system_bus()
        obj = system_bus.get_object("org.freedesktop.Hal",
                                    "/org/freedesktop/Hal/Manager")
        iface = dbus.Interface(obj, "org.freedesktop.Hal.Manager")
        iface.connect_to_signal("DeviceAdded", self.__on_add_device)
Example #12
0
    def __init__(self):

        self.__state = _STATE_NONE

        Component.__init__(self)

        bus = platforms.get_system_bus()
        obj = bus.get_object("com.nokia.mce", "/com/nokia/mce/signal")

        obj.connect_to_signal("sig_call_state_ind", self.__on_state_signal)

        obj.connect_to_signal("sig_device_mode_ind", self.__on_mode_signal)
Example #13
0
    def __init__(self):
    
        # table: UUID -> location
        self.__servers = {}
        
        # table: UUID -> expiration_handler
        self.__expiration_handlers = {}
        
        # table of the devices currently being processed: UUID -> location
        self.__processing = {}

    
        Component.__init__(self)
Example #14
0
    def __init__(self):

        # table: ident -> (device, path)
        self.__mounts = {}

        Component.__init__(self)

        session_bus = maemo.get_session_bus()
        obj = session_bus.get_object("org.gnome.GnomeVFS.Daemon",
                                     "/org/gnome/GnomeVFS/Daemon")
        iface = dbus.Interface(obj, 'org.gnome.GnomeVFS.Daemon')
        iface.connect_to_signal("VolumeMountedSignal", self.__on_mount_volume)
        iface.connect_to_signal("VolumeUnmountedSignal",
                                self.__on_unmount_volume)
Example #15
0
 def __init__(self):
 
     self.__buffer = None
     
     self.__title = ""
     self.__info = "- no media loaded -"
     self.__cover = theme.mb_logo
     
     self.__prepared_file = None
     
     
     Component.__init__(self)
     Widget.__init__(self)
     
     self.connect_clicked(self.__on_click)
Example #16
0
    def __init__(self):

        # lyrics as list of (time, text, hilight_from, hilight_to) tuples
        self.__lyrics = []

        # time offset
        self.__offset = 0

        # current lyrics line
        self.__current_line = ""

        self.__position_handler = None
        self.__position = 0

        Component.__init__(self)
Example #17
0
    def __init__(self):
    
        self.__fmtx = None
        self.__is_playing = False
        self.__title = ""
    
        Component.__init__(self)

        # add support for calling fm-boost automatically, if available        
        if (os.path.exists("/sbin/fm-boost")):
            bus = platforms.get_system_bus()
            bus.add_signal_receiver(self.__on_change_fmtx,
                                    signal_name="Changed",
                                    dbus_interface="com.nokia.FMTx.Device",
                                    path="/com/nokia/fmtx/default")
Example #18
0
    def __init__(self):

        self.__is_connected = True

        self.__click_count = 0
        self.__click_handler = None

        Component.__init__(self)

        # monitor headset button
        try:
            bus = maemo.get_system_bus()
            obj = bus.get_object(_HAL_SERVICE, _HEADSET_PATH)
            device = dbus.Interface(obj, _HAL_DEVICE_IFACE)
            device.connect_to_signal("Condition", self.__on_hal_condition)
        except:
            logging.warning("unable to monitor headset button")

        # monitor AVRCP
        try:
            bus = maemo.get_system_bus()
            obj = bus.get_object(_HAL_SERVICE, _AVRCP_PATH)
            device = dbus.Interface(obj, _HAL_DEVICE_IFACE)
            device.connect_to_signal("Condition", self.__on_hal_condition)
        except:
            logging.warning("unable to monitor AVRCP status")

        # monitor headset status
        try:
            fd = open(_HEADPHONE_SYS, "r")
            self.__on_connect(None, None)
            self.__watcher = gobject.io_add_watch(fd, gobject.IO_PRI,
                                                  self.__on_connect)
        except:
            logging.warning("unable to monitor headset connection")

        # set up speaker control
        try:
            bus = maemo.get_session_bus()
            obj = bus.get_object("com.nokia.osso_hp_ls_controller",
                                 "/com/nokia/osso_hp_ls_controller")
            self.__speaker = dbus.Interface(
                obj, "com.nokia.osso_hp_ls_controller.loudspeaker")
        except:
            logging.warning("cannot force loudspeaker")
            self.__speaker = None
Example #19
0
    def __init__(self):

        self.__last_check = 0
        self.__is_charging = False

        # the maximum known battery fill level
        self.__max_battery = config.get_max_battery()

        Component.__init__(self)

        system_bus = maemo.get_system_bus()
        system_bus.add_signal_receiver(self.__timeleft_cb, 'battery_timeleft')
        system_bus.add_signal_receiver(self.__charging_on_cb,
                                       'charger_charging_on')
        system_bus.add_signal_receiver(self.__charging_off_cb,
                                       'charger_charging_off')
        bus_name = dbus.service.BusName('com.nokia.bme.request', system_bus)
        self.__request = _Request(bus_name)
Example #20
0
 def __init__(self, *services):
 
     # services provided by the device
     self.__services = []
     
     # table: scpd_url -> service
     self.__scpd_urls = {}
     
     # table: ctrl_url -> service
     self.__ctrl_urls = {}
     
     # table: event_url -> service
     self.__event_urls = {}
 
     Component.__init__(self)
     
     for svc in services:
         self._add_service(svc)
Example #21
0
    def __init__(self):

        # list of bookmarked files
        self.__items = []

        # whether the bookmarks need to be reloaded
        self.__needs_reload = True

        # whether there are unsaved changes
        self.__is_dirty = False

        Component.__init__(self)

        if (not os.path.exists(_BOOKMARK_FILE)):
            try:
                initial_bookmarks = self.__make_initial_bookmarks()
                open(_BOOKMARK_FILE, "w").write(initial_bookmarks)
            except:
                pass
Example #22
0
    def __init__(self):

        self.__last_keycode = None
        self.__warned_about_battery = False

        self.__accept_repeat_time = 0

        Component.__init__(self)

        usbdev = self.__find_device()
        if (usbdev):
            try:
                fd = open(usbdev, "r")
            except:
                logging.error("cannot read from AppleRemote %s- " \
                              "permission denied?" % usbdev)
            else:
                gobject.io_add_watch(fd, gobject.IO_IN,
                                     self.__on_receive_input)
Example #23
0
 def __init__(self):
 
     self.__is_locked = False
 
     Component.__init__(self)
Example #24
0
    def __init__(self):

        self.__outputs = []
        self.__current_output = None

        Component.__init__(self)
Example #25
0
    def __init__(self):

        # the current mode
        self.__mode = _MODE_NORMAL

        # list of available dialog windows
        self.__dialogs = []

        self.__widgets = []

        # the file that is currently playing
        self.__current_file = None

        # list of files for playing
        self.__play_folder = None
        self.__play_files = []

        # list for choosing random files from when in shuffle mode
        self.__random_files = []

        # current window size (for detecting resizing)
        self.__window_size = (0, 0)

        self.__is_searching = False
        self.__filter_term = ""

        self.__key_hold_down_timestamp = 0
        self.__skip_letter = False

        # scheduler for creating thumbnails one by one
        self.__tn_scheduler = ItemScheduler()

        # whether we are shutting down
        self.__is_shutdown = False

        Component.__init__(self)
        Window.__init__(self, Window.TYPE_TOPLEVEL)
        self.set_flag(windowflags.CATCH_VOLUME_KEYS, True)
        self.connect_key_pressed(self.__on_key_press)
        self.connect_closed(self.__on_close_window)

        # [Now Playing] button
        self.__now_playing = NowPlaying()
        #self.__now_playing.set_visible(False)

        # file browser
        self.__browser = StorageBrowser()
        #self.__browser.set_root_device(self.__root_dev)
        self.__browser.connect_folder_begin(self.__on_begin_folder)
        self.__browser.connect_folder_progress(self.__on_progress_folder)
        self.__browser.connect_folder_complete(self.__on_complete_folder)
        self.__browser.connect_file_opened(self.__on_open_file)
        self.__browser.connect_item_shifted(self.__on_shift_item)

        # toolbar
        self.__toolbar = Toolbar()

        self.__btn_home = ToolbarButton(theme.mb_btn_home_1)
        self.__btn_home.connect_clicked(self.__on_btn_home)

        self.__btn_history = ToolbarButton(theme.mb_btn_history_1)
        self.__btn_history.connect_clicked(self.__on_btn_history)

        self.__btn_bookmarks = ToolbarButton(theme.mb_btn_bookmark_1)
        self.__btn_bookmarks.connect_clicked(self.__on_btn_bookmarks)

        self.__btn_back = ToolbarButton(theme.mb_btn_dir_up_1)
        self.__btn_back.connect_clicked(self.__on_btn_back)

        self.__btn_select_all = ToolbarButton(theme.mb_btn_select_all_1)
        self.__btn_select_all.connect_clicked(self.__on_btn_select_all)

        self.__btn_select_none = ToolbarButton(theme.mb_btn_select_none_1)
        self.__btn_select_none.connect_clicked(self.__on_btn_select_none)

        self.__btn_select_done = ToolbarButton(theme.mb_btn_select_done_1)
        self.__btn_select_done.connect_clicked(self.__on_btn_select_done)

        # arrangement
        self.__arr = Arrangement()
        self.__arr.connect_resized(self.__update_layout)
        self.__arr.add(self.__now_playing, "now-playing")
        self.__arr.add(self.__browser, "browser")
        self.__arr.add(self.__toolbar, "toolbar")
        self.add(self.__arr)
        self.__arr.set_visible(False)

        # we have to fill the menu with content before showing the window on
        # Maemo5 or the window will show no menu at all
        self.__update_menu()

        self.set_visible(True)
Example #26
0
    def __init__(self):

        self.__schema = InputSchema(open(_SCHEMA_FILE).read())

        Component.__init__(self)
Example #27
0
 def __init__(self):
 
     Component.__init__(self)
Example #28
0
 def __init__(self):
 
     # table: (addr, port) -> listener
     self.__listeners = {}
 
     Component.__init__(self)
Example #29
0
    def __init__(self):

        self.__bookmarks = []

        Component.__init__(self)
Example #30
0
 def __init__(self):
 
     self.__homedir = os.path.expanduser("~")
 
     Component.__init__(self)