本文整理汇总了Python中turpial.ui.lang.i18n.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, base):
QWidget.__init__(self)
self.base = base
self.showed = False
self.setFixedSize(500, 120)
self.text_edit = CompletionTextEdit()
self.upload_button = ImageButton(base, 'action-upload.png',
i18n.get('upload_image'))
self.short_button = ImageButton(base, 'action-shorten.png',
i18n.get('short_urls'))
font = QFont()
font.setPointSize(18)
font.setBold(True)
self.char_count = QLabel('140')
self.char_count.setFont(font)
self.update_button = QPushButton(i18n.get('update'))
self.update_button.setToolTip(self.base.get_shortcut_string('Enter'))
self.queue_button = QPushButton(i18n.get('add_to_queue'))
self.queue_button.setToolTip(self.base.get_shortcut_string('P'))
self.accounts_combo = QComboBox()
buttons = QHBoxLayout()
buttons.setSpacing(4)
buttons.addWidget(self.accounts_combo)
buttons.addWidget(self.upload_button)
buttons.addWidget(self.short_button)
buttons.addStretch(0)
buttons.addWidget(self.char_count)
buttons.addWidget(self.queue_button)
buttons.addWidget(self.update_button)
self.loader = BarLoadIndicator()
self.error_message = ErrorLabel()
self.update_button.clicked.connect(self.__update_status)
self.queue_button.clicked.connect(self.__queue_status)
self.short_button.clicked.connect(self.__short_urls)
self.upload_button.clicked.connect(self.__upload_image)
self.text_edit.textChanged.connect(self.__update_count)
self.text_edit.quit.connect(self.closeEvent)
self.text_edit.activated.connect(self.__update_status)
self.text_edit.enqueued.connect(self.__queue_status)
layout = QVBoxLayout()
layout.setSpacing(0)
layout.addWidget(self.text_edit)
layout.addWidget(self.loader)
layout.addSpacing(5)
layout.addWidget(self.error_message)
layout.addLayout(buttons)
layout.setContentsMargins(5, 5, 5, 5)
self.setLayout(layout)
self.__clear()
示例2: update
def update(self):
if self.showed:
self.model.clear()
empty = True
self.btn_login.set_sensitive(False)
self.btn_delete.set_sensitive(False)
for acc in self.base.get_all_accounts():
empty = False
imagename = "%s.png" % acc.protocol_id
pix = self.base.load_image(imagename, True)
username = "<span size='large'><b>%s</b></span>" % acc.username
status = ""
status_pix = None
if acc.logged_in == LoginStatus.NONE:
status = i18n.get("disconnected")
status_pix = self.base.load_image("mark-disconnected.png", True)
elif acc.logged_in == LoginStatus.IN_PROGRESS:
status = i18n.get("connecting...")
status_pix = self.base.load_image("mark-connecting.png", True)
elif acc.logged_in == LoginStatus.DONE:
status = i18n.get("connected")
status_pix = self.base.load_image("mark-connected.png", True)
self.model.append([pix, username, status_pix, status, acc])
del pix
del status_pix
if empty:
self.btn_login.set_label(i18n.get("login"))
else:
self.acc_list.set_cursor((0,))
示例3: __show
def __show(self):
self.update_friends_list()
short_service = self.base.get_shorten_url_service()
short_tooltip = "%s (%s)" % (i18n.get('short_url'), short_service)
self.short_button.setToolTip(short_tooltip)
upload_service = self.base.get_upload_media_service()
upload_tooltip = "%s (%s)" % (i18n.get('upload_image'), upload_service)
self.upload_button.setToolTip(upload_tooltip)
self.accounts_combo.clear()
accounts = self.base.core.get_registered_accounts()
if len(accounts) > 1:
self.accounts_combo.addItem('--', '')
for account in accounts:
protocol = get_protocol_from(account.id_)
icon = QIcon(self.base.get_image_path('%s.png' % protocol))
self.accounts_combo.addItem(icon, get_username_from(account.id_), account.id_)
if len(accounts) > 1:
icon = QIcon(self.base.get_image_path('action-conversation.png'))
self.accounts_combo.addItem(icon, i18n.get('broadcast'), 'broadcast')
if self.account_id:
index = self.accounts_combo.findData(self.account_id)
if index > 0:
self.accounts_combo.setCurrentIndex(index)
self.accounts_combo.setEnabled(False)
if self.message:
self.text_edit.setText(self.message)
cursor = self.text_edit.textCursor()
cursor.movePosition(self.cursor_position, QTextCursor.MoveAnchor)
self.text_edit.setTextCursor(cursor)
QWidget.show(self)
self.showed = True
示例4: __login_action_tag
def __login_action_tag(self, account):
if account.logged_in == LoginStatus.NONE:
return "<a href='cmd:login:%s'>%s</a>" % (account.id_, i18n.get('login'))
elif account.logged_in == LoginStatus.IN_PROGRESS:
return "<span class=\"progress\">%s</span>" % (i18n.get('in_progress'))
elif account.logged_in == LoginStatus.DONE:
return "<span class=\"done\">%s</span>" % (i18n.get('logged_in'))
示例5: __init__
def __init__(self, base, url):
QDialog.__init__(self)
self.base = base
self.setWindowTitle(i18n.get('authorize_turpial'))
self.resize(800, 550)
self.setModal(True)
self.webview = QWebView()
qurl = QUrl(url)
self.webview.setUrl(qurl)
message = QLabel(i18n.get('copy_the_pin'))
#message.setAlignment(Qt.AlignRight)
self.pin = QLineEdit()
self.pin.setPlaceholderText(i18n.get('type_the_pin'))
authorize_btn = QPushButton(i18n.get('save'))
authorize_btn.clicked.connect(self.accept)
widgets_box = QHBoxLayout()
widgets_box.setSpacing(3)
widgets_box.setContentsMargins(3, 3, 3, 3)
widgets_box.addWidget(message, 1)
widgets_box.addWidget(self.pin)
widgets_box.addWidget(authorize_btn)
layout = QVBoxLayout()
layout.addWidget(self.webview)
layout.addLayout(widgets_box)
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.exec_()
示例6: __repeat_item
def __repeat_item(self, status):
# TODO: Validates if is protected
if not status.is_own:
if status.get_protocol_id() == ProtocolType.TWITTER:
qt = "RT @%s %s" % (status.username, status.text)
if status.retweeted:
repeat = Gtk.MenuItem(i18n.get('retweeted'))
repeat.connect('activate', self.__on_unrepeat, status)
else:
repeat = Gtk.MenuItem(i18n.get('retweet'))
repeat.connect('activate', self.__on_repeat, status)
elif status.get_protocol_id() == ProtocolType.IDENTICA:
qt = "RD @%s %s" % (status.username, status.text)
if status.repeated:
repeat = Gtk.MenuItem(i18n.get('redented'))
repeat.connect('activate', self.__on_unrepeat, status)
else:
repeat = Gtk.MenuItem(i18n.get('redent'))
repeat.connect('activate', self.__on_repeat, status)
quote = Gtk.MenuItem(i18n.get('quote'))
quote.connect('activate', self.__on_quote, qt)
self.append(repeat)
self.append(quote)
示例7: __init__
def __init__(self, base):
ModalDialog.__init__(self, 320, 250)
self.setWindowTitle(i18n.get('about_turpial'))
icon = QLabel()
icon.setPixmap(base.load_image('turpial.png', True))
icon.setAlignment(Qt.AlignCenter)
app_name = QLabel("<b>Turpial %s</b>" % VERSION)
app_name.setAlignment(Qt.AlignCenter)
app_description = QLabel(i18n.get('about_description'))
app_description.setAlignment(Qt.AlignCenter)
copyright = QLabel('Copyleft (C) 2009 - 2013 Wil Alvarez')
copyright.setAlignment(Qt.AlignCenter)
close_button = QPushButton(i18n.get('close'))
close_button.clicked.connect(self.__on_close)
button_box = QHBoxLayout()
button_box.addStretch(1)
button_box.setSpacing(4)
button_box.addWidget(close_button)
vbox = QVBoxLayout()
vbox.setSpacing(10)
vbox.addWidget(icon, 1)
vbox.addWidget(app_name)
vbox.addWidget(app_description)
vbox.addWidget(copyright)
vbox.addLayout(button_box)
self.setLayout(vbox)
self.exec_()
示例8: __short_url
def __short_url(self, widget):
self.lock(i18n.get('shorting_urls'))
message = self.update_text.get_text()
if len(message) == 0:
self.unlock(i18n.get('no_url_to_short'))
else:
self.base.autoshort_url(message)
示例9: updates
def updates(self, column, count, filtered=0):
if count > 1:
message = i18n.get('new_tweets_updated') % count
else:
message = i18n.get('new_tweet_updated')
title = " ".join([i18n.get('updated'), column.slug])
self.notify(title, message)
示例10: __on_config_restore
def __on_config_restore(self):
confirmation = self.base.show_confirmation_message(
i18n.get("confirm_restore"), i18n.get("do_you_want_to_restore_config")
)
if confirmation:
self.base.restore_config()
self.base.show_information_message(i18n.get("restart_turpial"), i18n.get("config_restored_successfully"))
self.base.main_quit()
示例11: __delete_all
def __delete_all(self):
self.__disable()
message = i18n.get('clear_message_queue_confirm')
confirmation = self.base.show_confirmation_message(i18n.get('confirm_delete'),
message)
if not confirmation:
self.__enable()
return
self.base.clear_queue()
示例12: __fav_item
def __fav_item(self, status):
if status.favorited:
unfav = Gtk.MenuItem(i18n.get('favorited'))
unfav.connect('activate', self.__on_unfavorite, status)
self.append(unfav)
else:
fav = Gtk.MenuItem(i18n.get('favorite'))
fav.connect('activate', self.__on_favorite, status)
self.append(fav)
示例13: __delete_all
def __delete_all(self):
self.__enable(False)
message = i18n.get('clear_filters_confirm')
confirmation = self.base.show_confirmation_message(i18n.get('confirm_delete'),
message)
if not confirmation:
self.__enable(True)
return
self.list_.clear()
self.__save_filters()
示例14: __build_common_menu
def __build_common_menu(self):
settings = QAction(i18n.get('settings'), self)
settings.triggered.connect(self.__settings_clicked)
quit = QAction(i18n.get('quit'), self)
#FIXME: create a signal for this
quit.triggered.connect(self.base.main_quit)
self.menu.addAction(settings)
self.menu.addSeparator()
self.menu.addAction(quit)
示例15: __init__
def __init__(self, base):
BasePage.__init__(self, i18n.get("notifications_tab_description"))
notify_on_updates = base.core.get_notify_on_updates()
notify_on_actions = base.core.get_notify_on_actions()
sound_on_login = base.core.get_sound_on_login()
sound_on_updates = base.core.get_sound_on_updates()
self.notify_on_updates = CheckBox(
i18n.get("notify_on_updates"), checked=notify_on_updates, tooltip=i18n.get("notify_on_updates_toolip")
)
self.notify_on_actions = CheckBox(
i18n.get("notify_on_actions"), checked=notify_on_actions, tooltip=i18n.get("notify_on_actions_toolip")
)
self.sound_on_login = CheckBox(
i18n.get("sound_on_login"), checked=sound_on_login, tooltip=i18n.get("sound_on_login_tooltip")
)
self.sound_on_updates = CheckBox(
i18n.get("sound_on_updates"), checked=sound_on_updates, tooltip=i18n.get("sound_on_updates_tooltip")
)
self.layout.addWidget(self.notify_on_updates)
self.layout.addWidget(self.notify_on_actions)
self.layout.addSpacing(15)
self.layout.addWidget(self.sound_on_login)
self.layout.addWidget(self.sound_on_updates)
self.layout.addStretch(1)