本文整理汇总了Python中extension.implements函数的典型用法代码示例。如果您正苦于以下问题:Python implements函数的具体用法?Python implements怎么用?Python implements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了implements函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CellRendererPlus
class CellRendererPlus(CellRendererFunction):
'''Nick renderer that parse the MSN+ markup, showing colors, gradients and
effects'''
NAME = 'Cell Renderer Plus'
DESCRIPTION = _('Parse MSN+ markup, showing colors, gradients and effects')
AUTHOR = 'Mariano Guerra'
WEBSITE = 'www.emesene.org'
def __init__(self):
global plus_or_noplus
plus_or_noplus = 1
CellRendererFunction.__init__(self, msnplus_to_list)
extension.implements(CellRendererPlus, 'nick renderer')
gobject.type_register(CellRendererPlus)
class CellRendererNoPlus(CellRendererFunction):
'''Nick renderer that "strip" MSN+ markup, not showing any effect/color,
but improving the readability'''
NAME = 'Cell Renderer No Plus'
DESCRIPTION = _('Strip MSN+ markup, not showing any effect/color, but improving the readability')
AUTHOR = 'Mariano Guerra'
WEBSITE = 'www.emesene.org'
def __init__(self):
global plus_or_noplus
示例2: SingleInstanceOption
# fix for gstreamer --help
argv = sys.argv
sys.argv = [argv[0]]
class SingleInstanceOption(object):
'''option parser'''
def option_register(self):
'''register the options to parse by the command line option parser'''
option = optparse.Option("-s", "--single",
action="count", dest="single_instance", default=False,
help="Allow only one instance of emesene")
return option
extension.implements('option provider')(SingleInstanceOption)
extension.get_category('option provider').activate(SingleInstanceOption)
class VerboseOption(object):
'''option parser'''
def option_register(self):
'''register the options to parse by the command line option parser'''
option = optparse.Option("-v", "--verbose",
action="count", dest="debuglevel", default=0,
help="Enable debug in console (add another -v to show debug)")
return option
extension.implements('option provider')(VerboseOption)
extension.get_category('option provider').activate(VerboseOption)
示例3: FONT_COLOR
'a': ('background', '#%s'),
'c': ('foreground', '#%s'),
'b': ('weight', 'bold'),
'u': ('underline', 'single'),
'i': ('style', 'italic'),
's': ('strikethrough', 'true'),
'$': ('foreground', '#%s'),
'#': ('weight', 'bold'),
'@': ('underline', 'single'),
'&': ('style', 'italic'),
'\'': ('strikethrough', 'true')
}
def FONT_COLOR(self, color):
return 'foreground=%s' % color
extension.implements('toolkit tags', GTKTags)
def safe_gtk_image_load(path, size=None):
'''try to return a gtk image from path, if fails, return a broken image'''
if file_readable(path):
pixbuf = safe_gtk_pixbuf_load(path, size)
return gtk.image_new_from_pixbuf(pixbuf)
else:
return gtk.image_new_from_stock(gtk.STOCK_MISSING_IMAGE,
gtk.ICON_SIZE_DIALOG)
def gtk_ico_image_load(path, icosize=None):
'''try to return a gtk image from path, if fails, return a broken image'''
if file_readable(path):
pixbuf = gtk_pixbuf_load(path)
iconset = gtk.IconSet(pixbuf)
示例4: GtkCellRenderer
import gobject
import e3
import gui
import utils
import extension
from debugger import dbg
from gui.base import Plus
import RichBuffer
class GtkCellRenderer(gtk.CellRendererText):
def __init__(self):
gtk.CellRendererText.__init__(self)
extension.implements(GtkCellRenderer, 'nick renderer')
class CellRendererFunction(gtk.GenericCellRenderer):
'''
CellRenderer that behaves like a label, but apply a function to "markup"
to show a modified nick. Its a base class, and it is intended to be
inherited by extensions.
'''
__gproperties__ = {
'markup': (gobject.TYPE_STRING,
"text",
"text we'll display (even with plus markup!)",
'', #default value
gobject.PARAM_READWRITE),
'ellipsize': (gobject.TYPE_BOOLEAN,
"",
示例5: send_typing_notification
account = self.account.account
message = e3.Message(e3.Message.TYPE_MESSAGE, text, account,
style)
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
def send_typing_notification(self, cid):
'''send typing notification to contact'''
pass
def request_attention(self, cid):
'''request the attention of the contact'''
account = self.account.account
message = e3.Message(e3.Message.TYPE_NUDGE,
'%s requests your attention' % (account, ), account)
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
def session_has_service(self, service):
'''returns True if some service is supported, False otherwise'''
if service in [Session.SERVICE_CONTACT_MANAGING,
Session.SERVICE_CONTACT_BLOCK,
Session.SERVICE_GROUP_MANAGING,
Session.SERVICE_CONTACT_INVITE,
Session.SERVICE_CALLS,
Session.SERVICE_FILETRANSFER]:
return False
return True
extension.implements(Session, 'session')
示例6: MinimizedOption
import interfaces
import gui
class MinimizedOption(object):
"""option parser"""
def option_register(self):
"""register the options to parse by the command line option parser"""
option = optparse.Option(
"-m", "--minimized", action="count", dest="minimized", default=False, help="Minimize emesene at start"
)
return option
extension.implements("option provider")(MinimizedOption)
extension.get_category("option provider").activate(MinimizedOption)
class SingleInstanceOption(object):
"""option parser"""
def option_register(self):
"""register the options to parse by the command line option parser"""
option = optparse.Option(
"-s",
"--single",
action="count",
dest="single_instance",
default=False,
help="Allow only one instance of emesene",
示例7: Worker
worker = Worker("emesene2", self, proxy, use_http)
worker.start()
# msn password must have 16 chars max.
password = password[:16]
# ------------------------------------
self.account = e3.Account(account, password, status, host)
self.add_action(e3.Action.ACTION_LOGIN, (account, password, status, host, port))
def send_message(self, cid, text, style=None, cedict=None, celist=None):
"""send a common message"""
if cedict is None:
cedict = {}
if celist is None:
celist = []
account = self.account.account
message = Message(Message.TYPE_MESSAGE, text, account, style)
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
def request_attention(self, cid):
"""send a nudge message"""
account = self.account.account
message = Message(Message.TYPE_NUDGE, None, account)
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
extension.implements(Session, "session")
示例8: CellRendererPlus
class CellRendererPlus(CellRendererFunction):
"""Nick renderer that parse the MSN+ markup, showing colors, gradients and
effects"""
NAME = "Cell Renderer Plus"
DESCRIPTION = _("Parse MSN+ markup, showing colors, gradients and effects")
AUTHOR = "Mariano Guerra"
WEBSITE = "www.emesene.org"
def __init__(self):
CellRendererFunction.__init__(self, True)
extension.implements(CellRendererPlus, "nick renderer")
class CellRendererNoPlus(CellRendererFunction):
"""Nick renderer that "strip" MSN+ markup, not showing any effect/color,
but improving the readability"""
NAME = "Cell Renderer No Plus"
DESCRIPTION = _("Strip MSN+ markup, not showing any effect/color, but improving the readability")
AUTHOR = "Mariano Guerra"
WEBSITE = "www.emesene.org"
def __init__(self):
CellRendererFunction.__init__(self, False)
示例9: __init__
def __init__(self):
pass
def option_register(self):
option = optparse.Option(
"-v",
"--verbose",
action="count",
dest="debuglevel",
default=0,
help="Enable debug in console (add another -v to show debug)",
)
return option
extension.implements("option provider")(VerboseOption)
extension.get_category("option provider").activate(VerboseOption)
class Controller(object):
"""class that handle the transition between states of the windows"""
def __init__(self):
"""class constructor"""
self.window = None
self.tray_icon = None
self.conversations = None
self.config = e3.common.Config()
self.config_dir = e3.common.ConfigDir("emesene2")
self.config_path = self.config_dir.join("config")
self.config.load(self.config_path)