def newRealm(parent,self): fileid = common.getFileid(parent,None,None,"realm","Please enter a new unique filing identifier.","Realmid:","This short identifier will be used to identify the realm in selection dialogs and realm files. Valid characters are A-Z, 0-9, underscore, and dash. Do not include spaces, directories, or an extension, such as \".rlm\".") name = common.askBox("?","Please enter a name for your new realm.","Realm Name:",subtext="This is the name that will show up in the titlebar when you are in this realm.",nospace=False) rdir = common.askBox("?","Please enter the subdirectory where this realm's files will go.","Realm directory:",subtext="This directory may be a fully qualified path, or a path relative to %s/"% os.path.abspath("./"),nospace=True) if rdir is not None and rdir != "": backends.mkDir(rdir) mkRealm(parent,self,fileid,name,rdir)
def saveRealmAs(): fileid = common.getFileid("?",None,None,"realm","Please enter a new unique filing identifier.","Realmid:","This short identifier will be used to identify the realm in selection dialogs and realm files. Valid characters are A-Z, 0-9, underscore, and dash. Do not include spaces, directories, or an extension, such as \".rlm\".") name = common.askBox("?","Please enter a name for your new realm.","Realm Name:",subtext="This is the name that will show up in the titlebar when you are in this realm.",nospace=False) rdir = common.askBox("?","Please enter the subdirectory where this realm's files will go.","Realm directory:",subtext="This directory may be a fully qualified path, or a path relative to %s/"% os.path.abspath("./"),nospace=True) backends.mkDir(rdir) config['realmname'] = name # "New Realm" config['realmdir'] = rdir # "realms/default/" config['realmfile'] = fileid backends.saveRealm(config['realmfile'])
def addStoryRowNew(caller,parent,ed,target): row = gtk.HBox() row.show() text = "Please enter the short code for this story" label = "Code:" subtext = "\ This will be what is displayed in your\n\ backend files. Once set, it cannot be\n\ changed within this program. It may\n\ contain word characters (A-Z,0-9,_,-)\n\ only." code = common.askBox(ed,text,label,subtext=subtext,nospace=True) code = common.validateFileid(code) if code and len(code) > 0: label = gtk.Label(code) label.show() label.set_width_chars(4) row.pack_start(label,False,False,2) entry = gtk.Entry() entry.show() entry.set_width_chars(20) row.pack_start(entry,False,False,2) target.pack_start(row,False,False,2) entry.grab_focus() entry.connect("focus-out-event",setStory,code) refreshEd(parent,ed) else: status.push(0,"Story add cancelled.") return False
def chooseCity(parent,target,tabs,scroll,data,statef,ar,stalts,title = ""): global status global cities city = recordSelectBox(None,statef,title,'c') if city and city[1] == "city": cityname = "" citlist = getCityList(0) cityf = validateFileid(citlist.get(statef,["",""])[1]) cityname = citlist.get(statef,["",""])[0] statename = citlist.get(statef,["","",""])[2] try: cityname = cities[city[0]]['info']['name'][0] cities[city[0]]['info']['state'] = [statename,True] cities[city[0]]['info']['statefile'] = [statef,True] cities[city[0]]['info']['loc'] = [cityname,True] cities[city[0]]['info']['locfile'] = [cityf,True] cities[city[0]]['changed'] = True saveThisC(parent,city[0]) # reloadPlaceTab(place[0]) # TODO: Write a function like this except KeyError: # placename = getPlaceNameFromID(place[0]) cityname = askBox("?"," Please type the city name that goes with %s" % city[0],"Name",subtext=" I tried to load this from memory, but you\ndon't have %s open. Without it open, I can't\nsynchronize its city and state values.\n This requirement prevents unintentional\nchanges to your place records." % city[0]) # Maybe some day, I'll make this grab the placename from the file, and automatically load its record for updating if cityname == "": status.push(0,"Registering place in %s cancelled" % cityf) return False packCity(target,scroll,data,statef,city[0],cityname,tabs,True,ar,stalts) status.push(0,"Registered %s in %s" % (city[1],statef)) return True else: status.push(0,"Registering place in %s cancelled" % statef) return False
def choosePlace(parent, target, tabs, scroll, data, cityf, ar, ctalts, title=""): global status global places place = recordSelectBox(None, cityf, title, "l") if place and place[1] == "place": placename = "" citlist = getCityList(0) statef = validateFileid(citlist.get(cityf, ["", ""])[1]) cityname = citlist.get(cityf, ["", ""])[0] statename = citlist.get(cityf, ["", "", ""])[2] try: placename = places[place[0]]["info"]["name"][0] places[place[0]]["info"]["state"] = [statename, True] places[place[0]]["info"]["statefile"] = [statef, True] places[place[0]]["info"]["loc"] = [cityname, True] places[place[0]]["info"]["locfile"] = [cityf, True] places[place[0]]["changed"] = True saveThisL(parent, place[0]) # reloadPlaceTab(place[0]) # TODO: Write a function like this except KeyError: # placename = getPlaceNameFromID(place[0]) placename = askBox( None, " Please type the location name that goes with %s" % place[0], "Name", subtext=" I tried to load this from memory, but you\ndon't have %s open. Without it open, I can't\nsynchronize its city and state values.\n This requirement prevents unintentional\nchanges to your place records." % place[0], ) # Maybe some day, I'll make this grab the placename from the file, and automatically load its record for updating if placename == "": status.push(0, "Registering place in %s cancelled" % cityf) return False packPlace(target, scroll, data, cityf, place[0], placename, tabs, True, ar, ctalts) status.push(0, "Registered %s in %s" % (place[1], cityf)) return True else: status.push(0, "Registering place in %s cancelled" % cityf) return False
def testThis(self,window = None,b = 0,c = 0): x = askBox(window,"Test","Value") print x