本文整理汇总了Python中taskcoachlib.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fillInterior
def fillInterior(self):
self._templateList = wx.ListCtrl(self._interior, wx.ID_ANY, style=wx.LC_REPORT)
self._templateList.InsertColumn(0, _('Template'))
self._templateList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectionChanged)
self._templateList.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnSelectionChanged)
self._loadTemplates()
for task, name in self.tasks:
self._templateList.InsertStringItem(self._templateList.GetItemCount(), task.subject())
self._templateList.SetColumnWidth(0, -1)
self._btnDelete = wx.Button(self._interior, wx.ID_ANY, _("Delete"))
self._btnDelete.Bind(wx.EVT_BUTTON, self.OnDelete)
self._btnDelete.Enable(False)
self._btnUp = wx.BitmapButton(self._interior, wx.ID_ANY,
wx.ArtProvider.GetBitmap('arrow_up_icon', size=(32, 32)))
self._btnUp.Bind(wx.EVT_BUTTON, self.OnUp)
self._btnUp.Enable(False)
self._btnDown = wx.BitmapButton(self._interior, wx.ID_ANY,
wx.ArtProvider.GetBitmap('arrow_down_icon', size=(32, 32)))
self._btnDown.Bind(wx.EVT_BUTTON, self.OnDown)
self._btnDown.Enable(False)
hsz = wx.BoxSizer(wx.HORIZONTAL)
hsz.Add(self._templateList, 1, wx.EXPAND|wx.ALL, 3)
vsz = wx.BoxSizer(wx.VERTICAL)
vsz.Add(self._btnDelete, 0, wx.ALL, 3)
vsz.Add(self._btnUp, 0, wx.ALL|wx.ALIGN_CENTRE, 3)
vsz.Add(self._btnDown, 0, wx.ALL|wx.ALIGN_CENTRE, 3)
hsz.Add(vsz, 0, wx.ALL, 3)
self._interior.SetSizer(hsz)
示例2: SetOptions
def SetOptions(self, options):
self.options = options
if self.interior.GetSizer():
self.interior.GetSizer().Clear(True)
for child in self.interior.GetChildren():
self.interior.RemoveChild(child)
self.choices = []
gsz = wx.FlexGridSizer(0, 2, 4, 2)
gsz.Add(wx.StaticText(self.interior, wx.ID_ANY, _('Column header in CSV file')))
gsz.Add(wx.StaticText(self.interior, wx.ID_ANY, _('%s attribute')%meta.name))
gsz.AddSpacer((3,3))
gsz.AddSpacer((3,3))
tcFieldNames = [field[0] for field in self.fields]
for fieldName in options['fields']:
gsz.Add(wx.StaticText(self.interior, wx.ID_ANY, fieldName), flag=wx.ALIGN_CENTER_VERTICAL)
choice = wx.Choice(self.interior, wx.ID_ANY)
for tcFieldName in tcFieldNames:
choice.Append(tcFieldName)
choice.SetSelection(self.findFieldName(fieldName, tcFieldNames))
self.choices.append(choice)
gsz.Add(choice, flag=wx.ALIGN_CENTER_VERTICAL)
gsz.AddGrowableCol(1)
self.interior.SetSizer(gsz)
gsz.Layout()
示例3: __init__
def __init__(self, taskBarIcon, settings, taskFile, viewer):
super(TaskBarMenu, self).__init__(taskBarIcon)
tasks = taskFile.tasks()
efforts = taskFile.efforts()
self.appendUICommands(
uicommand.TaskNew(taskList=tasks, settings=settings))
self.appendMenu(_('New task from &template'),
TaskTemplateMenu(taskBarIcon, taskList=tasks, settings=settings),
'newtmpl')
self.appendUICommands(None) # Separator
self.appendUICommands(
uicommand.EffortNew(effortList=efforts, taskList=tasks,
settings=settings),
uicommand.CategoryNew(categories=taskFile.categories(),
settings=settings),
uicommand.NoteNew(notes=taskFile.notes(), settings=settings))
self.appendUICommands(None) # Separator
label = _('&Start tracking effort')
self.appendMenu(label,
StartEffortForTaskMenu(taskBarIcon,
base.filter.DeletedFilter(tasks),
self, label), 'clock_icon')
self.appendUICommands(uicommand.EffortStop(viewer=viewer,
effortList=efforts,
taskList=tasks))
self.appendUICommands(
None,
uicommand.MainWindowRestore(),
uicommand.FileQuit())
示例4: summary
def summary(self):
if self.__handle is not None:
self.close()
if operating_system.isWindows():
wx.MessageBox(_('Errors have occured. Please see "taskcoachlog.txt" in your "My Documents" folder.'), _('Error'), wx.OK)
else:
wx.MessageBox(_('Errors have occured. Please see "%s"') % self.__path, _('Error'), wx.OK)
示例5: _createColumns
def _createColumns(self):
# pylint: disable-msg=W0142
kwargs = dict(renderDescriptionCallback=lambda category: category.description(),
resizeCallback=self.onResizeColumn)
columns = [widgets.Column('subject', _('Subject'),
category.Category.subjectChangedEventType(),
sortCallback=uicommand.ViewerSortByCommand(viewer=self,
value='subject'),
imageIndexCallback=self.subjectImageIndex,
width=self.getColumnWidth('subject'),
**kwargs),
widgets.Column('description', _('Description'),
category.Category.descriptionChangedEventType(),
sortCallback=uicommand.ViewerSortByCommand(viewer=self,
value='description'),
renderCallback=lambda category: category.description(),
width=self.getColumnWidth('description'),
**kwargs),
widgets.Column('attachments', '',
category.Category.attachmentsChangedEventType(), # pylint: disable-msg=E1101
width=self.getColumnWidth('attachments'),
alignment=wx.LIST_FORMAT_LEFT,
imageIndexCallback=self.attachmentImageIndex,
headerImageIndex=self.imageIndex['paperclip_icon'],
renderCallback=lambda category: '', **kwargs)]
if self.settings.getboolean('feature', 'notes'):
columns.append(widgets.Column('notes', '',
category.Category.notesChangedEventType(), # pylint: disable-msg=E1101
width=self.getColumnWidth('notes'),
alignment=wx.LIST_FORMAT_LEFT,
imageIndexCallback=self.noteImageIndex,
headerImageIndex=self.imageIndex['note_icon'],
renderCallback=lambda category: '', **kwargs))
return columns
示例6: __init__
def __init__(self, *args, **kwargs):
super(TaskReminderPage, self).__init__(columns=3, growableColumn=-1,
*args, **kwargs)
names = [] # There's at least one, the universal one
for name in notify.AbstractNotifier.names():
names.append((name, name))
self.addChoiceSetting('feature', 'notifier',
_('Notification system to use for reminders'),
'', names, flags=(None, wx.ALL | wx.ALIGN_LEFT))
if operating_system.isMac() or operating_system.isGTK():
self.addBooleanSetting('feature', 'sayreminder',
_('Let the computer say the reminder'),
_('(Needs espeak)') if operating_system.isGTK() else '',
flags=(None, wx.ALL | wx.ALIGN_LEFT,
wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL))
snoozeChoices = [(str(choice[0]), choice[1]) for choice in date.snoozeChoices]
self.addChoiceSetting('view', 'defaultsnoozetime',
_('Default snooze time to use after reminder'),
'', snoozeChoices, flags=(None,
wx.ALL | wx.ALIGN_LEFT))
self.addMultipleChoiceSettings('view', 'snoozetimes',
_('Snooze times to offer in task reminder dialog'),
date.snoozeChoices[1:],
flags=(wx.ALIGN_TOP | wx.ALL, None)) # Don't offer "Don't snooze" as a choice
self.fit()
示例7: __restore_perspective
def __restore_perspective(self):
perspective = self.settings.get('view', 'perspective')
for viewer_type in viewer.viewerTypes():
if self.__perspective_and_settings_viewer_count_differ(viewer_type):
# Different viewer counts may happen when the name of a viewer
# is changed between versions
perspective = ''
break
try:
self.manager.LoadPerspective(perspective)
except ValueError, reason:
# This has been reported to happen. Don't know why. Keep going
# if it does.
if self.__splash:
self.__splash.Destroy()
wx.MessageBox(_('''Couldn't restore the pane layout from TaskCoach.ini:
%s
The default pane layout will be used.
If this happens again, please make a copy of your TaskCoach.ini file '''
'''before closing the program, open a bug report, and attach the '''
'''copied TaskCoach.ini file to the bug report.''') % reason,
_('%s settings error') % meta.name, style=wx.OK | wx.ICON_ERROR)
self.manager.LoadPerspective('')
示例8: validateDrag
def validateDrag(self, dropItem, dragItems, columnIndex):
if columnIndex == -1 or self.visibleColumns()[columnIndex].name() != 'ordering':
return None # Normal behavior
# Ordering
if not self.isTreeViewer():
return True
# Tree mode. Only allow drag if all selected items are siblings.
if len(set([item.parent() for item in dragItems])) >= 2:
wx.GetTopLevelParent(self).AddBalloonTip(self.settings, 'treemanualordering', self,
title=_('Reordering in tree mode'),
getRect=lambda: wx.Rect(0, 0, 28, 16),
message=_('''When in tree mode, manual ordering is only possible when all selected items are siblings.'''))
return False
# If they are, only allow drag at the same level
if dragItems[0].parent() != (None if dropItem is None else dropItem.parent()):
wx.GetTopLevelParent(self).AddBalloonTip(self.settings, 'treechildrenmanualordering', self,
title=_('Reordering in tree mode'),
getRect=lambda: wx.Rect(0, 0, 28, 16),
message=_('''When in tree mode, you can only put objects at the same level (parent).'''))
return False
return True
示例9: __init__
def __init__(self, parent):
super(SyncMLWarningDialog, self).__init__(parent, wx.ID_ANY, _("Compatibility warning"))
textWidget = wx.StaticText(
self,
wx.ID_ANY,
_(
"The SyncML feature is disabled, because the module\n"
"could not be loaded. This may be because your platform\n"
"is not supported, or under Windows, you may be missing\n"
"some mandatory DLLs. Please see the SyncML section of\n"
'the online help for details (under "Troubleshooting").'
),
)
self.checkbox = wx.CheckBox(self, wx.ID_ANY, _("Never show this dialog again"))
self.checkbox.SetValue(True)
button = wx.Button(self, wx.ID_ANY, _("OK"))
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(textWidget, 0, wx.ALL, 10)
sizer.Add(self.checkbox, 0, wx.ALL, 3)
sizer.Add(button, 0, wx.ALL | wx.ALIGN_CENTRE, 3)
self.SetSizer(sizer)
wx.EVT_BUTTON(button, wx.ID_ANY, self.OnOK)
wx.EVT_CLOSE(self, self.OnOK)
self.Fit()
示例10: __setTooltipText
def __setTooltipText(self):
''' Note that Windows XP and Vista limit the text shown in the
tool tip to 64 characters, so we cannot show everything we would
like to and have to make choices. '''
textParts = []
trackedTasks = self.__taskList.tasksBeingTracked()
if trackedTasks:
count = len(trackedTasks)
if count == 1:
tracking = _('tracking "%s"')%trackedTasks[0].subject()
else:
tracking = _('tracking effort for %d tasks')%count
textParts.append(tracking)
else:
for getCountMethodName, singular, plural in self.toolTipMessages:
count = getattr(self.__taskList, getCountMethodName)()
if count == 1:
textParts.append(singular)
elif count > 1:
textParts.append(plural%count)
text = ', '.join(textParts)
text = u'%s - %s'%(meta.name, text) if text else meta.name
if text != self.__tooltipText:
self.__tooltipText = text
self.__setIcon() # Update tooltip
示例11: createTemplateEntries
def createTemplateEntries(self, pane):
panel = self._editPanel = sized_controls.SizedPanel(pane)
panel.SetSizerType('form')
panel.SetSizerProps(expand=True)
label = wx.StaticText(panel, label=_('Subject'))
label.SetSizerProps(valign='center')
self._subjectCtrl = wx.TextCtrl(panel)
label = wx.StaticText(panel, label=_('Planned start date'))
label.SetSizerProps(valign='center')
self._plannedStartDateTimeCtrl = TimeExpressionEntry(panel)
label = wx.StaticText(panel, label=_('Due date'))
label.SetSizerProps(valign='center')
self._dueDateTimeCtrl = TimeExpressionEntry(panel)
label = wx.StaticText(panel, label=_('Completion date'))
label.SetSizerProps(valign='center')
self._completionDateTimeCtrl = TimeExpressionEntry(panel)
label = wx.StaticText(panel, label=_('Reminder'))
label.SetSizerProps(valign='center')
self._reminderDateTimeCtrl = TimeExpressionEntry(panel)
self._taskControls = (self._subjectCtrl, self._plannedStartDateTimeCtrl, self._dueDateTimeCtrl,
self._completionDateTimeCtrl, self._reminderDateTimeCtrl)
for ctrl in self._taskControls:
ctrl.SetSizerProps(valign='center', expand=True)
ctrl.Bind(wx.EVT_TEXT, self.onValueChanged)
self.enableEditPanel(False)
panel.Fit()
示例12: addColorEntry
def addColorEntry(self):
currentColor = self._category.color(recursive=False)
self._checkBox = wx.CheckBox(self, label=_("Use this color:"))
self._checkBox.SetValue(currentColor is not None)
self._colorButton = wx.ColourPickerCtrl(self, -1, currentColor or wx.WHITE, size=(40, -1))
self._colorButton.Bind(wx.EVT_COLOURPICKER_CHANGED, lambda event: self._checkBox.SetValue(True))
self.addEntry(_("Color"), self._checkBox, self._colorButton)
示例13: addStartAndStopEntries
def addStartAndStopEntries(self):
starthour = self._settings.getint("view", "efforthourstart")
endhour = self._settings.getint("view", "efforthourend")
interval = self._settings.getint("view", "effortminuteinterval")
self._startEntry = widgets.DateTimeCtrl(
self,
self._effort.getStart(),
self.onPeriodChanged,
noneAllowed=False,
starthour=starthour,
endhour=endhour,
interval=interval,
)
startFromLastEffortButton = wx.Button(self, label=_("Start tracking from last stop time"))
self.Bind(wx.EVT_BUTTON, self.onStartFromLastEffort, startFromLastEffortButton)
if self._effortList.maxDateTime() is None:
startFromLastEffortButton.Disable()
self._stopEntry = widgets.DateTimeCtrl(
self,
self._effort.getStop(),
self.onPeriodChanged,
noneAllowed=True,
starthour=starthour,
endhour=endhour,
interval=interval,
)
flags = [None, wx.ALIGN_RIGHT | wx.ALL, wx.ALIGN_LEFT | wx.ALL, None]
self.addEntry(_("Start"), self._startEntry, startFromLastEffortButton, flags=flags)
self.addEntry(_("Stop"), self._stopEntry, "", flags=flags)
示例14: __init__
def __init__(self, *args, **kwargs):
super(SyncMLAccessPage, self).__init__(*args, **kwargs)
self.addTextSetting('access', 'syncUrl', _('SyncML server URL'))
self.addTextSetting('access', 'username', _('User name/ID'))
self.fit()
示例15: __DisplayBalloon
def __DisplayBalloon(self):
# AuiFloatingFrame is instantiated from framemanager, we can't derive it from BalloonTipManager
if self.toolbar.IsShownOnScreen() and hasattr(wx.GetTopLevelParent(self), 'AddBalloonTip'):
wx.GetTopLevelParent(self).AddBalloonTip(self.settings, 'customizabletoolbars', self.toolbar,
title=_('Toolbars are customizable'),
getRect=lambda: self.toolbar.GetToolRect(self.toolbar.getToolIdByCommand('EditToolBarPerspective')),
message=_('''Click on the gear icon on the right to add buttons and rearrange them.'''))