/usr/lib/python2.7/dist-packages/CairoDock.py is in cairo-dock-plug-ins-dbus-interface-python 3.0.0.1-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #!/usr/bin/python
#
# This is a part of the Cairo-Dock plug-ins.
# Copyright : (C) 2010-2011 by Fabounet
# E-mail : fabounet@glx-dock.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# http://www.gnu.org/licenses/licenses.html#GPL
# Base class for Cairo-Dock's main interface.
####################
### dependancies ###
####################
import os.path
import dbus
import re
USER_CONFIG_DIR = os.path.abspath("~/.config")
##################
### Main class ###
##################
class CairoDock:
#############
### Enums ###
#############
# orientation
BOTTOM = 0
TOP = 1
RIGHT = 2
LEFT = 3
# container type
DOCK = "Dock"
DESKLET = "Desklet"
# emblem position
EMBLEM_TOP_LEFT = 0
EMBLEM_BOTTOM_RIGHT = 1
EMBLEM_BOTTOM_LEFT = 2
EMBLEM_TOP_RIGHT = 3
EMBLEM_MIDDLE = 4
EMBLEM_BOTTOM = 5
EMBLEM_TOP = 6
EMBLEM_RIGHT = 7
EMBLEM_LEFT = 8
# emblem modifier (optionnal, add it to the emblem position)
EMBLEM_PERSISTENT = 0
EMBLEM_PRINT = 9
# module category
CATEGORY_BEHAVIOR = 0
CATEGORY_THEME = 1
CATEGORY_APPLET_FILES = 2
CATEGORY_APPLET_INTERNET = 3
CATEGORY_APPLET_DESKTOP = 4
CATEGORY_APPLET_ACCESSORY = 5
CATEGORY_APPLET_SYSTEM = 6
CATEGORY_APPLET_FUN = 7
# module type
CAN_DOCK = 1
CAN_DESKLET = 2
# icon type
TYPE_LAUNCHER = "Launcher"
TYPE_APPLICATION = "Application"
TYPE_APPLET = "Applet"
TYPE_SEPARATOR = "Separator"
TYPE_CONTAINER = "Container"
TYPE_CLASS_CONTAINER = "Class-Container"
TYPE_OTHER = "Other"
# toggle dock visibility
HIDE_DOCK = 0
SHOW_DOCK = 1
TOGGLE_DOCK = 2
#####################
### INIT AND DBUS ###
#####################
def __init__(self, app_name="cairo-dock"):
""" Initialize the interface.
It defines the following:
- cDataDir: main dir
- cCurrentThemeDir: current theme dir
- cConfFile : path to the global config file
"""
self.dock = None
self.cAppName = app_name
self.cDataDir = USER_CONFIG_DIR + '/' + app_name
self.cCurrentThemeDir = self.cDataDir + '/current_theme'
self.cLaunchersDir = self.cCurrentThemeDir + '/launchers'
self.cPluginsDir = self.cCurrentThemeDir + '/plug-ins'
self.cConfFile = self.cCurrentThemeDir + '/' + app_name + '.conf'
self._connect()
def _connect(self):
# get gldi on the bus.
bus = dbus.SessionBus()
name1 = self.cAppName.replace('-','') # -> cairodock
name2 = re.sub('-[a-z]', lambda x: x.group(0).upper(), self.cAppName)
name2 = re.sub('^[a-z]', lambda x: x.group(0).upper(), name2) # -> CairoDock
name2 = name2.replace('-','') # -> CairoDock
cBusPath = '/org/'+name1+'/'+name2
try:
dbus_object = bus.get_object("org.cairodock.CairoDock", cBusPath)
except:
print ">>> object '"+cBusPath+"' can't be found on the bus, exit.\nMake sure that Cairo-Dock is running"
return
self.iface = dbus.Interface(dbus_object, "org.cairodock.CairoDock") # this object represents gldi.
|