本文整理匯總了Python中gtk.BUTTONS_CLOSE屬性的典型用法代碼示例。如果您正苦於以下問題:Python gtk.BUTTONS_CLOSE屬性的具體用法?Python gtk.BUTTONS_CLOSE怎麽用?Python gtk.BUTTONS_CLOSE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類gtk
的用法示例。
在下文中一共展示了gtk.BUTTONS_CLOSE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _ebFailedLogin
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def _ebFailedLogin(self, reason):
if isinstance(reason, failure.Failure):
reason = reason.value
self.statusMsg(reason)
if isinstance(reason, (unicode, str)):
text = reason
else:
text = unicode(reason)
msg = gtk.MessageDialog(self._loginDialog,
gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_ERROR,
gtk.BUTTONS_CLOSE,
text)
msg.show_all()
msg.connect("response", lambda *a: msg.destroy())
# hostname not found
# host unreachable
# connection refused
# authentication failed
# no such service
# no such perspective
# internal server error
示例2: _error
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def _error(self, msg):
err = gtk.MessageDialog(dialog,
gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR,
gtk.BUTTONS_CLOSE,
msg
)
err.run()
err.destroy()
示例3: on_new
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def on_new(self, button, data):
(dialog,enabled,name,command) = self._create_command_dialog()
res = dialog.run()
item = {}
if res == gtk.RESPONSE_ACCEPT:
item['enabled'] = enabled.get_active()
item['name'] = name.get_text()
item['command'] = command.get_text()
if item['name'] == '' or item['command'] == '':
err = gtk.MessageDialog(dialog,
gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR,
gtk.BUTTONS_CLOSE,
_("You need to define a name and command")
)
err.run()
err.destroy()
else:
# we have a new command
store = data['treeview'].get_model()
iter = store.get_iter_first()
name_exist = False
while iter != None:
if store.get_value(iter,CC_COL_NAME) == item['name']:
name_exist = True
break
iter = store.iter_next(iter)
if not name_exist:
store.append((item['enabled'], item['name'], item['command']))
else:
self._err(_("Name *%s* already exist") % item['name'])
dialog.destroy()
示例4: message
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def message(self, text, title):
dlg = gtk.MessageDialog(self.window,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO,
gtk.BUTTONS_CLOSE,
title)
dlg.set_title(title)
dlg.format_secondary_text(text)
dlg.run()
dlg.destroy()
示例5: message
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def message(self, data):
"""Function to display messages to the user
"""
msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO,
gtk.BUTTONS_CLOSE, data)
msg.set_resizable(1)
msg.set_title(self.dialog_title)
self.img.set_from_file(self.sun_icon)
msg.set_image(self.img)
msg.show_all()
msg.run()
msg.destroy()
示例6: on_edit
# 需要導入模塊: import gtk [as 別名]
# 或者: from gtk import BUTTONS_CLOSE [as 別名]
def on_edit(self, button, data):
treeview = data['treeview']
selection = treeview.get_selection()
(store, iter) = selection.get_selected()
if not iter:
return
(dialog,enabled,name,command) = self._create_command_dialog(
enabled_var = store.get_value(iter, CC_COL_ENABLED),
name_var = store.get_value(iter, CC_COL_NAME),
command_var = store.get_value(iter, CC_COL_COMMAND)
)
res = dialog.run()
item = {}
if res == gtk.RESPONSE_ACCEPT:
item['enabled'] = enabled.get_active()
item['name'] = name.get_text()
item['command'] = command.get_text()
if item['name'] == '' or item['command'] == '':
err = gtk.MessageDialog(dialog,
gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR,
gtk.BUTTONS_CLOSE,
_("You need to define a name and command")
)
err.run()
err.destroy()
else:
tmpiter = store.get_iter_first()
name_exist = False
while tmpiter != None:
if store.get_path(tmpiter) != store.get_path(iter) and store.get_value(tmpiter,CC_COL_NAME) == item['name']:
name_exist = True
break
tmpiter = store.iter_next(tmpiter)
if not name_exist:
store.set(iter,
CC_COL_ENABLED,item['enabled'],
CC_COL_NAME, item['name'],
CC_COL_COMMAND, item['command']
)
else:
self._err(_("Name *%s* already exist") % item['name'])
dialog.destroy()