本文整理汇总了Python中umit.icm.agent.I18N._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _on_activated
def _on_activated(self,widget,row,col):
""""""
self.install_btn.set_sensitive(True)
#choice
selection = self.treeview.get_selection()
(model,iter) = selection.get_selected()
if iter == None:
return
else:
cur_version = self.store.get_value(iter,1)
#fill self.current_record
rs = g_db_helper.select("select * from updates where version = '%s'" % cur_version)
if len(rs) != 1:
g_logger.error("Record is ERROR in DB!!!! The window will be closed!!!")
self.destroy()
self.current_record = {}
self.current_record["version"] = rs[0][0]
self.current_record["news_date"] = rs[0][1]
self.current_record["software_name"] = rs[0][2]
self.current_record["description"] = rs[0][3]
self.current_record["download_url"] = rs[0][4]
self.current_record["is_update"] = rs[0][5]
self.current_record["check_code"] = rs[0][6]
self.statusbar.push(0,_("You have selected the %s version" % \
self.current_record["version"]))
self.details_textview.set_buffer(self._set_details_content(_(self.current_record["description"] + "\n" +
"download:"+self.current_record["download_url"] + "\n" +
"Designed by Umit!"
)))
self.details_textview.show_all()
g_logger.debug("Selected the item %s" % (self.current_record))
示例2: _alter_network_informaiton
def _alter_network_informaiton(self,failure):
failure_info_first = None
failure_info_second = None
if 'error.NoRouteError' in str(failure):
failure_info_first = 'Disconnect to Internet'
failure_info_second = 'Please check your network card connection!'
elif 'TimeoutError' in str(failure):
failure_info_first = 'Cloud Aggregator Server Connect Error'
failure_info_second = 'Please check your cloud aggregator URL'
elif 'Agent matching query does not exist' in str(failure) :# or\
# '500 Internal Server Error' in str(failure) or\
# '500 INTERNAL SERVER ERROR' in str(failure):
failure_info_first = _('Username/Password Error')
failure_info_second = _('Please check your username or password')
#clear username and password (there maybe some bugs here)
theApp.peer_info.clear_db()
else:
print str(failure)
pass
if failure_info_first == None and failure_info_second == None:
return
else:
self._alter_show(primary_text = failure_info_first,secondary_text =failure_info_second)
示例3: show_failed
def show_failed(self,result):
"""
"""
alert = HIGAlertDialog(message_format=_("Error."),
secondary_text=_("Send to aggregaetor failed."))
alert.run()
alert.destroy()
示例4: __init__
def __init__(self, title=_('Bug Report'), summary=None, description=None,
category=None, crashreport=False, description_dialog=None,
reuse_mainloop=True):
HIGDialog.__init__(self, title=title,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
# If reuse_mainloop is true, then dialogs created inside this dialog
# will not start another mainloop.
self._reuse_mainloop = reuse_mainloop
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.crashreport = crashreport
self.description_dialog = description_dialog
self._create_widgets()
self._set_category_list()
self._pack_widgets()
self._connect_widgets()
self.summary = summary or ''
self.description_report = description
if self.crashreport:
self.description = _("CrashReport automatically created")
else:
if self.description_dialog is None:
self.description = description or ''
else:
self.description = description_dialog or ''
self.category = category or ''
示例5: __create_widgets
def __create_widgets(self):
self.hbox1 = HIGHBox()
self.hbox2 = HIGHBox()
self.subbox = Tests()
self.hbox1.add(self.subbox)
self.checkbtn = gtk.CheckButton(_("Update tests module automatically"))
self.checkbtn_throttled = gtk.CheckButton(_("Load HTTP Throttled Test"))
示例6: descr_by_graphmode
def descr_by_graphmode(self):
"""
Returns a description with graph meaning.
"""
graph_descr = [
_("end of a week"), _("end of 12 hours period"),
_("end of half hour period"), _("end of a minute")
]
return _("Each point break represents ") + \
graph_descr[view_mode_order.index(self.graph_mode)]
示例7: send_website_suggestion
def send_website_suggestion(self):
website_url = self.website_url_entry.get_text()
if website_url == '':
alert = HIGAlertDialog(message_format=_("Missing fields."),
secondary_text=_("Please input all fields "
"for website suggestion."))
alert.run()
alert.destroy()
return
d = theApp.aggregator.send_website_suggestion(website_url)
d.addCallback(self.show_success)
d.addErrback(self.show_failed)
示例8: show_success
def show_success(self, result):
"""
"""
if result is not None:
alert = HIGAlertDialog(message_format=_("Succuss."),
secondary_text=_("Send to aggregaetor successfully."))
alert.run()
alert.destroy()
else:
alert = HIGAlertDialog(message_format=_("Error."),
secondary_text=_("Send to aggregaetor failed."))
alert.run()
alert.destroy()
示例9: show_report
def show_report(reuse_mainloop, bug_page):
if not bug_page:
return
try:
webbrowser.open(bug_page)
except: # XXX What exceptions should be caught here ?
page_dialog = HIGAlertDialog(type=gtk.MESSAGE_ERROR,
message_format=_("Could not open default Web Browser"),
secondary_text=_("Open Monitor was unable to open your default "
"web browser to show the bug tracker page with the "
"report status. Try visiting Open Monitor's bug tracker "
"page to see if your bug was reported."))
run_dialog(reuse_mainloop, page_dialog)
示例10: __create_widgets
def __create_widgets(self):
#box
self.all_box = HIGVBox()
self.input_box = HIGHBox()
self.buttom_box = HIGHBox()
self.check_btn_box = gtk.HButtonBox()
#Add input
self.title_text = HIGLabel(_("Locations"))
self.longitude_text = HIGLabel(_("longitude:"))
self.longitude_entry = HIGTextEntry()
self.latitude_text = HIGLabel(_("latitude:"))
self.latitude_entry = HIGTextEntry()
#Add buttons
self.get_event_btn = gtk.Button(_("Get Events"))
self.refresh_btn = gtk.Button(_("Refresh"))
#status bar
self.statusbar = gtk.Statusbar()
self.statusbar.push(0,'Events in Database')
self.listmodel = gtk.ListStore(str, str, str, str, str)
# create the TreeView
self.treeview = gtk.TreeView()
# create the TreeViewColumns to display the data
self.tvcolumn = [None] * len(self.column_names)
cellpb = gtk.CellRendererText()
self.tvcolumn[0] = gtk.TreeViewColumn(self.column_names[0], cellpb)
self.tvcolumn[0].add_attribute(cellpb, 'text', 0)
#cell = gtk.CellRendererText()
#self.tvcolumn[0].set_cell_data_func(cell, self.test_type)
self.treeview.append_column(self.tvcolumn[0])
for n in range(1, len(self.column_names)):
cell = gtk.CellRendererText()
self.tvcolumn[n] = gtk.TreeViewColumn(self.column_names[n], cell)
self.tvcolumn[n].add_attribute(cell, 'text', n)
if n == 1:
cell.set_property('xalign', 1.0)
#self.tvcolumn[n].set_cell_data_func(cell, cell_data_funcs[n])
self.treeview.append_column(self.tvcolumn[n])
#self.treeview.connect('row-activated', self.open_file)
self.scrolledwindow = gtk.ScrolledWindow()
self.scrolledwindow.add(self.treeview)
self.treeview.set_model(self.listmodel)
示例11: __create_widgets
def __create_widgets(self):
self.general_hbox = HIGHBox()
self.version_hbox = HIGHBox()
################
#Version Section
self.version_section = HIGSectionLabel(_("Version"))
self.version_table = HIGTable()
self.version_label = HIGEntryLabel(_("Software Version:"))
self.version2_label = HIGEntryLabel()
self.testver_label = HIGEntryLabel(_("Service Test Version:"))
self.testver2_label = HIGEntryLabel()
self.attribute_label = HIGEntryLabel(_("Agent Attribute:"))
self.attribute2_label = HIGEntryLabel()
################
#General Section
self.general_section = HIGSectionLabel(_("General"))
self.general_table = HIGTable()
self.startup_check = gtk.CheckButton(_("Startup OpenMonitor on system startup"))
self.notification_check = gtk.CheckButton(_("Show Desktop Notifications"))
self.login_ckeck = gtk.CheckButton(_("Enable Auto login"))
示例12: __create_widgets
def __create_widgets(self):
""""""
self.update_switch_hbox = HIGHBox()
self.update_settings_hbox = HIGHBox()
self.update_db_hbox = HIGHBox()
self.update_switch_section = HIGSectionLabel(_("Update News Detect"))
self.update_switch_table = HIGTable()
self.update_settings_section = HIGSectionLabel(_("Update Settings"))
self.update_settings_table = HIGTable()
self.update_db_section = HIGSectionLabel(_("Update Database"))
self.update_db_table = HIGTable()
self.update_check = gtk.CheckButton(_("Automatically update"))
self.update_switch_check = gtk.CheckButton(_("Software Update Detect Switch"))
self.update_times_label = HIGEntryLabel(_("Auto detect update news"))
self.update_method_label = HIGEntryLabel(_("Update method"))
self.update_time_store = gtk.ListStore(str)
self.update_time_entry = gtk.ComboBoxEntry(self.update_time_store, 0)
self.update_method_store = gtk.ListStore(str)
self.update_method_entry = gtk.ComboBoxEntry(self.update_method_store, 0)
self.update_db_label = HIGEntryLabel()
self.update_db_clear_button = gtk.Button(_("Clear Update Information"))
示例13: graph_kind_ui
def graph_kind_ui(self):
"""
Graph kind: Line and Area
"""
modes = _("Line Graph"), _("Area Graph")
self.combo_graph_kind = gtk.combo_box_new_text()
self.combo_graph_kind.append_text(_("Select a graph style"))
for mode in modes:
self.combo_graph_kind.append_text(mode)
self.combo_graph_kind.set_active(1)
self.combo_graph_kind.connect('changed',self.change_graph_kind)
return self.packed(self.combo_graph_kind)
示例14: _create_widgets
def _create_widgets(self):
self.bug_text = gtk.Label(_("Bug report details that "
"will be send!"))
self.description_scrolled = gtk.ScrolledWindow()
self.description_text = gtk.TextView()
# Fill the text entry
description = _("Reporter: %s\nSummary: %s\nCategory: %s\n"
"Comments: %s\n\nDescription: %s" %
(self._reporter, self._summary, self._category,
self._comments, self._description))
self.description_text.get_buffer().set_text(description.replace("[[BR]]", "\n"))
self.description_text.set_editable(False)
示例15: send_service_suggestion
def send_service_suggestion(self):
service_name = self.service_name_entry.child.get_text()
host_name = self.service_host_entry.get_text()
ip = self.service_ip_entry.get_text()
port = int(self.service_port_entry.get_text())
if service_name == '' or host_name == '' or ip == '' or port == "":
alert = HIGAlertDialog(message_format=_("Missing fields."),
secondary_text=_("Please input all fields "\
"for service suggestion."))
alert.run()
alert.destroy()
return
d = theApp.aggregator.send_service_suggestion(service_name, host_name, ip,port)
d.addCallback(self.show_success)
d.addErrback(self.show_failed)