本文整理汇总了Python中gobject.TYPE_STRING属性的典型用法代码示例。如果您正苦于以下问题:Python gobject.TYPE_STRING属性的具体用法?Python gobject.TYPE_STRING怎么用?Python gobject.TYPE_STRING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gobject
的用法示例。
在下文中一共展示了gobject.TYPE_STRING属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__(self, path="gnome-connection-manager.glade",
root="wHost",
domain=domain_name, **kwargs):
path = os.path.join(glade_dir, path)
SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
self.treeModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
self.treeTunel.set_model(self.treeModel)
column = gtk.TreeViewColumn(_("Local"), gtk.CellRendererText(), text=0)
self.treeTunel.append_column( column )
column = gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1)
self.treeTunel.append_column( column )
column = gtk.TreeViewColumn(_("Remoto"), gtk.CellRendererText(), text=2)
self.treeTunel.append_column( column )
#-- Whost.new {
示例2: new
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def new(self):
self.treeHosts = self.get_widget('treeHosts')
self.treeStore = gtk.TreeStore( gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_OBJECT )
for x in self.terms:
self.treeStore.append( None, (False, x[0], x[1]) )
self.treeHosts.set_model( self.treeStore )
crt = gtk.CellRendererToggle()
crt.set_property('activatable', True)
crt.connect('toggled', self.on_active_toggled)
col = gtk.TreeViewColumn(_("Activar"), crt, active=0)
self.treeHosts.append_column( col )
self.treeHosts.append_column(gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1 ))
self.get_widget("txtCommands").history = []
#-- Wcluster.new }
#-- Wcluster custom methods {
# Write your own methods here
示例3: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__(self):
"""Class initialiser"""
self.terminator = Terminator()
self.maker = Factory()
Container.__init__(self)
self.signals.append({'name': 'resize-term',
'flags': gobject.SIGNAL_RUN_LAST,
'return_type': gobject.TYPE_NONE,
'param_types': (gobject.TYPE_STRING,)})
# pylint: disable-msg=W0613
示例4: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__(self, items=()):
gtk.Dialog.__init__(self)
self.ret = None
self._started = 0
self.connect("destroy", self.quit)
self.connect("delete_event", self.quit)
self.set_geometry_hints(min_width=250, min_height=300)
scrolled_win = gtk.ScrolledWindow()
scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolled_win.show()
self.vbox.pack_start(scrolled_win)
#self.vbox.show()
button = gtk.Button("Cancel")
button.connect("clicked", self.cancel)
button.set_flags(gtk.CAN_DEFAULT)
self.action_area.pack_start(button)
button.show()
ls = gtk.ListStore(gobject.TYPE_STRING)
for item in items:
iter = ls.append()
ls.set(iter, 0, item)
lister = gtk.TreeView(ls)
selection = lister.get_selection()
selection.set_mode(gtk.SELECTION_BROWSE)
selection.unselect_all()
lister.set_search_column(0)
scrolled_win.add_with_viewport(lister)
column = gtk.TreeViewColumn('Keyword', gtk.CellRendererText(), text=0)
lister.append_column(column)
lister.set_headers_visible(False)
lister.connect("row-activated", self.row_activated)
lister.show()
示例5: initLeftPane
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def initLeftPane(self):
global groups
self.treeModel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gtk.gdk.Pixbuf)
self.treeServers.set_model(self.treeModel)
self.treeServers.set_level_indentation(5)
#Force the alternating row colors, by default it's off with one column
self.treeServers.set_property('rules-hint', True)
gtk.rc_parse_string( """
style "custom-treestyle"{
GtkTreeView::allow-rules = 1
}
widget "*treeServers*" style "custom-treestyle"
""")
column = gtk.TreeViewColumn()
column.set_title('Servers')
self.treeServers.append_column( column )
renderer = gtk.CellRendererPixbuf()
column.pack_start(renderer, expand=False)
column.add_attribute(renderer, 'pixbuf', 2)
renderer = gtk.CellRendererText()
column.pack_start(renderer, expand=True)
column.add_attribute(renderer, 'text', 0)
self.treeServers.set_has_tooltip(True)
self.treeServers.connect('query-tooltip', self.on_treeServers_tooltip)
self.loadConfig()
self.updateTree()
示例6: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__ (self,
title = 'Save file',
parent = None,
action = gtk.FILE_CHOOSER_ACTION_SAVE,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK),
path = None,
filetypes = [],
default_filetype = None
):
super(FileChooserDialog, self).__init__ (title, parent, action,
buttons)
super(FileChooserDialog, self).set_do_overwrite_confirmation(True)
self.set_default_response (gtk.RESPONSE_OK)
if not path: path = os.getcwd() + os.sep
# create an extra widget to list supported image formats
self.set_current_folder (path)
self.set_current_name ('image.' + default_filetype)
hbox = gtk.HBox (spacing=10)
hbox.pack_start (gtk.Label ("File Format:"), expand=False)
liststore = gtk.ListStore(gobject.TYPE_STRING)
cbox = gtk.ComboBox(liststore)
cell = gtk.CellRendererText()
cbox.pack_start(cell, True)
cbox.add_attribute(cell, 'text', 0)
hbox.pack_start (cbox)
self.filetypes = filetypes
self.sorted_filetypes = filetypes.items()
self.sorted_filetypes.sort()
default = 0
for i, (ext, name) in enumerate(self.sorted_filetypes):
cbox.append_text ("%s (*.%s)" % (name, ext))
if ext == default_filetype:
default = i
cbox.set_active(default)
self.ext = default_filetype
def cb_cbox_changed (cbox, data=None):
"""File extension changed"""
head, filename = os.path.split(self.get_filename())
root, ext = os.path.splitext(filename)
ext = ext[1:]
new_ext = self.sorted_filetypes[cbox.get_active()][0]
self.ext = new_ext
if ext in self.filetypes:
filename = root + '.' + new_ext
elif ext == '':
filename = filename.rstrip('.') + '.' + new_ext
self.set_current_name (filename)
cbox.connect ("changed", cb_cbox_changed)
hbox.show_all()
self.set_extra_widget(hbox)
示例7: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__ (self,
title = 'Save file',
parent = None,
action = gtk.FILE_CHOOSER_ACTION_SAVE,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK),
path = None,
filetypes = [],
default_filetype = None
):
super(FileChooserDialog, self).__init__ (title, parent, action,
buttons)
super(FileChooserDialog, self).set_do_overwrite_confirmation(True)
self.set_default_response (gtk.RESPONSE_OK)
if not path: path = os.getcwd() + os.sep
# create an extra widget to list supported image formats
self.set_current_folder (path)
self.set_current_name ('image.' + default_filetype)
hbox = gtk.HBox (spacing=10)
hbox.pack_start (gtk.Label ("File Format:"), expand=False)
liststore = gtk.ListStore(gobject.TYPE_STRING)
cbox = gtk.ComboBox(liststore)
cell = gtk.CellRendererText()
cbox.pack_start(cell, True)
cbox.add_attribute(cell, 'text', 0)
hbox.pack_start (cbox)
self.filetypes = filetypes
self.sorted_filetypes = list(six.iteritems(filetypes))
self.sorted_filetypes.sort()
default = 0
for i, (ext, name) in enumerate(self.sorted_filetypes):
cbox.append_text ("%s (*.%s)" % (name, ext))
if ext == default_filetype:
default = i
cbox.set_active(default)
self.ext = default_filetype
def cb_cbox_changed (cbox, data=None):
"""File extension changed"""
head, filename = os.path.split(self.get_filename())
root, ext = os.path.splitext(filename)
ext = ext[1:]
new_ext = self.sorted_filetypes[cbox.get_active()][0]
self.ext = new_ext
if ext in self.filetypes:
filename = root + '.' + new_ext
elif ext == '':
filename = filename.rstrip('.') + '.' + new_ext
self.set_current_name (filename)
cbox.connect ("changed", cb_cbox_changed)
hbox.show_all()
self.set_extra_widget(hbox)
示例8: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__(self):
self.main_window_xml = gtk.glade.XML(GLADEFILE, "bluezchat_window")
# connect our signal handlers
dic = { "on_quit_button_clicked" : self.quit_button_clicked,
"on_send_button_clicked" : self.send_button_clicked,
"on_chat_button_clicked" : self.chat_button_clicked,
"on_scan_button_clicked" : self.scan_button_clicked,
"on_devices_tv_cursor_changed" : self.devices_tv_cursor_changed
}
self.main_window_xml.signal_autoconnect(dic)
# prepare the floor listbox
self.devices_tv = self.main_window_xml.get_widget("devices_tv")
self.discovered = gtk.ListStore(gobject.TYPE_STRING,
gobject.TYPE_STRING)
self.devices_tv.set_model(self.discovered)
renderer = gtk.CellRendererText()
column1=gtk.TreeViewColumn("addr", renderer, text=0)
column2=gtk.TreeViewColumn("name", renderer, text=1)
self.devices_tv.append_column(column1)
self.devices_tv.append_column(column2)
self.quit_button = self.main_window_xml.get_widget("quit_button")
self.scan_button = self.main_window_xml.get_widget("scan_button")
self.chat_button = self.main_window_xml.get_widget("chat_button")
self.send_button = self.main_window_xml.get_widget("send_button")
self.main_text = self.main_window_xml.get_widget("main_text")
self.text_buffer = self.main_text.get_buffer()
self.input_tb = self.main_window_xml.get_widget("input_tb")
self.listed_devs = []
self.chat_button.set_sensitive(False)
self.peers = {}
self.sources = {}
self.addresses = {}
# the listening sockets
self.server_sock = None
# --- gui signal handlers
示例9: __init__
# 需要导入模块: import gobject [as 别名]
# 或者: from gobject import TYPE_STRING [as 别名]
def __init__ (self,
title = 'Save file',
parent = None,
action = gtk.FILE_CHOOSER_ACTION_SAVE,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK),
path = None,
filetypes = [],
default_filetype = None
):
super(FileChooserDialog, self).__init__(title, parent, action, buttons)
super(FileChooserDialog, self).set_do_overwrite_confirmation(True)
self.set_default_response(gtk.RESPONSE_OK)
if not path:
path = os.getcwd() + os.sep
# create an extra widget to list supported image formats
self.set_current_folder (path)
self.set_current_name ('image.' + default_filetype)
hbox = gtk.HBox(spacing=10)
hbox.pack_start(gtk.Label ("File Format:"), expand=False)
liststore = gtk.ListStore(gobject.TYPE_STRING)
cbox = gtk.ComboBox(liststore)
cell = gtk.CellRendererText()
cbox.pack_start(cell, True)
cbox.add_attribute(cell, 'text', 0)
hbox.pack_start(cbox)
self.filetypes = filetypes
self.sorted_filetypes = sorted(six.iteritems(filetypes))
default = 0
for i, (ext, name) in enumerate(self.sorted_filetypes):
cbox.append_text("%s (*.%s)" % (name, ext))
if ext == default_filetype:
default = i
cbox.set_active(default)
self.ext = default_filetype
def cb_cbox_changed (cbox, data=None):
"""File extension changed"""
head, filename = os.path.split(self.get_filename())
root, ext = os.path.splitext(filename)
ext = ext[1:]
new_ext = self.sorted_filetypes[cbox.get_active()][0]
self.ext = new_ext
if ext in self.filetypes:
filename = root + '.' + new_ext
elif ext == '':
filename = filename.rstrip('.') + '.' + new_ext
self.set_current_name(filename)
cbox.connect("changed", cb_cbox_changed)
hbox.show_all()
self.set_extra_widget(hbox)