本文整理汇总了Python中scal3.locale_man._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: updateWidget
def updateWidget(self):
#for index, module in calTypes.iterIndexModule():
# if module.name != 'hijri':
for mode in calTypes.active:
modeDesc = calTypes[mode].desc
if not 'hijri' in modeDesc.lower():
self.altMode = mode
self.altModeDesc = modeDesc
break
self.topLabel.set_label(_('Start')+': '+dateLocale(*monthDb.startDate)+' '+_('Equals to')+' %s'%_(self.altModeDesc))
self.startDateInput.set_value(jd_to(monthDb.startJd, self.altMode))
###########
selectYm = getCurrentYm() - 1 ## previous month
selectIndex = None
self.trees.clear()
for index, ym, mLen in monthDb.getMonthLenList():
if ym == selectYm:
selectIndex = index
year, month0 = divmod(ym, 12)
self.trees.append([
ym,
_(year),
_(monthName[month0]),
mLen,
'',
])
self.updateEndDates()
########
if selectIndex is not None:
self.treev.scroll_to_cell(str(selectIndex))
self.treev.set_cursor(str(selectIndex))
开发者ID:greyzero,项目名称:starcal,代码行数:31,代码来源:hijri.py
示例2: __init__
def __init__(self, module, opt):
t = opt[1]
self.opt = opt ## needed??
self.module = module
self.type = t
self.var_name = opt[0]
hbox = gtk.HBox()
if t==bool:
w = gtk.CheckButton(_(opt[2]))
self.get_value = w.get_active
self.set_value = w.set_active
elif t==list:
pack(hbox, gtk.Label(_(opt[2])))
w = gtk.ComboBoxText() ### or RadioButton
for s in opt[3]:
w.append_text(_(s))
self.get_value = w.get_active
self.set_value = w.set_active
elif t==int:
pack(hbox, gtk.Label(_(opt[2])))
w = IntSpinButton(opt[3], opt[4])
self.get_value = w.get_value
self.set_value = w.set_value
elif t==float:
pack(hbox, gtk.Label(_(opt[2])))
w = FloatSpinButton(opt[3], opt[4], opt[5])
self.get_value = w.get_value
self.set_value = w.set_value
else:
raise RuntimeError('bad option type "%s"'%t)
pack(hbox, w)
self._widget = hbox
####
self.updateVar = lambda: setattr(self.module, self.var_name, self.get_value())
self.updateWidget = lambda: self.set_value(getattr(self.module, self.var_name))
开发者ID:greyzero,项目名称:starcal,代码行数:35,代码来源:pref_utils.py
示例3: __init__
def __init__(self, group):
BaseWidgetClass.__init__(self, group)
######
sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
######
hbox = gtk.HBox()
label = gtk.Label(_('Scale'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.scaleCombo = common.Scale10PowerComboBox()
pack(hbox, self.scaleCombo)
pack(self, hbox)
####
hbox = gtk.HBox()
label = gtk.Label(_('Start'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.startSpin = IntSpinButton(-maxStartEnd, maxStartEnd)
pack(hbox, self.startSpin)
pack(self, hbox)
####
hbox = gtk.HBox()
label = gtk.Label(_('End'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.endSpin = IntSpinButton(-maxStartEnd, maxStartEnd)
pack(hbox, self.endSpin)
pack(self, hbox)
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:31,代码来源:largeScale.py
示例4: popupPopulate
def popupPopulate(self, label, menu):
itemCopyAll = ImageMenuItem(_("Copy _All"))
itemCopyAll.set_image(gtk.Image.new_from_stock(
gtk.STOCK_COPY,
gtk.IconSize.MENU),
)
itemCopyAll.connect("activate", self.copyAll)
##
itemCopy = ImageMenuItem(_("_Copy"))
itemCopy.set_image(gtk.Image.new_from_stock(
gtk.STOCK_COPY,
gtk.IconSize.MENU,
))
itemCopy.connect("activate", self.copy)
itemCopy.set_sensitive(
self.get_property("cursor-position") >
self.get_property("selection-bound")
) # FIXME
##
for item in menu.get_children():
menu.remove(item)
##
menu.add(itemCopyAll)
menu.add(itemCopy)
menu.show_all()
##
ui.updateFocusTime()
开发者ID:ilius,项目名称:starcal,代码行数:27,代码来源:datelabel.py
示例5: __init__
def __init__(self, term, **kwargs):
self.term = term
gtk.Dialog.__init__(self, **kwargs)
self.resize(800, 500)
self.set_title(_('View Weekly Schedule'))
self.connect('delete-event', self.onDeleteEvent)
#####
hbox = gtk.HBox()
self.currentWOnlyCheck = gtk.CheckButton(_('Current Week Only'))
self.currentWOnlyCheck.connect('clicked', lambda obj: self.updateWidget())
pack(hbox, self.currentWOnlyCheck)
##
pack(hbox, gtk.Label(''), 1, 1)
##
button = gtk.Button(_('Export to ')+'SVG')
button.connect('clicked', self.exportToSvgClicked)
pack(hbox, button)
##
pack(self.vbox, hbox)
#####
self._widget = WeeklyScheduleWidget(term)
pack(self.vbox, self._widget, 1, 1)
#####
self.vbox.show_all()
self.updateWidget()
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:25,代码来源:universityTerm.py
示例6: aboutShow
def aboutShow(self, obj=None, data=None):
if not self.aboutDialog:
from scal3.ui_gtk.about import AboutDialog
with open(
join(rootDir, "authors-dialog"),
encoding="utf-8",
) as authorsFile:
authors = authorsFile.read().splitlines()
dialog = AboutDialog(
name=core.APP_DESC,
version=core.VERSION,
title=_("About ") + core.APP_DESC,
authors=[
_(author) for author in authors
],
comments=core.aboutText,
license=core.licenseText,
website=core.homePage,
parent=self,
)
# add Donate button, FIXME
dialog.connect("delete-event", self.aboutHide)
dialog.connect("response", self.aboutHide)
#dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file(ui.logo))
#dialog.set_skip_taskbar_hint(True)
self.aboutDialog = dialog
openWindow(self.aboutDialog)
开发者ID:ilius,项目名称:starcal,代码行数:27,代码来源:starcal.py
示例7: __init__
def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont):
from scal3.ui_gtk.mywidgets import MyFontButton
gtk.HBox.__init__(self)
self.wcal = wcal
self._parent = wcal
self.index = index
self.mode = mode
######
module, ok = calTypes[mode]
if not ok:
raise RuntimeError("cal type %r not found" % mode)
label = gtk.Label(_(module.desc) + " ")
label.set_alignment(0, 0.5)
pack(self, label)
sgroupLabel.add_widget(label)
###
self.fontCheck = gtk.CheckButton(_("Font"))
pack(self, gtk.Label(""), 1, 1)
pack(self, self.fontCheck)
###
self.fontb = MyFontButton(wcal)
pack(self, self.fontb)
sgroupFont.add_widget(self.fontb)
####
self.set(params)
####
self.fontCheck.connect("clicked", self.onChange)
self.fontb.connect("font-set", self.onChange)
开发者ID:ilius,项目名称:starcal,代码行数:28,代码来源:weekCal.py
示例8: __init__
def __init__(self, **kwargs):
gtk.Dialog.__init__(self, **kwargs)
self.initVars()
ud.windowList.appendItem(self)
###
self.set_title(_('Day Info'))
self.connect('delete-event', self.onClose)
self.vbox.set_spacing(15)
###
dialog_add_button(self, gtk.STOCK_CLOSE, _('Close'), 0, self.onClose)
dialog_add_button(self, '', _('Previous'), 1, self.goBack)
dialog_add_button(self, '', _('Today'), 2, self.goToday)
dialog_add_button(self, '', _('Next'), 3, self.goNext)
###
self.allDateLabels = AllDateLabelsVBox()
self.pluginsTextView = PluginsTextView()
self.eventsView = DayOccurrenceView()
###
for item in (self.allDateLabels, self.pluginsTextView, self.eventsView):
self.appendItem(item)
###
exp = gtk.Expander()
exp.set_label(item.desc)
exp.add(item)
exp.set_expanded(True)
pack(self.vbox, exp)
self.vbox.show_all()
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:27,代码来源:day_info.py
示例9: __init__
def __init__(self, abrivateWeekDays=False):
self.abrivateWeekDays = abrivateWeekDays
self.absWeekNumber = core.getAbsWeekNumberFromJd(ui.cell.jd)## FIXME
gtk.TreeView.__init__(self)
self.set_headers_visible(False)
self.ls = gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str)## icon, weekDay, time, text
self.set_model(self.ls)
###
cell = gtk.CellRendererPixbuf()
col = gtk.TreeViewColumn(_('Icon'), cell)
col.add_attribute(cell, 'pixbuf', 0)
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_('Week Day'), cell)
col.add_attribute(cell, 'text', 1)
col.set_resizable(True)
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_('Time'), cell)
col.add_attribute(cell, 'text', 2)
col.set_resizable(True)## FIXME
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_('Description'), cell)
col.add_attribute(cell, 'text', 3)
col.set_resizable(True)
self.append_column(col)
开发者ID:greyzero,项目名称:starcal,代码行数:30,代码来源:occurrence_view.py
示例10: readLocationData
def readLocationData():
lines = open(dataDir+'/locations.txt').read().split('\n')
cityData = []
country = ''
for l in lines:
p = l.split('\t')
if len(p)<2:
#print(p)
continue
if p[0]=='':
if p[1]=='':
city, lat, lng = p[2:5]
#if country=='Iran':
# print(city)
if len(p)>4:
cityData.append((
country + '/' + city,
_(country) + '/' + _(city),
float(lat),
float(lng)
))
else:
print(country, p)
else:
country = p[1]
return cityData
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:26,代码来源:pray_times.py
示例11: optionsWidgetCreate
def optionsWidgetCreate(self):
from scal3.ui_gtk.mywidgets.multi_spin.integer import IntSpinButton
if self.optionsWidget:
return
self.optionsWidget = gtk.VBox()
####
if self.customizeWidth:
value = self.getWidthValue()
###
hbox = gtk.HBox()
pack(hbox, gtk.Label(_('Width')))
spin = IntSpinButton(0, 999)
pack(hbox, spin)
spin.set_value(value)
spin.connect('changed', self.widthSpinChanged)
pack(self.optionsWidget, hbox)
####
if self.customizeFont:
hbox = gtk.HBox()
pack(hbox, gtk.Label(_('Font Family')))
combo = FontFamilyCombo(hasAuto=True)
combo.set_value(self.getFontValue())
pack(hbox, combo)
combo.connect('changed', self.fontFamilyComboChanged)
pack(self.optionsWidget, hbox)
####
self.optionsWidget.show_all()
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:27,代码来源:weekCal.py
示例12: __init__
def __init__(self, event, typeChangable=True, isNew=False, useSelectedDate=False, **kwargs):
checkEventsReadOnly()
gtk.Dialog.__init__(self, **kwargs)
#self.set_transient_for(None)
#self.set_type_hint(gdk.WindowTypeHint.NORMAL)
self.isNew = isNew
#self.connect('delete-event', lambda obj, e: self.destroy())
#self.resize(800, 600)
###
dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
###
self.connect('response', lambda w, e: self.hide())
###
self.activeWidget = None
self._group = event.parent
self.eventTypeOptions = list(self._group.acceptsEventTypes)
####
if not event.name in self.eventTypeOptions:
self.eventTypeOptions.append(event.name)
eventTypeIndex = self.eventTypeOptions.index(event.name)
####
self.event = event
#######
if isNew and not event.timeZone:
event.timeZone = str(core.localTz)## why? FIXME
#######
hbox = gtk.HBox()
pack(hbox, gtk.Label(
_('Group') + ': ' + self._group.title
))
hbox.show_all()
pack(self.vbox, hbox)
#######
hbox = gtk.HBox()
pack(hbox, gtk.Label(_('Event Type')))
if typeChangable:
combo = gtk.ComboBoxText()
for tmpEventType in self.eventTypeOptions:
combo.append_text(event_lib.classes.event.byName[tmpEventType].desc)
pack(hbox, combo)
####
combo.set_active(eventTypeIndex)
####
#self.activeWidget = makeWidget(event)
combo.connect('changed', self.typeChanged)
self.comboEventType = combo
else:
pack(hbox, gtk.Label(': '+event.desc))
pack(hbox, gtk.Label(''), 1, 1)
hbox.show_all()
pack(self.vbox, hbox)
#####
if useSelectedDate:
self.event.setJd(ui.cell.jd)
self.activeWidget = makeWidget(event)
if self.isNew:
self.activeWidget.focusSummary()
pack(self.vbox, self.activeWidget, 1, 1)
self.vbox.show()
开发者ID:greyzero,项目名称:starcal,代码行数:60,代码来源:editor.py
示例13: __init__
def __init__(self):
gtk.HBox.__init__(self, spacing=4)
self.mode = calTypes.primary
####
pack(self, gtk.Label(_("Year")))
self.spinY = YearSpinButton()
pack(self, self.spinY)
####
pack(self, gtk.Label(_("Month")))
comboMonth = gtk.ComboBoxText()
module, ok = calTypes[self.mode]
if not ok:
raise RuntimeError("cal type %r not found" % self.mode)
for i in range(12):
comboMonth.append_text(_(module.getMonthName(
i + 1,
None, # year=None means all months
)))
comboMonth.set_active(0)
pack(self, comboMonth)
self.comboMonth = comboMonth
####
pack(self, gtk.Label(_("Day")))
self.spinD = DaySpinButton()
pack(self, self.spinD)
self.comboMonthConn = comboMonth.connect(
"changed",
self.comboMonthChanged,
)
self.spinY.connect("changed", self.comboMonthChanged)
开发者ID:ilius,项目名称:starcal,代码行数:30,代码来源:ymd.py
示例14: _save
def _save(self, path):
comboItem = self.combo.get_active()
months = []
module = calTypes.primaryModule()
if comboItem == 0:
s = getCurrentMonthStatus()
months = [s]
title = "%s %s" % (
locale_man.getMonthName(
calTypes.primary,
s.month,
s.year,
),
_(s.year),
)
elif comboItem == 1:
for i in range(1, 13):
months.append(getMonthStatus(ui.cell.year, i))
title = "%s %s" % (_("Calendar"), _(ui.cell.year))
elif comboItem == 2:
y0, m0 = self.ymBox0.get_value()
y1, m1 = self.ymBox1.get_value()
for ym in range(y0 * 12 + m0 - 1, y1 * 12 + m1):
y, m = divmod(ym, 12)
m += 1
months.append(getMonthStatus(y, m))
title = _("Calendar")
exportToHtml(path, months, title)
self.hide()
开发者ID:ilius,项目名称:starcal,代码行数:29,代码来源:export.py
示例15: __init__
def __init__(self, abrivateWeekDays=False):
self.abrivateWeekDays = abrivateWeekDays
self.absWeekNumber = core.getAbsWeekNumberFromJd(ui.cell.jd)## FIXME
gtk.TreeView.__init__(self)
self.set_headers_visible(False)
self.ls = gtk.ListStore(
GdkPixbuf.Pixbuf, # icon
str, # weekDay
str, # time
str, # text
)
self.set_model(self.ls)
###
cell = gtk.CellRendererPixbuf()
col = gtk.TreeViewColumn(_("Icon"), cell)
col.add_attribute(cell, "pixbuf", 0)
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_("Week Day"), cell)
col.add_attribute(cell, "text", 1)
col.set_resizable(True)
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_("Time"), cell)
col.add_attribute(cell, "text", 2)
col.set_resizable(True)## FIXME
self.append_column(col)
###
cell = gtk.CellRendererText()
col = gtk.TreeViewColumn(_("Description"), cell)
col.add_attribute(cell, "text", 3)
col.set_resizable(True)
self.append_column(col)
开发者ID:ilius,项目名称:starcal,代码行数:35,代码来源:occurrence_view.py
示例16: __init__
def __init__(self, event):## FIXME
common.WidgetClass.__init__(self, event)
################
hbox = gtk.HBox()
pack(hbox, gtk.Label(_('Month')))
self.monthCombo = MonthComboBox()
self.monthCombo.build(event.mode)
pack(hbox, self.monthCombo)
pack(hbox, gtk.Label(''), 1, 1)
#pack(self, hbox)
###
#hbox = gtk.HBox()
pack(hbox, gtk.Label(_('Day')))
self.daySpin = DaySpinButton()
pack(hbox, self.daySpin)
pack(hbox, gtk.Label(''), 1, 1)
pack(self, hbox)
###
hbox = gtk.HBox()
self.startYearCheck = gtk.CheckButton(_('Start Year'))
pack(hbox, self.startYearCheck)
self.startYearSpin = YearSpinButton()
pack(hbox, self.startYearSpin)
pack(hbox, gtk.Label(''), 1, 1)
pack(self, hbox)
self.startYearCheck.connect('clicked', self.startYearCheckClicked)
####
self.notificationBox = common.NotificationBox(event)
pack(self, self.notificationBox)
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:29,代码来源:yearly.py
示例17: getStatusIconTooltip
def getStatusIconTooltip(self):
##tt = core.weekDayName[core.getWeekDay(*ddate)]
tt = core.weekDayName[core.jwday(ui.todayCell.jd)]
#if ui.pluginsTextStatusIcon:##?????????
# sep = _(",")+" "
#else:
sep = "\n"
for mode in calTypes.active:
y, m, d = ui.todayCell.dates[mode]
tt += "%s%s %s %s" % (
sep,
_(d),
locale_man.getMonthName(mode, m, y),
_(y),
)
if ui.pluginsTextStatusIcon:
text = ui.todayCell.pluginsText
if text != "":
tt += "\n\n%s" % text # .replace("\t", "\n") ## FIXME
for item in ui.todayCell.eventsData:
if not item["showInStatusIcon"]:
continue
itemS = ""
if item["time"]:
itemS += item["time"] + " - "
itemS += item["text"][0]
tt += "\n\n%s" % itemS
return tt
开发者ID:ilius,项目名称:starcal,代码行数:28,代码来源:starcal.py
示例18: __init__
def __init__(self, account=None, **kwargs):
gtk.Dialog.__init__(self, **kwargs)
self.set_title(_('Edit Account') if account else _('Add New Account'))
###
dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
##
self.connect('response', lambda w, e: self.hide())
#######
self.account = account
self.activeWidget = None
#######
hbox = gtk.HBox()
combo = gtk.ComboBoxText()
for cls in event_lib.classes.account:
combo.append_text(cls.desc)
pack(hbox, gtk.Label(_('Account Type')))
pack(hbox, combo)
pack(hbox, gtk.Label(''), 1, 1)
pack(self.vbox, hbox)
####
if self.account:
self.isNew = False
combo.set_active(event_lib.classes.account.names.index(self.account.name))
else:
self.isNew = True
defaultAccountTypeIndex = 0
combo.set_active(defaultAccountTypeIndex)
self.account = event_lib.classes.account[defaultAccountTypeIndex]()
self.activeWidget = None
combo.connect('changed', self.typeChanged)
self.comboType = combo
self.vbox.show_all()
self.typeChanged()
开发者ID:greyzero,项目名称:starcal,代码行数:34,代码来源:account_op.py
示例19: optionsWidgetCreate
def optionsWidgetCreate(self):
from scal3.ui_gtk.pref_utils import LiveLabelSpinPrefItem, SpinPrefItem, \
LiveCheckColorPrefItem, CheckPrefItem, ColorPrefItem
if self.optionsWidget:
return
ColumnBase.optionsWidgetCreate(self)
#####
prefItem = LiveLabelSpinPrefItem(
_("Height"),
SpinPrefItem(ui, "wcalHeight", 1, 9999, digits=0),
self.heightUpdate,
)
pack(self.optionsWidget, prefItem.getWidget())
###
prefItem = LiveLabelSpinPrefItem(
_("Text Size Scale"),
SpinPrefItem(ui, "wcalTextSizeScale", 0.01, 1, digits=2),
self.queue_draw,
)
pack(self.optionsWidget, prefItem.getWidget())
########
prefItem = LiveCheckColorPrefItem(
CheckPrefItem(ui, "wcalGrid", _("Grid")),
ColorPrefItem(ui, "wcalGridColor", True),
self.queue_draw,
)
pack(self.optionsWidget, prefItem.getWidget())
###
self.optionsWidget.show_all()
开发者ID:ilius,项目名称:starcal,代码行数:30,代码来源:weekCal.py
示例20: save
def save(self, widget=None):
self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.WATCH))
while gtk.events_pending():
gtk.main_iteration_do(False)
path = self.fcw.get_filename()
if path in (None, ''):
return
print('Exporting to html file "%s"'%path)
i = self.combo.get_active()
months = []
module = calTypes.primaryModule()
if i==0:
s = getCurrentMonthStatus()
months = [s]
title = '%s %s'%(locale_man.getMonthName(calTypes.primary, s.month, s.year), _(s.year))
elif i==1:
for i in range(1, 13):
months.append(getMonthStatus(ui.cell.year, i))
title = '%s %s'%(_('Calendar'), _(ui.cell.year))
elif i==2:
y0, m0 = self.ymBox0.get_value()
y1, m1 = self.ymBox1.get_value()
for ym in range(y0*12+m0-1, y1*12+m1):
y, m = divmod(ym, 12)
m += 1
months.append(getMonthStatus(y, m))
title = _('Calendar')
exportToHtml(path, months, title)
self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.LEFT_PTR))
self.hide()
开发者ID:greyzero,项目名称:starcal,代码行数:30,代码来源:export.py
注:本文中的scal3.locale_man._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论