def __init__(self, config, pathname): Menu.__init__(self, "", config) self.fullpath = pathname self.dirname, self.filename = os.path.split(pathname) self.fileroot, self.fileext = os.path.splitext(self.filename) self.title = self.config.decode_title_text(self.fileroot) self.detail_image = None self.playable = True
def get_menu_dict(self): #crear en caso de que aun no se haya creado if not self.__menu_dict: menu_listar = Menu(msg('abm.app.listar'), self.listar) menu_docente = Menu(msg('abm.docente'), self.abm_docente) menu_funcionario = Menu(msg('abm.funcionario'), self.abm_funcionario) menu_contacto = Menu(msg('abm.contacto'), self.abm_contacto) menu_ficha = Menu(msg('abm.ficha'), self.abm_ficha) menu_laboratorio = Menu(msg('abm.laboratorio'), self.abm_laboratorio) menu_reservas = Menu(msg('abm.reservas'), self.abm_reservas) menu_consultas = Menu(msg('abm.consultas'), self.abm_consultas) menu_salir = Menu(msg('abm.salir'), self.salir) menus = { 1: menu_listar, 2: menu_docente, 3: menu_funcionario, 4: menu_contacto, 5: menu_ficha, 6: menu_laboratorio, 7: menu_reservas, 8: menu_consultas, 9: menu_salir } self.__menu_dict = menus return self.__menu_dict
def __init__(self, config): Menu.__init__(self, "Dinoteeth Media Launcher", config) self.movies = Menu("Movies", config) self.tv = Menu("TV", config) self.photos = Menu("Photos", config) self.games = Menu("Games", config) self.paused = Menu("Paused...", config) for item in [self.movies, self.tv, self.photos, self.games, self.paused]: self.add_item(item) for i in range(50): self.tv.add_item(Menu("Entry #%d" % i, self.config))
def get_menu_dict(self): #crear en caso de que aun no se haya creado if not self.__menu_dict: menu_listar = Menu(msg('abm.docente.listar'), self.listar) menu_registrar = Menu(msg('abm.docente.registrar'), self.registrar) #menu_borrar = Menu(msg('abm.docente.borrar'), self.borrar) menu_principal = Menu(msg('abm.ir.menu.principal'), self.ir_menu_principal) menus = {1: menu_listar, 2: menu_registrar, 3: menu_principal} self.__menu_dict = menus return self.__menu_dict
class RootMenu(Menu): def __init__(self, config): Menu.__init__(self, "Dinoteeth Media Launcher", config) self.movies = Menu("Movies", config) self.tv = Menu("TV", config) self.photos = Menu("Photos", config) self.games = Menu("Games", config) self.paused = Menu("Paused...", config) for item in [self.movies, self.tv, self.photos, self.games, self.paused]: self.add_item(item) for i in range(50): self.tv.add_item(Menu("Entry #%d" % i, self.config)) def parse_dir(self, path): print path MovieParser.add_videos_in_path(self.movies, self.config, path)
def DeleteMenu(self,request): menu_keys = request.get("menu_keys") logging.info(menu_keys) menus = Menu.get(menu_keys.split(",")) for menu in menus: menu.delete() util.flushMenuList() return True
def set_menu(self, menu): for tag, menu_item in menu.items(): self.session.merge( Menu(key_id=tag, name=menu_item[0], price=menu_item[1], spicy=menu_item[2])) self.session.commit()
def query(): menus = Menu.query() rt = [] for menu in menus.fetch(): rt.append(menu.to_dict()) return Response(json.dumps(rt), mimetype='application/json')
def getMenuList(): key_ = "blog_menuList_key" try: menus = memcache.get(key_) except Exception: menus = None if menus is None: menus = Menu.gql('WHERE valid =:1 ORDER BY order',True).fetch(100) memcache.add(key=key_, value=menus, time=3600) else: logging.debug("getMenuList from cache. ") return menus
def getMenuList(): key_ = "blog_menuList_key" try: menus = memcache.get(key_) except Exception: menus = None if menus is None: menus = Menu.all().filter('valid',True).order('order') memcache.add(key=key_, value=menus, time=3600) else: logging.debug("getMenuList from cache. ") return menus
def GetMenus(self): menus_ = Menu.all().order('order') menus = [] for menu_ in menus_: menu = datastore.Entity("Menu") menu["title"] = menu_.title menu["permalink"] = menu_.permalink menu["target"] = menu_.target menu["order"] = menu_.order menu["valid"] = menu_.valid menu['key'] = str(menu_.key()) menu['id'] = str(menu_.key().id()) menus+=[menu] returnValue = {"records":menus} return returnValue
def UpdateMenu(self,request): menu = Menu.get_by_id(int(request.get("id"))) editColumn = request.get("editColumn") if menu and editColumn: newData = request.get("newData") if editColumn == "title": menu.title = newData if editColumn == "permalink": menu.permalink = newData if editColumn == "target": menu.target = newData if editColumn == "order": menu.order = simplejson.loads(newData) if editColumn == "valid": menu.valid = simplejson.loads(newData) menu.put() util.flushMenuList() return True
def create(): data = request.get_json(force=True) menu = Menu(**data) key = menu.put() return redirect(url_for('get', menu_id=key.id()))
def get(self): pages = Weblog.all().filter("entrytype", "page").order("-date") menus = Menu.all().order("order") template_values = {"pages": pages, "menus": menus} self.generate("admin/admin_pages.html", template_values)
def DeleteMenu(self,request): menu = Menu.get_by_id(int(request.get("id"))) menu.delete() util.flushMenuList() return True