示例#1
0
 def start_url(self, url):
     if '?' in url:
         url += '&'
     else:
         url += '?'
     url += 'XDEBUG_SESSION_START=vim_phpdebug'
     self._type = 'php'
     try:
         import gconf
         browser = gconf.Client().get_string('/desktop/gnome/applications/browser/exec')
         if browser is None:
             raise ValueError
         subprocess.Popen((browser, url), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     except ImportError: # don't have gconf
         print 'gconf not found...',
     except ValueError:
         print 'no default browser found...',
     except OSError:
         print 'default browser failed...',
     else:
         return self.start()
     # TODO: allow custom browsers
     print 'trying chrome, firefox'
     try:
         subprocess.Popen(('google-chrome', url), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     except OSError:
         try:
             subprocess.Popen(('firefox', url), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         except OSError:
             print 'neither chrome nor firefox were found. failed to start debug session.'
             return
     return self.start()
示例#2
0
 def __init__(self):
     client = gconf.Client()
     for i in client.all_dirs(LOCATION):
         myconnection = Connection(i)
         for j in client.all_entries(i):
             setattr(myconnection, gconfname(j.get_key()),
                     extract_value(j.get_value()))
             setattr(self, gconfname(i), myconnection)
示例#3
0
def get_gnome_fonts():
    """test if gnome font settings exist"""
    try:
        import gconf
    except ImportError:
        return
    gconf_client = gconf.Client()
    fonts = {'document': '', 'monospace': ''}
    try:
        for font in fonts.keys():
            fonts[font] = gconf_client.get_value(
                '/desktop/gnome/interface/%s_font_name' % font)
    except ValueError:
        return
    else:
        return fonts
示例#4
0
    def __init__(self):
        self.client = gconf.Client()
        if self.client.dir_exists(PROFILE_TERMROOM):
            self.profile = PROFILE_TERMROOM
        else:
            self.profile = PROFILE_DEFAULT

        if self["use_system_font"]:
            self.font = self.client.get(SYSTEM_FONT).get_string()

        if self["use_theme_colors"]:
            colors = {}
            lines = self.client.get(SYSTEM_COLORS).get_string().split("\n")
            for line in lines:
                var, color = line.split(":")
                colors[var] = color
            self.background_color = colors['bg_color']
            self.foreground_color = colors['fg_color']
 def __init__(self, root=None, preload=None, gconf_client=None):
     self._gconf = gconf.Client() or gconf_client
     self._preload = preload or gconf.CLIENT_PRELOAD_RECURSIVE
     if root:
         self.set_root(root)
 def get_profiles(self):
     gc = gconf.Client()
     profiles = gc.all_dirs("/apps/gnome-terminal/profiles")
     for profile in profiles:
         visible_name = gc.get_string(profile + "/visible_name")
         self.profiles.append(visible_name)
示例#7
0
import conduit.utils as Utils
import conduit.Exceptions as Exceptions
import conduit.dataproviders.DataProvider as DataProvider
import conduit.datatypes.Audio as Audio

from gettext import gettext as _

BANSHEE_INSTALLED = False
BANSHEE_VERSION_1 = False
BANSHEE_BASE_LOCATION = ""

if Utils.program_installed("banshee-1"):
    BANSHEE_INSTALLED = True
    BANSHEE_VERSION_1 = True
    import gconf
    BANSHEE_BASE_LOCATION = "file://%s/" % gconf.Client().get_string(
        "/apps/banshee-1/library/base_location")
elif Utils.program_installed("banshee"):
    BANSHEE_INSTALLED = True

if BANSHEE_INSTALLED:
    MODULES = {"BansheeSource": {"type": "dataprovider"}}
else:
    MODULES = {}

(ID_IDX, NAME_IDX, CHECKED_IDX, TYPE_IDX) = range(4)
(SMART_PLAYLIST, NORMAL_PLAYLIST,
 VIDEO_PLAYLIST) = range(1, 4)  # FIXME should these be hard coded?


class BansheeSource(DataProvider.DataSource):