def initCinfo(self, fileid, tabs, ar, ctalts): data = {} scroll = self.get_parent() try: data = cities.get(fileid) except KeyError as e: print "initCinfo: An error occurred accessing %s: %s" % (fileid, e) return scroll = self.get_parent() label = gtk.Label("City:") label.set_alignment(0, 0) label.show() self.pack_start(label, 0, 0, 1) self.s1 = gtk.HSeparator() self.pack_start(self.s1, False, False, 2) self.s1.show() name = buildarow(scroll, "Name:", data, fileid, "name", ar, ctalts) self.pack_start(name, 0, 0, 2) state = buildStateRow(scroll, data, fileid) self.pack_start(state, 0, 0, 2) row = gtk.HBox() row.show() path = ["info", "start"] label = gtk.Label("Start Date:") label.show() row.pack_start(label, False, False, 2) start = gtk.Entry(25) start.show() start.set_text(getInf(data, path)) activateInfoEntry(start, ar, ctalts, scroll, data, fileid, "start") row.pack_start(start, True, True, 2) path2 = [fileid, "info"] path2.append(path[-1]) placeCalendarButton(data, row, start, path2, ctalts, counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label, False, False, 2) scue = gtk.Entry(25) scue.show() path[1] = "scue" scue.set_text(getInf(data, path)) activateInfoEntry(scue, ar, ctalts, scroll, data, fileid, "scue") row.pack_start(scue, True, True, 2) self.pack_start(row, False, False, 2) row = gtk.HBox() row.show() label = gtk.Label("End Date:") label.show() row.pack_start(label, False, False, 2) end = gtk.Entry(25) end.show() path[1] = "end" end.set_text(getInf(data, path)) activateInfoEntry(end, ar, ctalts, scroll, data, fileid, "end") row.pack_start(end, True, True, 2) path2 = [fileid, "info"] path2.append(path[-1]) placeCalendarButton(data, row, end, path2, ctalts, counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label, False, False, 2) ecue = gtk.Entry(25) ecue.show() path[1] = "ecue" ecue.set_text(getInf(data, path)) activateInfoEntry(ecue, ar, ctalts, scroll, data, fileid, "ecue") row.pack_start(ecue, True, True, 2) self.pack_start(row, False, False, 2) self.aspects = buildaspectrow(scroll, cities.get(fileid), fileid, ar, ctalts) # ,display = 0) self.add(self.aspects) """ Population Major products/industries Major landmarks (list?) Primary power Secondary powers Demographics/Main race Districts (notebox) History? """ self.notebox = gtk.VBox() self.notebox.show() self.pack_start(self.notebox, True, False, 2) label = gtk.Label("Places") label.set_alignment(0, 0) label.show() self.notebox.pack_start(label, 0, 0, 1) s1 = gtk.HSeparator() self.notebox.pack_start(s1, False, False, 2) s1.show() box = gtk.HBox() box.show() addbut = gtk.Button("Register Place") image = gtk.Image() image.set_from_file("img/add.png") image.show() addbut.set_image(image) addbut.show() path = ["info", "places"] state = validateFileid(getInf(data, ["info", "statefile"], "")) cityname = getInf(data, ["info", "name"], "") cityplaces = getInf(data, path, {}) for l in cityplaces.keys(): fi = l name = getInf(cityplaces, [l, "name"], "") pushLoc(state, "", fileid, cityname, fi, name) lbook = getPlacesIn(fileid) addbut.connect( "clicked", choosePlace, self.notebox, tabs, scroll, data, fileid, ar, ctalts, "Register in %s..." % cityname ) box.pack_end(addbut, False, False, 1) self.notebox.pack_start(box, False, False, 1) for l in sorted(lbook.keys()): if l != "_name": newplace = False if l not in cityplaces.keys(): newplace = True pushPlace(fileid, l, lbook[l]) packPlace(self.notebox, scroll, data, fileid, l, lbook[l], tabs, newplace) el = gtk.Label("End of record") el.show() el.set_alignment(1, 1) self.pack_start(el, 0, 0, 3)
def initPinfo(self, fileid,ar,psalts): global people global config info = {} scroll = self.get_parent() try: info = people[fileid]['info'] except KeyError as e: print "initPinfo: An error occurred accessing %s: %s" % (fileid,e) return scroll = self.get_parent() self.namelabelbox = gtk.HBox() self.namelabelbox.show() self.l1 = gtk.Label("Name:") self.l1.set_alignment(0,0) self.namelabelbox.pack_start(self.l1,1,1,2) self.nord = gtk.CheckButton("Order reversed") self.nord.show() self.nord.set_active(isOrderRev(fileid)) self.nord.unset_flags(gtk.CAN_FOCUS) self.nord.connect("clicked",toggleOrder,fileid) self.namelabelbox.pack_start(self.nord,0,0,2) self.add(self.namelabelbox) self.namebox = gtk.HBox() self.namebox.set_border_width(2) self.add(self.namebox) self.namebox.show() self.l5 = gtk.Label("Title:") self.ctitle = gtk.Entry(5) self.l2 = gtk.Label("Family:") self.fname = gtk.Entry(25) activateInfoEntry(self.fname,ar,psalts,scroll,people.get(fileid),fileid,"fname") self.l3 = gtk.Label("Given:") self.gname = gtk.Entry(25) activateInfoEntry(self.gname,ar,psalts,scroll,people.get(fileid),fileid,"gname") self.l4 = gtk.Label("Middle/Maiden:") self.mname = gtk.Entry(25) activateInfoEntry(self.mname,ar,psalts,scroll,people.get(fileid),fileid,"mname") self.namebox.add(self.l5) self.namebox.add(self.ctitle) self.ctitle.set_width_chars(4) self.fname.set_width_chars(10) self.gname.set_width_chars(10) self.mname.set_width_chars(10) self.namebox.set_child_packing(self.ctitle,0,0,2,gtk.PACK_START) data = people.get(fileid) self.ctitle.set_text(getInf(data,["info","ctitle"])) self.ctitle.show() activateInfoEntry(self.ctitle,ar,psalts,scroll,people.get(fileid),fileid,"ctitle") if config['familyfirst'] == True: self.namebox.add(self.l2) self.namebox.add(self.fname) self.namebox.add(self.l3) self.namebox.add(self.gname) self.gname.set_text(getInf(data,["info","gname"])) self.gname.show() self.namebox.add(self.l4) self.namebox.add(self.mname) self.mname.set_text(getInf(data,["info","mname"])) if config['usemiddle'] == True: self.mname.show() if config['familyfirst'] == False: self.namebox.add(self.l2) self.namebox.add(self.fname) self.fname.set_text(getInf(data,["info","fname"])) self.fname.show() self.l1.show() self.l2.show() self.l3.show() self.l4.show() self.l5.show() self.cname = buildarow(scroll,"Common Name:",people.get(fileid),fileid,'commonname',ar,psalts,tooltip="Name commonly used to refer to this character\nShows at the top of the XSL template") # TODO: Some day, maybe move all these labels into a dict and generate these things algorithmically? What about sections? self.add(self.cname) self.nname = buildarow(scroll,"Nickname:",people.get(fileid),fileid,'nname',ar,psalts,tooltip="Something other characters call this one") self.add(self.nname) self.gender = buildGenderRow(scroll,people.get(fileid),fileid,ar,psalts) self.add(self.gender) self.bday = buildarow(scroll,"Birth Date:",people.get(fileid),fileid,'bday',ar,psalts,style=3,tooltip="Date of person's birth") self.add(self.bday) self.dday = buildarow(scroll,"Death Date:",people.get(fileid),fileid,'dday',ar,psalts,style=3,tooltip="Date of person's death") self.add(self.dday) self.l6 = gtk.Label("Stories") self.l6.set_alignment(0,0) self.l6.show() self.add(self.l6) self.s1 = gtk.HSeparator() self.add(self.s1) self.s1.show() self.stories = buildarow(scroll,"Stories:",people.get(fileid),fileid,'stories',ar,psalts,style=2,tooltip="Stories where this character appears") self.add(self.stories) storyDefault(self.stories.e,config['realmdir']) self.mention = buildarow(scroll,"First Mention:",people.get(fileid),fileid,'mention',ar,psalts,tooltip="In which (story:)scene does someone first mention this person?") self.add(self.mention) self.appearch = buildarow(scroll,"First appeared (chron):",people.get(fileid),fileid,'appear1ch',ar,psalts,tooltip="First scene where the person appeared, based on the scene's position in the story") self.add(self.appearch) self.appearwr = buildarow(scroll,"First appeared (writ):",people.get(fileid),fileid,'appear1wr',ar,psalts,tooltip="First scene where the person appeared, based on when the scene was written") self.add(self.appearwr) self.conflict = buildarow(scroll,"Conflict:",people.get(fileid),fileid,'conflict',ar,psalts,tooltip="What disputes does this person have with the protagonist, or on what issues do they disagree?") self.add(self.conflict) self.leadrel = buildarow(scroll,"Relation to lead:",people.get(fileid),fileid,'leadrel',ar,psalts,tooltip="What is this person's relationship to the protagonist/lead character?") self.add(self.leadrel) self.l7 = gtk.Label("Physical Appearance") self.l7.set_alignment(0,1) self.l7.show() self.add(self.l7) self.s2 = gtk.HSeparator() self.add(self.s2) self.s2.show() self.bodytyp = buildarow(scroll,"Body Type:",people.get(fileid),fileid,'bodytyp',ar,psalts,tooltip="Description of the person's body or general appearance") self.add(self.bodytyp) self.age = buildarow(scroll,"Age:",people.get(fileid),fileid,'age',ar,psalts,tooltip="How old is this person?") ageText(self.bday.e,self.dday.e,self.age) if config['hideage']: self.age.e.hide() self.add(self.age) self.skin = buildarow(scroll,"Skin:",people.get(fileid),fileid,'skin',ar,psalts,tooltip="Skin tone or type (e.g., light, dark, hairy, scaly)") self.add(self.skin) self.eyes = buildarow(scroll,"Eyes:",people.get(fileid),fileid,'eyes',ar,psalts,tooltip="Color, type, or attributes of the person's eyes") self.add(self.eyes) self.hair = buildarow(scroll,"Hair:",people.get(fileid),fileid,'hair',ar,psalts,tooltip="Color, amount, descriptions of the person's hair or fur") self.add(self.hair) self.dmarks = buildarow(scroll,"Distinguishing Marks:",people.get(fileid),fileid,'dmarks',ar,psalts,tooltip="Any markings that distinguish this person from others (birthmarks, scars, etc.)") self.add(self.dmarks) self.dress = buildarow(scroll,"Dress:",people.get(fileid),fileid,'dress',ar,psalts,tooltip="How does this person normally dress?") self.add(self.dress) self.attpos = buildarow(scroll,"Attached Possessions:",people.get(fileid),fileid,'attposs',ar,psalts,tooltip="What does this person usually have at hand?") self.add(self.attpos) self.asmell = buildarow(scroll,"Associated Smell:",people.get(fileid),fileid,'asmell',ar,psalts,tooltip="What smell(s) would others associate with this person?") self.add(self.asmell) self.l8 = gtk.Label("Personality Traits") self.l8.set_alignment(0,1) self.l8.show() self.add(self.l8) self.s3 = gtk.HSeparator() self.add(self.s3) self.s3.show() self.pers = buildarow(scroll,"Personality:",people.get(fileid),fileid,'personality',ar,psalts,tooltip="General description of personality") self.add(self.pers) self.speech = buildarow(scroll,"Distinct Speech:",people.get(fileid),fileid,'speech',ar,psalts,tooltip="Speech patterns that set this person apart") self.add(self.speech) self.formocc = buildarow(scroll,"Former Occupation:",people.get(fileid),fileid,'formocc',ar,psalts,style=1,tooltip="The person's previous job") self.add(self.formocc) self.curocc = buildarow(scroll,"Current Occupation:",people.get(fileid),fileid,'currocc',ar,psalts,style=1,tooltip="The person's current job or preoccupation") self.add(self.curocc) self.strength = buildarow(scroll,"Strengths:",people.get(fileid),fileid,'strength',ar,psalts,tooltip="What does this character do well or have as benefits?") self.add(self.strength) self.weak = buildarow(scroll,"Weakness:",people.get(fileid),fileid,'weak',ar,psalts,tooltip="What does this character do poorly, or what things keep this character from achieving goals easily?") self.add(self.weak) self.mole = buildarow(scroll,"Mole:",people.get(fileid),fileid,'mole',ar,psalts,) self.add(self.mole) self.hobby = buildarow(scroll,"Hobby:",people.get(fileid),fileid,'hobby',ar,psalts,tooltip="What does this character like to do with free time?") self.add(self.hobby) self.aspects = buildaspectrow(scroll,people.get(fileid),fileid,ar,psalts) # ,display = 0) self.add(self.aspects) self.l9 = gtk.Label("Miscellany") self.l9.set_alignment(0,1) self.l9.show() self.add(self.l9) self.s4 = gtk.HSeparator() self.add(self.s4) self.s4.show() self.misc = buildarow(scroll,"Misc:",people.get(fileid),fileid,'misc',ar,psalts,tooltip="Miscellaneous info") # make a textbox self.add(self.misc) self.ethnic = buildarow(scroll,"Ethnic background:",people.get(fileid),fileid,'ethnic',ar,psalts,tooltip="What kind of people are in this character's ancestry") self.add(self.ethnic) self.origin = buildarow(scroll,"Origin:",people.get(fileid),fileid,'origin',ar,psalts,tooltip="Where was this character born (or descended from)?") addLocButton(self.origin,0,entry=self.origin.e) self.add(self.origin) self.backs = buildarow(scroll,"Background:",people.get(fileid),fileid,'backstory',ar,psalts,tooltip="Major life events, experiences, training") # make a textbox someday? self.add(self.backs) self.residence = buildarow(scroll,"Place of residence:",people.get(fileid),fileid,'residence',ar,psalts,tooltip="Where the person lives") self.add(self.residence) self.minchar = buildarow(scroll,"Minor related characters:",people.get(fileid),fileid,'minchar',ar,psalts,tooltip="Related characters that are too minor to get a record") self.add(self.minchar) self.talent = buildarow(scroll,"Talents:",people.get(fileid),fileid,'talent',ar,psalts,tooltip="Inate gifts") self.add(self.talent) self.abil = buildarow(scroll,"Abilities:",people.get(fileid),fileid,'abil',ar,psalts,tooltip="Trained abilities") # textbox someday? self.add(self.abil) self.sgoal = buildarow(scroll,"Story goal:",people.get(fileid),fileid,'sgoal',ar,psalts,tooltip="What the person is trying to do in the current story") self.add(self.sgoal) self.other = buildarow(scroll,"Other notes:",people.get(fileid),fileid,'other',ar,psalts) # textbox someday self.add(self.other) el = gtk.Label("End of record") el.show() el.set_alignment(1,1) self.pack_start(el,0,0,3)
def initLinfo(self, fileid,ar,plalts): data = {} scroll = self.get_parent() try: data = places.get(fileid) except KeyError as e: print "initLinfo: An error occurred accessing %s: %s" % (fileid,e) return scroll = self.get_parent() self.namelabelbox = gtk.HBox() self.namelabelbox.show() label = gtk.Label("Place:") label.set_alignment(0,0) label.show() self.namelabelbox.pack_start(label,1,1,2) self.pack_start(self.namelabelbox) self.s1 = gtk.HSeparator() self.pack_start(self.s1,False,False,2) self.s1.show() name = buildarow(scroll,"Name:",data,fileid,'name',ar,plalts) self.pack_start(name,0,0,2) commonname = buildarow(scroll,"Common Name:",data,fileid,'commonname',ar,plalts) self.pack_start(commonname,0,0,2) if commonname.e.get_text() == "" and name.e.get_text() != "": commonname.e.set_text(name.e.get_text()) commonname.e.emit("focus-out-event",gtk.gdk.Event(gtk.gdk.FOCUS_CHANGE)) row = gtk.HBox() row.show() path = ["info","start"] label = gtk.Label("Start Date:") label.show() row.pack_start(label,False,False,2) start = gtk.Entry(25) start.show() start.set_text(getInf(data,path)) activateInfoEntry(start,ar,plalts,scroll,data,fileid,"start") row.pack_start(start,True,True,2) path2 = [fileid,"info"] path2.append(path[-1]) placeCalendarButton(data,row,start,path2,plalts,counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label,False,False,2) scue = gtk.Entry(25) scue.show() path[1] = "scue" scue.set_text(getInf(data,path)) activateInfoEntry(scue,ar,plalts,scroll,data,fileid,"scue") row.pack_start(scue,True,True,2) self.pack_start(row,False,False,2) row = gtk.HBox() row.show() label = gtk.Label("End Date:") label.show() row.pack_start(label,False,False,2) end = gtk.Entry(25) end.show() path[1] = "end" end.set_text(getInf(data,path)) activateInfoEntry(end,ar,plalts,scroll,data,fileid,"end") row.pack_start(end,True,True,2) path2 = [fileid,"info"] path2.append(path[-1]) placeCalendarButton(data,row,end,path2,plalts,counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label,False,False,2) ecue = gtk.Entry(25) ecue.show() path[1] = "ecue" ecue.set_text(getInf(data,path)) activateInfoEntry(ecue,ar,plalts,scroll,data,fileid,"ecue") row.pack_start(ecue,True,True,2) self.pack_start(row,False,False,2) self.aspects = buildaspectrow(scroll,places.get(fileid),fileid,ar,plalts) # ,display = 0) self.add(self.aspects) label = gtk.Label("Stories") label.set_alignment(0,0) label.show() self.pack_start(label,False,False,2) self.s1 = gtk.HSeparator() self.pack_start(self.s1,False,False,2) self.s1.show() self.stories = buildarow(scroll,"Stories:",data,fileid,'stories',ar,plalts,2) self.pack_start(self.stories,False,False,2) self.mention = buildarow(scroll,"First Mentions:",data,fileid,'mention',ar,plalts) self.pack_start(self.mention,False,False,2) self.l7 = gtk.Label("Specifications") self.l7.set_alignment(0,1) self.l7.show() self.pack_start(self.l7,False,False,2) self.s2 = gtk.HSeparator() self.pack_start(self.s2,False,False,2) self.s2.show() self.desc = buildarow(scroll,"Description:",data,fileid,'desc',ar,plalts) self.pack_start(self.desc,False,False,2) self.address = buildarow(scroll,"Address:",data,fileid,'address',ar,plalts) self.pack_start(self.address,False,False,2) self.location = buildLocRow(data,fileid) self.pack_start(self.location,False,False,2) label = gtk.Label("Notes") label.set_alignment(0,0) label.show() self.pack_start(label,False,False,2) self.s1 = gtk.HSeparator() self.pack_start(self.s1,False,False,2) self.s1.show() notebox = gtk.VBox() notebox.show() self.pack_start(notebox,True,True,2) newbut = gtk.Button("Add a note") newbut.show() image = gtk.Image() image.set_from_file("img/add.png") newbut.set_image(image) newbut.connect("clicked",addNote,scroll,ar,plalts,notebox,fileid) box = gtk.HBox() box.show() box.pack_end(newbut,0,0,2) label = gtk.Label("Date") label.show() box.pack_end(label,0,0,2) label = gtk.Label("Note") label.show() box.pack_end(label,1,1,2) notebox.pack_start(box,0,0,2) notes = data.get("info") if notes: notes = notes.get("notes") if notes: for i in sorted(notes.keys()): dval = notes[i].get("date") cval = notes[i].get("content") if dval: dval = dval[0] if cval: cval = cval[0] if dval and cval: addNote(self,scroll,notebox,fileid,dval,cval,i) el = gtk.Label("End of record") el.show() el.set_alignment(1,1) self.pack_start(el,0,0,3)
def initSinfo(self, fileid,tabs,ar,stalts): global states data = {} scroll = self.get_parent() try: data = states.get(fileid) except KeyError as e: print "initSinfo: An error occurred accessing %s: %s" % (fileid,e) return label = gtk.Label("General") label.set_alignment(0,0) label.show() self.pack_start(label,0,0,1) self.s1 = gtk.HSeparator() self.pack_start(self.s1,False,False,2) self.s1.show() name = buildarow(scroll,"Name:",data,fileid,'name',ar,stalts) self.pack_start(name,0,0,2) row = gtk.HBox() row.show() path = ["info","start"] label = gtk.Label("Start Date:") label.show() row.pack_start(label,False,False,2) start = gtk.Entry(25) start.show() start.set_text(getInf(data,path)) activateInfoEntry(start,ar,stalts,scroll,data,fileid,"start") row.pack_start(start,True,True,2) path2 = [fileid,"info"] path2.append(path[-1]) placeCalendarButton(data,row,start,path2,stalts,counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label,False,False,2) scue = gtk.Entry(25) scue.show() path[1] = "scue" scue.set_text(getInf(data,path)) activateInfoEntry(scue,ar,stalts,scroll,data,fileid,"scue") row.pack_start(scue,True,True,2) self.pack_start(row,False,False,2) row = gtk.HBox() row.show() label = gtk.Label("End Date:") label.show() row.pack_start(label,False,False,2) end = gtk.Entry(25) end.show() path[1] = "end" end.set_text(getInf(data,path)) activateInfoEntry(end,ar,stalts,scroll,data,fileid,"end") row.pack_start(end,True,True,2) path2 = [fileid,"info"] path2.append(path[-1]) placeCalendarButton(data,row,end,path2,stalts,counter=ar) label = gtk.Label("Cue:") label.show() row.pack_start(label,False,False,2) ecue = gtk.Entry(25) ecue.show() path[1] = "ecue" ecue.set_text(getInf(data,path)) activateInfoEntry(ecue,ar,stalts,scroll,data,fileid,"ecue") row.pack_start(ecue,True,True,2) self.pack_start(row,False,False,2) ''' Vitals: State (i.e., empire, kingdom, republic, grand tribe) Adjective (Florida businesses) People (Floridians) Head of state (Governor) Capital (Tallahassee) Population Major resources Politics: Capital governance Foreign relations Organization (general) Culture Expected behaviors Rumors History Geography Economy Demographics ''' self.aspects = buildaspectrow(scroll,states.get(fileid),fileid,ar,stalts) # ,display = 0) self.add(self.aspects) self.notebox = gtk.VBox() self.notebox.show() self.pack_start(self.notebox,True,False,2) label = gtk.Label("Cities") label.set_alignment(0,0) label.show() self.notebox.pack_start(label,0,0,1) s1 = gtk.HSeparator() self.notebox.pack_start(s1,False,False,2) s1.show() box = gtk.HBox() box.show() addbut = gtk.Button("Register City") image = gtk.Image() image.set_from_file("img/add.png") image.show() addbut.set_image(image) addbut.show() path = ["info","cities"] statename = getInf(data,["info","name"],"") statecities = getInf(data,path,{}) for c in statecities.keys(): fi = c cityname = getInf(statecities,[fi,"name"],"") pushLoc(fileid,statename,fi,cityname) cbook = getCitiesIn(fileid) addbut.connect("clicked",chooseCity,self.notebox,tabs,scroll,data,fileid,ar,stalts,"Register in %s..." % statename) box.pack_end(addbut,False,False,1) self.notebox.pack_start(box,False,False,1) for c in sorted(cbook.keys()): if c != "_name": newcity = False cityname = cbook[c].get('_name',cbook.get(c,None)) if c not in statecities.keys(): newcity = True pushCity(fileid,c,cityname) if cityname is not None: packCity(self.notebox,scroll,data,fileid,c,cityname,tabs,newcity,ar,stalts) else: common.say("Error getting cityname.") el = gtk.Label("End of record") el.show() el.set_alignment(1,1) self.pack_start(el,0,0,3)