本文整理汇总了Python中database.DataBase.get_default方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.get_default方法的具体用法?Python DataBase.get_default怎么用?Python DataBase.get_default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database.DataBase
的用法示例。
在下文中一共展示了DataBase.get_default方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __send_message
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get_default [as 别名]
def __send_message(self, number, message, status):
from way2sms import send
import time
database = DataBase()
customer_id = database.get_default()[2]
for text in message:
text = text.strip()
status[number][0] = status[number][0] and send(customer_id, number, text)
time.sleep(1.4)
status[number][1] = True
return
示例2: re_log_in
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get_default [as 别名]
def re_log_in(unused_widget, unused_event):
from way2sms import login
import time
database = DataBase()
user = database.get_default()
thread.start_new_thread(login, (str(user[0]), user[1], True))
database.close()
time.sleep(3.4)
self.__generalize_status_bar()
self.__push_status_message('<span font_desc="belgrano 10"><b> Try to <span foreground="#0000FF">re send</span> once more</b></span>')
return
示例3: __init__
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get_default [as 别名]
def __init__(self):
super(AccountManager, self).__init__()
self.set_size_request(260, 220)
self.set_modal(True)
self.set_title('Account Manager')
self.set_icon_from_file(ICON_PATH + '/admin.png')
vbox = gtk.VBox(True, 4)
scroll = gtk.ScrolledWindow()
scroll.set_size_request(140, -1)
scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.set_border_width(8)
alignment = gtk.Alignment(0.5, 0, 0, 0)
alignment.set_border_width(8)
from database import DataBase
database = DataBase()
users = database.get_user()
def mark_default(radio):
'mark the default user bold faced'
for radio in radio.get_group():
if radio.get_active():
number = radio.get_label()
radio.get_child().set_markup('<span font_desc="CrashNumberingGothic">\
<b>' + number + '</b></span>')
continue
radio.get_child().set_markup('<span font_desc="CrashNumberingGothic">' +
radio.get_label() + '</span>')
return
radio = gtk.RadioButton(None, str(users[0][0]))
radio.connect('toggled', mark_default)
vbox.pack_start(radio)
for user in users[1:]:
vbox.pack_start(gtk.RadioButton(radio, str(user[0])))
default_user = str(database.get_default()[0])
database.close()
for radio in radio.get_group():
if radio.get_label() == default_user:
radio.set_active(True)
break
mark_default(radio)
alignment.add(vbox)
scroll.add_with_viewport(alignment)
scroll.get_child().modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse('#ffffff'))
vbox = gtk.VBox(False, 4)
vbox.pack_start(scroll, True, True)
hbox = gtk.HBox(True, 10)
add = Button(ICON_PATH + '/add-account.png', 'Add New Account', 30, 30)
add.connect('clicked', self.__add_user, radio, vbox)
remove = Button(ICON_PATH + '/remove-account.png', 'Remove Account',
30, 30)
remove.connect('clicked', self.__remove_user, radio, vbox)
save = Button(ICON_PATH + '/save.png', 'Save Account\n Information',
30, 30)
save.connect('clicked', self.__save, radio)
hbox.pack_start(add)
hbox.pack_start(remove)
alignment = gtk.Alignment(0.5, 0, 0, 0)
alignment.add(hbox)
vbox.pack_start(alignment, False, False)
alignment = gtk.Alignment(0.5, 0, 0, 0)
alignment.add(save)
vbox.pack_start(alignment, False, False)
self.add(vbox)
self.connect('destroy', self.__save, radio)
self.show_all()