Python gobject.GObject() Examples

The following are 8 code examples of gobject.GObject(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gobject , or try the search function .
Example #1
Source File: config.py    From QMusic with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self, config_file, default_config=None):
        '''
        Init config module.

        @param config_file: Config filepath.
        @param default_config: Default config value use when config file is empty.
        '''
        gobject.GObject.__init__(self)
        self.config_parser = ConfigParser()
        self.remove_option = self.config_parser.remove_option
        self.has_option = self.config_parser.has_option
        self.add_section = self.config_parser.add_section
        self.getboolean = self.config_parser.getboolean
        self.getint = self.config_parser.getint
        self.getfloat = self.config_parser.getfloat
        self.options = self.config_parser.options
        self.items = self.config_parser.items
        self.config_file = config_file
        self.default_config = default_config

        # Load default configure.
        self.load_default() 
Example #2
Source File: intelligent_text_completion.py    From gedit-intelligent-text-completion with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self):

        gobject.GObject.__init__(self)
        self.__gconfDir = "/apps/gedit-2/plugins/intelligent_text_completion"

        # default values
        self.closeBracketsAndQuotes = True
        self.completeXML = True
        self.detectLists = True
        self.autoindentAfterFunctionOrList = True
    
        # create gconf directory if not set yet
        client = gconf.client_get_default()        
        if not client.dir_exists(self.__gconfDir):
            client.add_dir(self.__gconfDir,gconf.CLIENT_PRELOAD_NONE)
        
        if client.dir_exists(self.__gconfDir+"/closeBracketsAndQuotes"):
            # get the gconf keys, or stay with default if key not set
            try:
                self.closeBracketsAndQuotes = client.get_bool(self.__gconfDir+"/closeBracketsAndQuotes")
                self.completeXML = client.get_bool(self.__gconfDir+"/completeXML")
                self.detectLists = client.get_bool(self.__gconfDir+"/detectLists")
                self.autoindentAfterFunctionOrList = client.get_bool(self.__gconfDir+"/autoindentAfterFunctionOrList")
            except Exception, e: # catch, just in case
                print e 
Example #3
Source File: glib.py    From multibootusb with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, monitor):
        gobject.GObject.__init__(self)
        self._setup_observer(monitor) 
Example #4
Source File: glib.py    From multibootusb with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, monitor):
        gobject.GObject.__init__(self)
        self._setup_observer(monitor)
        import warnings
        warnings.warn('Will be removed in 1.0. '
                      'Use pyudev.glib.MonitorObserver instead.',
                      DeprecationWarning) 
Example #5
Source File: chart_object.py    From openxenmanager with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        gobject.GObject.__init__(self)
        self._show = True
        self._antialias = True 
Example #6
Source File: BaseMediaEngine.py    From tapas with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, min_queue_time=10):
        gobject.GObject.__init__(self)
        self.min_queue_time = min_queue_time
        self.is_runnning = False
        self.status = self.PAUSED
        self.video_container = None 
Example #7
Source File: util.py    From tapas with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, period=0.5, alpha=0.5):
        gobject.GObject.__init__(self)
        self.period = period
        self.alpha = alpha
        self.last_t = 0.0
        self.last_data = 0
        self.rate = 0.0
        self.rate_filt = -1
        self.horizon = 5
        self.rate_vec = CircularBuffer(self.horizon)
        self.running = False
        self.calc_iteration_id = None 
Example #8
Source File: connection.py    From tapas with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, url):
        gobject.GObject.__init__(self)
        #
        debug(DEBUG+1, '%s init %s', self, url)
        self.url = url
        self.host, self.port, self.path = parse_url(url)
        self.client = None
        self.connector = reactor.connectTCP(self.host, self.port, self)