本文整理汇总了Python中translation._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __initwidgets__
def __initwidgets__(self):
self.header = urwid.Filler(urwid.Text(_('ARA: Query User'),align='center'))
self.header = urwid.AttrWrap(self.header, 'reversed')
self.idedit = urwid.Filler(urwid.Edit(caption=_(' * Enter ID: '), wrap='clip'))
self.idedit.body.set_edit_text(self.default_user)
self.btnsearch = urwid.Filler(urwid.Button(_('Search'), self.on_button_clicked))
self.btncancel = urwid.Filler(urwid.Button(_('Cancel'), self.on_button_clicked))
self.buttoncolumn = urwid.Columns([('weight', 60, self.idedit), ('weight', 20, self.btnsearch),('weight',20,self.btncancel)])
self.idtext = urwid.Filler(urwid.Text(''))
self.nicktext = urwid.Filler(urwid.Text(''))
self.introtext = urwid.Filler(urwid.Text(''))
self.sigtext = urwid.Filler(urwid.Text(''))
self.lasttext = urwid.Filler(urwid.Text(''))
actiontext = urwid.Filler(urwid.Text(_(' * Enter user ID and press [Search]')))
content = [('fixed',1, self.header), ('fixed',1,widget.blanktext),
('fixed',1,self.buttoncolumn), ('fixed',1,widget.dash),
('fixed',1,self.idtext), ('fixed',1,self.nicktext),
('fixed',6,self.introtext), self.sigtext,
('fixed',1,self.lasttext), ('fixed',1,widget.dash),
('fixed',1,actiontext),
]
self.mainpile = urwid.Pile(content)
if self.default_user != '':
self.query_information(self.idedit.body.get_edit_text())
开发者ID:hodduc,项目名称:arara,代码行数:28,代码来源:query_user.py
示例2: get_conc_desc
def get_conc_desc(corpus, q=None, subchash=None, translate=True):
"""
arguments:
corpus -- an extended version (corpname attribute must be present) of
manatee.Corpus object as provided by corplib.CorpusManager.get_Corpus
q -- tuple/list of query elements
subchash -- hashed subcorpus name as provided by corplib.CorpusManager.get_Corpus
translate -- if True then all the messages are translated according to the current
thread's locale information
"""
if q is None:
q = []
if translate:
_t = lambda s: _(s)
else:
_t = lambda s: s
desctext = {
"q": _t("Query"),
"a": _t("Query"),
"r": _t("Random sample"),
"s": _t("Sort"),
"f": _t("Shuffle"),
"n": _t("Negative filter"),
"N": _t("Negative filter (excluding KWIC)"),
"p": _t("Positive filter"),
"P": _t("Positive filter (excluding KWIC)"),
"w": _t("Word sketch item"),
"t": _t("Word sketch texttype item"),
"e": _t("GDEX"),
"x": _t("Switch KWIC"),
}
desc = []
cache_map = cache_factory.get_mapping(corpus)
q = tuple(q)
for i in range(len(q)):
cache_val = cache_map[(subchash, q[: i + 1])]
if cache_val:
size = cache_val[1]
else:
size = None
opid = q[i][0]
args = q[i][1:]
url1 = [("q", qi) for qi in q[:i]]
url2 = [("q", qi) for qi in q[: i + 1]]
op = desctext.get(opid)
if opid == "s" and args[0] != "*" and i > 0:
sortopt = {"-1<0": "left context", "0<0~": "node", "1>0~": "right context"}
sortattrs = args.split()
if len(sortattrs) > 2:
op = "Multilevel Sort"
args = "%s in %s" % (sortattrs[0].split("/")[0], sortopt.get(sortattrs[1][:4], sortattrs[1]))
url1.append(("skey", {"-1": "lc", "0<": "kw", "1>": "rc"}.get(sortattrs[1][:2], "")))
elif opid == "f":
size = ""
args = _("enabled")
if op:
desc.append((op, args, url1, url2, size))
return desc
开发者ID:simar0at,项目名称:kontext,代码行数:60,代码来源:conclib.py
示例3: saveFile
def saveFile(self, event):
user_code = self.PythonEditor.GetText()
user_code = fixLineEnding(user_code)
self.filename = dialogs.checkedSaveDialog(user_code,
_("Save Python file as"),
_("Python files (*.py)|*.py| All files (*.*)|*.*"),
self.filename, os.getcwd())
开发者ID:josdie,项目名称:play-to-program,代码行数:7,代码来源:lightning.py
示例4: __initwidgets__
def __initwidgets__(self):
self.keymap = {
'up': '',
'down': '',
}
self.header = urwid.Filler(urwid.Text(_('ARA: Change Password'), align='center'))
self.header = urwid.AttrWrap(self.header, 'reversed')
self.oldpwedit = urwid.Filler(widget.PasswordEdit(caption=_('Old password:'), wrap='clip'))
oldpwdesc = urwid.Filler(urwid.Text(_('Please enter your\nold password')))
self.oldpwcolumn = widget.EasyColumn(self.oldpwedit, oldpwdesc)
self.newpwedit = urwid.Filler(widget.PasswordEdit(caption=_('New password:'), wrap='clip'))
newpwdesc = urwid.Filler(urwid.Text(_('Minimum password length\nis 4 characters')))
self.newpwcolumn = widget.EasyColumn(self.newpwedit, newpwdesc)
self.confirmedit = urwid.Filler(widget.PasswordEdit(caption=_('Confirm\nnew password:'), wrap='clip'))
confirmdesc = urwid.Filler(urwid.Text(_('Re-enter your new\npassword')))
self.confirmcolumn = widget.EasyColumn(self.confirmedit, confirmdesc)
self.pwpile = urwid.Pile([self.oldpwcolumn, self.newpwcolumn,self.confirmcolumn])
self.okbutton = urwid.Filler(urwid.Button(_('OK'), self.on_button_clicked))
self.cancelbutton = urwid.Filler(urwid.Button(_('Cancel'), self.on_button_clicked))
self.buttoncolumn = widget.EasyColumn(self.okbutton, self.cancelbutton, 50, 50)
infotext = urwid.Filler(urwid.Text(_(""" * Press [Enter] to proceed to the next item, [Shift+Enter] - previous item
* Press [Tab] to directly jump to OK or Cancel button""")))
content = [('fixed',1,self.header),self.pwpile,('fixed',2,infotext),
('fixed',1,widget.blank),('fixed',1,self.buttoncolumn)]
self.mainpile = urwid.Pile(content)
开发者ID:hodduc,项目名称:arara,代码行数:32,代码来源:change_password.py
示例5: on_button_clicked
def on_button_clicked(self, button):
if button == self.btnokay:
retvalue = None
title = self.titleedit.body.get_edit_text()
body = self.bodyedit.body.get_edit_text()
try:
title_content = {'title':title, 'content':body}
if self.mode == 'modify':
result = self.server.article_manager.modify(self.session_key, self.board_name, self.article_id, **title_content)
elif self.mode == 'reply':
result = self.server.article_manager.write_reply(self.session_key, self.board_name, self.article_id, **title_content)
elif self.mode == 'post':
result = self.server.article_manager.write_article(self.session_key, self.board_name, **title_content)
else:
return
confirm = widget.Dialog(_('Article posted.'), [_('OK')], ('menu', 'bg', 'bgf'), 30, 5, self)
self.overlay = confirm
self.parent.run()
if confirm.b_pressed == _('OK'):
self.parent.change_page("list_article",{'session_key':self.session_key, 'board_name':self.board_name})
except:
#self.overlay = None
#self.parent.run()
pass
elif button == self.btncancel:
self.parent.change_page("list_article",{'session_key':self.session_key, 'board_name':self.board_name})
elif button == self.btnhelp:
# TODO: 편집 도움말
pass
elif button == self.btnpreview:
# TODO: 미리보기
pass
else:
assert("Call for undefined button")
开发者ID:hodduc,项目名称:arara,代码行数:34,代码来源:post_article.py
示例6: send_concordance_url
def send_concordance_url(auth, plugin_api, recipient, url):
user_id = plugin_api.session['user']['id']
user_info = auth.get_user_info(user_id)
user_email = user_info['email']
username = user_info['username']
smtp_server = settings.get('mailing', 'smtp_server')
sender = settings.get('mailing', 'sender')
text = _('KonText user %s has sent a concordance link to you') % (username, ) + ':'
text += '\n\n'
text += url + '\n\n'
text += '\n---------------------\n'
text += time.strftime('%d.%m. %Y %H:%M')
text += '\n'
s = smtplib.SMTP(smtp_server)
msg = MIMEText(text, 'plain', 'utf-8')
msg['Subject'] = _('KonText concordance link')
msg['From'] = sender
msg['To'] = recipient
msg.add_header('Reply-To', user_email)
try:
s.sendmail(sender, [recipient], msg.as_string())
ans = True
except Exception as ex:
logging.getLogger(__name__).warn(
'There were errors sending concordance link via e-mail(s): %s' % (ex,))
ans = False
finally:
s.quit()
return ans
开发者ID:anukat2015,项目名称:kontext,代码行数:32,代码来源:mailing.py
示例7: DrawLabels
def DrawLabels(self, dc):
tilePair = self.tile_narrow + self.tile_wide
x_shift = self.xOffset // 2
y_shift = -self.yOffset
if self.editWalls:
# wx.SWISS is the sans-serif font
dc.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL))
pixelShift = dc.GetTextExtent("8") # try to centre the labels
dc.SetTextForeground(self.wall_grid_colour)
for row in range(self.num_rows):
y = row * tilePair / 2 - pixelShift[1] // 4 + self.yTopOffset
dc.DrawText(str(self.flipRow(row)), x_shift, y)
for col in range(self.num_cols - 1):
x = col * tilePair / 2 + self.tile_narrow / 2 + self.xOffset - pixelShift[0] // 2
dc.DrawText(str(col), x, self.maxHeight + y_shift)
x_shift = self.xOffset // 4
y_shift = -self.yOffset // 2
else:
dc.SetTextForeground(wx.BLACK)
dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
dc.DrawText(_("Avenue"), 5 * x_shift, self.maxHeight + y_shift // 2)
dc.DrawRotatedText(_("Street"), x_shift // 3, self.maxHeight + 3 * y_shift, 90)
dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))
pixelShift = dc.GetTextExtent("8") # try to centre the labels
dc.SetTextForeground(wx.BLACK)
for row in range(1, self.num_rows, 2):
y = row * tilePair / 2 - pixelShift[1] // 4 + self.yTopOffset
dc.DrawText(str(self.flipRow(row) // 2 + 1), x_shift, y)
for col in range(1, self.num_cols, 2):
x = col * tilePair / 2 + self.tile_narrow / 2 + self.xOffset - pixelShift[0] // 2
dc.DrawText(str(col // 2 + 1), x, self.maxHeight + y_shift)
开发者ID:statkclee,项目名称:rur-ple-1,代码行数:31,代码来源:world_creation.py
示例8: process_file
def process_file(file_text):
if imp_use_as.search(file_text): # look for "import useful as ..."
syn = imp_use_as.findall(file_text)
added_text, safe_import_flag = import_useful_as(syn[0])
file_text = comment_import.sub('#import ', file_text)
elif imp_use.search(file_text): # perhaps the "as ..." part is missing
added_text, safe_import_flag = import_useful()
file_text = comment_import.sub('#import ', file_text)
elif from_use_imp_star.search(file_text):
added_text, safe_import_flag = from_useful_import_star()
file_text = comment_from.sub('#from ', file_text)
elif from_use_imp_as.search(file_text):
names = from_use_imp_as.findall(file_text)
name = names[0][0]
syn = names[0][1]
added_text, safe_import_flag = from_useful_import_as(name, syn)
file_text = comment_from.sub('#from ', file_text)
elif from_use_imp_names.search(file_text):
names = from_use_imp_names.findall(file_text)
added_text, safe_import_flag = from_useful_import_names(names[0][0])
file_text = comment_from.sub('#from ', file_text)
elif import_misuse.search(file_text):
safe_import_flag = False
file_text = '' # remove it all
added_text = '# import keyword used improperly'
print _('import keyword used improperly')
else:
added_text = ''
safe_import_flag = True # nothing found
added_text += file_text
return added_text, safe_import_flag
开发者ID:cedrick-f,项目名称:rur-ple,代码行数:32,代码来源:test_import.py
示例9: _create_ui
def _create_ui(self):
"""creates UI
"""
frac = float(self._connection['quality'])/ \
float(self._connection['quality_max'])
per = self._connection['quality']
self._quality_bar = gtk.ProgressBar()
self._quality_bar.set_fraction(frac)
self._quality_bar.set_text(_("%d%%") % int(per))
self._name_txt = gtk.Label("")
self._name_txt.set_markup("<span color='blue'>" +
self._connection['remote']
+ "</span>")
self._name_txt.set_alignment(0.0 , 0.5)
self._encrypt_txt = gtk.Label(self._type)
self._encrypt_txt.set_alignment(0.0 , 0.5)
self._connect_btn = gtk.Button(_("Connect"))
self.set_row_spacings(5)
self.set_col_spacings(5)
self.attach(self._quality_bar, 0, 1, 0, 2,
gtk.SHRINK, gtk.SHRINK)
self.attach(self._name_txt, 1, 2, 0, 1,
gtk.EXPAND|gtk.FILL, gtk.SHRINK)
self.attach(self._encrypt_txt, 1, 2, 1, 2,
gtk.EXPAND|gtk.FILL, gtk.SHRINK)
self.attach(self._connect_btn, 2, 3, 0, 2,
gtk.SHRINK, gtk.SHRINK)
self.attach(gtk.HSeparator(), 0, 3, 2, 3,
gtk.FILL, gtk.SHRINK)
开发者ID:rdno,项目名称:pardus-network-manager-gtk,代码行数:34,代码来源:widgets.py
示例10: _play
def _play(soundfile):
if platform.startswith('win'):
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
PlaySound(soundfile, SND_FILENAME|SND_ASYNC)
elif 'linux' in platform:
from wave import open as waveOpen
from ossaudiodev import open as ossOpen
s = waveOpen(soundfile,'rb')
(nc,sw,fr,nf,comptype, compname) = s.getparams( )
try:
from ossaudiodev import AFMT_S16_NE
except ImportError:
if byteorder == "little":
AFMT_S16_NE = ossaudiodev.AFMT_S16_LE
else:
AFMT_S16_NE = ossaudiodev.AFMT_S16_BE
dsp = None
try:
dsp = ossOpen('/dev/dsp','w')
dsp.setparameters(AFMT_S16_NE, nc, fr)
data = s.readframes(nf)
s.close()
dsp.write(data)
except IOError:
print _("Audio device is busy.")
finally:
if dsp:
dsp.close()
开发者ID:cedrick-f,项目名称:rur-ple,代码行数:31,代码来源:sound.py
示例11: __initwidgets__
def __initwidgets__(self):
self.header = urwid.Filler(urwid.Text(_('ARA: Change Introduction & Signature'), align='center'))
self.header = urwid.AttrWrap(self.header, 'reversed')
self.myinfo = self.server.member_manager.get_info(self.session_key)
sigtext = urwid.Filler(urwid.Text(_('Signature')))
self.sigedit = urwid.Filler(urwid.Edit(wrap='clip'))
introtext = urwid.Filler(urwid.Text(_('Introduction')))
self.introedit = urwid.Filler(urwid.Edit(wrap='clip'))
self.btnokay = urwid.Button(_('OK'), self.on_button_clicked)
self.btncancel = urwid.Button(_('Cancel'), self.on_button_clicked)
self.bottomcolumn = urwid.Filler(urwid.Columns([self.btnokay,self.btncancel]))
content = [('fixed',1, self.header),
('fixed',1,sigtext),
('fixed',1,widget.dash),
self.sigedit,
('fixed',1,widget.dash),
('fixed',1,introtext),
('fixed',1,widget.dash),
self.introedit,
('fixed',1,widget.dash),
('fixed',1,self.bottomcolumn)]
self.mainpile = urwid.Pile(content)
self.set_sig_intro()
开发者ID:hodduc,项目名称:arara,代码行数:28,代码来源:sig_intro.py
示例12: set_user_password
def set_user_password(self, request):
with plugins.runtime.AUTH as auth:
curr_passwd = request.form['curr_passwd']
new_passwd = request.form['new_passwd']
new_passwd2 = request.form['new_passwd2']
fields = dict(curr_passwd=True, new_passwd=True, new_passwd2=True)
ans = dict(fields=fields, messages=[])
if not self._uses_internal_user_pages():
raise UserActionException(_('This function is disabled.'))
logged_in = auth.validate_user(
self._plugin_api, self.session_get('user', 'user'), curr_passwd)
if self._is_anonymous_id(logged_in['id']):
fields['curr_passwd'] = False
ans['messages'].append(_('Invalid user or password'))
return ans
if new_passwd != new_passwd2:
fields['new_passwd'] = False
fields['new_passwd2'] = False
ans['messages'].append(_('New password and its confirmation do not match.'))
return ans
if not auth.validate_new_password(new_passwd):
ans['messages'].append(auth.get_required_password_properties())
fields['new_passwd'] = False
fields['new_passwd2'] = False
return ans
auth.update_user_password(self.session_get('user', 'id'), new_passwd)
return ans
开发者ID:czcorpus,项目名称:kontext,代码行数:32,代码来源:user.py
示例13: _send_mail
def _send_mail(self, plugin_api, body, browser_info):
user_info = self._auth.get_user_info(plugin_api)
user_email = user_info['email']
username = user_info['username']
text = _('KonText feedback from user {0}').format(username) + ':'
text += '\n\n'
text += body
text += '\n'
text += '\n{0}\n'.format(40 * '-')
text += _('browser info') + ':\n'
text += self._dump_browser_info(browser_info)
text += '\n{0}\n'.format(40 * '-')
text += '\n'
s = smtplib.SMTP(self._smtp_server)
msg = MIMEText(text, 'plain', 'utf-8')
msg['Subject'] = _('KonText feedback from user {0} for {1}').format(
username, datetime.now().isoformat().rsplit('.')[0])
msg['From'] = self._mail_sender
msg['To'] = ', '.join(self._mail_recipients)
msg.add_header('Reply-To', user_email)
try:
s.sendmail(self._mail_sender, self._mail_recipients, msg.as_string())
ans = True
except Exception as ex:
logging.getLogger(__name__).warn(
'There were errors sending an issue report link via e-mail(s): %s' % (ex,))
ans = False
finally:
s.quit()
return ans
开发者ID:czcorpus,项目名称:kontext,代码行数:33,代码来源:__init__.py
示例14: _create_subcorpus
def _create_subcorpus(self, request):
"""
req. arguments:
subcname -- name of new subcorpus
create -- bool, sets whether to create new subcorpus
cql -- custom within condition
"""
subcname = request.form['subcname']
within_json = request.form.get('within_json')
raw_cql = request.form.get('cql')
corp_encoding = self._corp().get_conf('ENCODING')
if raw_cql:
tt_query = ()
within_cql = raw_cql
full_cql = 'aword,[] %s' % raw_cql
imp_cql = (full_cql,)
elif within_json: # user entered a subcorpus query manually
tt_query = ()
within_cql = self._deserialize_custom_within(json.loads(within_json))
full_cql = 'aword,[] %s' % within_cql
imp_cql = (full_cql,)
else:
tt_query = TextTypeCollector(self._corp(), request).get_query()
full_cql = ' within '.join(['<%s %s />' % item for item in tt_query])
full_cql = 'aword,[] within %s' % full_cql
full_cql = import_string(full_cql, from_encoding=corp_encoding)
imp_cql = (full_cql,)
basecorpname = self.args.corpname.split(':')[0]
if not subcname:
raise UserActionException(_('No subcorpus name specified!'))
path = self.prepare_subc_path(basecorpname, subcname)
if type(path) == unicode:
path = path.encode('utf-8')
if len(tt_query) == 1:
result = corplib.create_subcorpus(path, self._corp(), tt_query[0][0], tt_query[0][1])
elif len(tt_query) > 1 or within_cql:
conc = conclib.get_conc(self._corp(), self._session_get('user', 'user'), q=imp_cql)
conc.sync()
struct = self._corp().get_struct(tt_query[0][0]) if len(tt_query) == 1 else None
result = corplib.subcorpus_from_conc(path, conc, struct)
else:
raise UserActionException(_('Nothing specified!'))
if result:
if plugins.has_plugin('subc_restore'):
try:
plugins.get('subc_restore').store_query(user_id=self._session_get('user', 'id'),
corpname=self.args.corpname,
subcname=subcname,
cql=full_cql.split('[]')[-1])
except Exception as e:
logging.getLogger(__name__).warning('Failed to store subcorpus query: %s' % e)
self.add_system_message('warning',
_('Subcorpus created but there was a problem saving a backup copy.'))
return {}
else:
raise ConcError(_('Empty subcorpus!'))
开发者ID:anukat2015,项目名称:kontext,代码行数:60,代码来源:subcorpus.py
示例15: keypress
def keypress(self, size, key):
if key in self.keymap:
key = self.keymap[key]
if key == "enter" and not self.session_key == 'guest':
# self.boardlist.get_body().get_focus()[0].w.w.widget_list : 현재 활성화된 항목
article_id = self.articlelist.get_body().get_focus()[0].w.w.widget_list[0].get_text()[0]
if article_id != '':
article_id = int(article_id)
self.parent.change_page("read_article", {'session_key':self.session_key, 'board_name':self.board_name, 'article_id':article_id})
elif key == 'w' and not self.readonly and not self.session_key == 'guest':
self.parent.change_page('post_article', {'session_key':self.session_key, 'board_name':self.board_name, 'mode':'post', 'article_id':''})
elif key == 'q':
self.parent.change_page("main", {'session_key':self.session_key})
elif key == 'f':
if self.session_key == 'guest':
return
input_dialog = widget.Dialog(_('Search term:'), [_('OK'), _('Cancel')], ('menu','bg','bgf'), 30, 7, self, 'Text')
self.overlay = input_dialog
self.parent.run()
if input_dialog.b_pressed == _('OK'):
search_term = input_dialog.edit_text
else:
search_term = ''
if search_term.strip() == '':
return
listbody = urwid.ListBox(ArticleSearchWalker(self.session_key, self.board_name,
self.make_widget, False, {'title':search_term}))
self.articlelist.set_body(listbody)
self.overlay = None
self.parent.run()
else:
self.mainpile.keypress(size, key)
开发者ID:hodduc,项目名称:arara,代码行数:32,代码来源:list_article.py
示例16: UpdateFields
def UpdateFields(self, *args):
field, info = args[0].data[0]
if field == self.notebook_new_page:
if info != 1: # Code and Learn page
self.ClearFields()
return
elif field == self.beeper_field:
self.fields_info['beepers'] = info
if info == self.no_robot:
self.beeper_text = _("No robot in this world")
self.fields_info['robot'] = self.no_robot
else:
self.fields_info['robot'] = self.no_robot+1
if info < 2:
self.beeper_text = _("Robot has %s beeper") % info
else:
self.beeper_text = _("Robot has %s beepers") % info
elif field == self.running_field:
self.run_text = info
for n in ['0', '1', '2']:
if info == self.running_dict[n]:
self.fields_info['running'] = n
elif field == self.user_field:
self.user_text = _("User ID: %s") % info
self.fields_info['user'] = info
elif field == self.problem_field:
self.prob_text = _("Problem: %s") % info
self.fields_info['problem'] = info
self.WriteFields()
开发者ID:josdie,项目名称:play-to-program,代码行数:29,代码来源:status_bar.py
示例17: __init__
def __init__(self):
"""Class initialiser"""
GObject.GObject.__init__(self)
self.config = Config()
self.get_style_context().add_class("terminator-terminal-searchbar")
# Search text
self.entry = Gtk.Entry()
self.entry.set_activates_default(True)
self.entry.show()
self.entry.connect('activate', self.do_search)
self.entry.connect('key-press-event', self.search_keypress)
# Label
label = Gtk.Label(label=_('Search:'))
label.show()
# Close Button
close = Gtk.Button()
close.set_relief(Gtk.ReliefStyle.NONE)
close.set_focus_on_click(False)
icon = Gtk.Image()
icon.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
close.add(icon)
close.set_name('terminator-search-close-button')
if hasattr(close, 'set_tooltip_text'):
close.set_tooltip_text(_('Close Search bar'))
close.connect('clicked', self.end_search)
close.show_all()
# Next Button
self.next = Gtk.Button(_('Next'))
self.next.show()
self.next.set_sensitive(False)
self.next.connect('clicked', self.next_search)
# Previous Button
self.prev = Gtk.Button(_('Prev'))
self.prev.show()
self.prev.set_sensitive(False)
self.prev.connect('clicked', self.prev_search)
# Wrap checkbox
self.wrap = Gtk.CheckButton(_('Wrap'))
self.wrap.show()
self.wrap.set_sensitive(True)
self.wrap.connect('toggled', self.wrap_toggled)
self.pack_start(label, False, True, 0)
self.pack_start(self.entry, True, True, 0)
self.pack_start(self.prev, False, False, 0)
self.pack_start(self.next, False, False, 0)
self.pack_start(self.wrap, False, False, 0)
self.pack_end(close, False, False, 0)
self.hide()
self.set_no_show_all(True)
开发者ID:wpjunior,项目名称:terminator,代码行数:59,代码来源:searchbar.py
示例18: viewattrs
def viewattrs(self):
"""
attrs, refs, structs form
"""
from collections import defaultdict
if len(self.args.q) == 0:
self.disabled_menu_items = (MainMenu.SAVE, MainMenu.CONCORDANCE, MainMenu.VIEW,
MainMenu.FILTER, MainMenu.FREQUENCY, MainMenu.COLLOCATIONS)
out = {}
if self.args.maincorp:
corp = corplib.manatee.Corpus(self.args.maincorp)
out['AttrList'] = [{'label': corp.get_conf(n + '.LABEL') or n, 'n': n}
for n in corp.get_conf('ATTRLIST').split(',')
if n]
else:
corp = self._corp()
out['fixed_attr'] = 'word'
availstruct = corp.get_conf('STRUCTLIST').split(',')
structlist = self.args.structs.split(',')
out['Availstructs'] = [{'n': n,
'sel': 'selected' if n in structlist else '',
'label': corp.get_conf(n + '.LABEL')}
for n in availstruct if n and n != '#']
availref = corp.get_conf('STRUCTATTRLIST').split(',')
structattrs = defaultdict(list)
reflist = self.args.refs.split(',') if self.args.refs else []
def ref_is_allowed(r):
return r and r not in (
'#', plugins.get('corparch').get_corpus_info(self.args.corpname).get('speech_segment'))
for item in availref:
if ref_is_allowed(item):
k, v = item.split('.', 1)
structattrs[k].append(v)
out['Availrefs'] = [{
'n': '#',
'label': _('Token number'),
'sel': 'selected' if '#' in reflist else ''
}] + \
[{
'n': '=' + n,
'sel': 'selected' if ('=' + n) in reflist else '',
'label': (corp.get_conf(n + '.LABEL') or n)
}
for n in availref if ref_is_allowed(n)
]
doc = corp.get_conf('DOCSTRUCTURE')
if doc in availstruct:
out['Availrefs'].insert(1, {'n': doc, 'label': _('Document number'),
'sel': (doc in reflist and 'selected' or '')})
out['newctxsize'] = self.args.kwicleftctx[1:]
out['structattrs'] = structattrs
out['curr_structattrs'] = self.args.structattrs
out['query_overview'] = self.concdesc_json().get('Desc', [])
return out
开发者ID:anukat2015,项目名称:kontext,代码行数:59,代码来源:options.py
示例19: viewattrs
def viewattrs(self):
"""
attrs, refs, structs form
"""
from collections import defaultdict
if len(self.args.q) == 0:
self.disabled_menu_items = (MainMenu.SAVE, MainMenu.CONCORDANCE, MainMenu.VIEW,
MainMenu.FILTER, MainMenu.FREQUENCY, MainMenu.COLLOCATIONS)
out = {}
if self.args.maincorp:
corp = corplib.manatee.Corpus(self.args.maincorp)
else:
corp = self.corp
out['AttrList'] = [{'label': corp.get_conf(n + '.LABEL') or n, 'n': n}
for n in corp.get_conf('ATTRLIST').split(',')
if n]
out['fixed_attr'] = 'word'
out['attr_allpos'] = self.args.attr_allpos
out['attr_vmode'] = self.args.attr_vmode
availstruct = corp.get_conf('STRUCTLIST').split(',')
structlist = set(self.args.structs.split(',')).union(
set([x.split('.')[0] for x in self.args.structattrs]))
out['Availstructs'] = [{'n': n,
'sel': 'selected' if n in structlist else '',
'label': corp.get_conf(n + '.LABEL')}
for n in availstruct if n and n != '#']
availref = corp.get_conf('STRUCTATTRLIST').split(',')
structattrs = defaultdict(list)
reflist = self.args.refs.split(',') if self.args.refs else []
def ref_is_allowed(r):
return r and r not in (
'#', self.get_corpus_info(self.args.corpname).get('speech_segment'))
for item in availref:
if ref_is_allowed(item):
k, v = item.split('.', 1)
structattrs[k].append(v)
out['Availrefs'] = [dict(n='#', label=_('Token number'),
sel='selected' if '#' in reflist else '')]
for n in availref:
if ref_is_allowed(n):
out['Availrefs'].append(dict(n='=' + n, sel='selected' if ('=' + n) in reflist else '',
label=(corp.get_conf(n + '.LABEL') or n)))
doc = corp.get_conf('DOCSTRUCTURE')
if doc in availstruct:
out['Availrefs'].insert(1, dict(n=doc, label=_('Document number'),
sel=(doc in reflist and 'selected' or '')))
out['newctxsize'] = self.args.kwicleftctx[1:]
out['structattrs'] = structattrs
out['curr_structattrs'] = self.args.structattrs
out['query_overview'] = self.concdesc_json().get('Desc', [])
out['CurrentAttrs'] = self.args.attrs.split(',')
out['use_conc_toolbar'] = settings.get_bool('global', 'use_conc_toolbar')
return out
开发者ID:tomachalek,项目名称:kontext,代码行数:59,代码来源:options.py
示例20: setup_view
def setup_view(self):
self.store = gtk.ListStore(str, str)
column = lambda x, y:gtk.TreeViewColumn(x,
gtk.CellRendererText(),
text=y)
self.view = gtk.TreeView(self.store)
self.view.append_column(column(_("Name"), 0))
self.view.append_column(column(_("Quality"), 1))
开发者ID:rdno,项目名称:pardus-network-manager-gtk,代码行数:8,代码来源:widgets.py
注:本文中的translation._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论