本文整理汇总了Python中pytrainer.core.sport.Sport.color方法的典型用法代码示例。如果您正苦于以下问题:Python Sport.color方法的具体用法?Python Sport.color怎么用?Python Sport.color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pytrainer.core.sport.Sport
的用法示例。
在下文中一共展示了Sport.color方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_color_should_not_accept_none
# 需要导入模块: from pytrainer.core.sport import Sport [as 别名]
# 或者: from pytrainer.core.sport.Sport import color [as 别名]
def test_color_should_not_accept_none(self):
sport = Sport()
try:
sport.color = None
except(ValueError):
pass
else:
self.fail()
示例2: test_color_should_not_accept_none
# 需要导入模块: from pytrainer.core.sport import Sport [as 别名]
# 或者: from pytrainer.core.sport.Sport import color [as 别名]
def test_color_should_not_accept_none(self):
sport = Sport()
sport.color = None
try:
self.ddbb.session.add(sport)
self.ddbb.session.commit()
except StatementError:
pass
else:
self.fail()
示例3: on_newsport_accept_clicked
# 需要导入模块: from pytrainer.core.sport import Sport [as 别名]
# 或者: from pytrainer.core.sport.Sport import color [as 别名]
def on_newsport_accept_clicked(self,widget):
sport = Sport()
sport.name = gtk_str(self.newsportentry.get_text())
sport.met = self._trim_to_null(gtk_str(self.newmetentry.get_text()))
sport.weight = self._float_or_zero(gtk_str(self.newweightentry.get_text()))
sport.max_pace = self._trim_to_null(gtk_str(self.newmaxpace.get_text()))
sport.color = self.stored_color
if sport.name.lower() in [s.name.lower() for s in self._sport_service.get_all_sports()]:
msg = "Sport '%s' already exists" % sport.name
logging.error(msg)
md = Gtk.MessageDialog(None, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, _(msg))
md.set_title(_("Sport Creation Error"))
md.run()
md.destroy()
return
self._sport_service.store_sport(sport)
self.pytrainer_main.refreshMainSportList()
self.on_switch_page(None,None,2)
self.hidesportsteps()
self.buttonbox.set_sensitive(1)
self.sportlist.show()
示例4: on_newsport_accept_clicked
# 需要导入模块: from pytrainer.core.sport import Sport [as 别名]
# 或者: from pytrainer.core.sport.Sport import color [as 别名]
def on_newsport_accept_clicked(self,widget):
sport = Sport()
sport.name = unicode(self.newsportentry.get_text())
sport.met = self._trim_to_null(self.newmetentry.get_text())
sport.weight = self.newweightentry.get_text()
sport.max_pace = self._trim_to_null(self.newmaxpace.get_text())
sport.color = self.stored_color
if sport.name.lower() in [s.name.lower() for s in self._sport_service.get_all_sports()]:
msg = "Sport '%s' already exists" % sport.name
logging.error(msg)
md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, _(msg))
md.set_title(_("Sport Creation Error"))
md.run()
md.destroy()
return
self._sport_service.store_sport(sport)
self.parent.actualize_mainsportlist()
self.on_switch_page(None,None,2)
self.hidesportsteps()
self.buttonbox.set_sensitive(1)
self.sportlist.show()