rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.say('Dictionary: ?learn concept is definition || ?def concept || ?whatis concept')
self.say('Dictionary and user info: ?learn concept is definition || ?whois concept || ?whatis concept')
self.say('Dictionary: ?learn concept is definition || ?def concept || ?whatis concept')
self.say('User list: ?introduce')
self.say('Turn on or off heralding: ?herald')
self.say('Dictionary: ?learn concept is definition || ?def concept || ?whatis concept')
self.say('I understand now, Dr. Chandra; %s is %s' % (m, " & ".join(self.definitions[concept])))
self.say('I understand now, Dr. Chandra; %s is %s' % (concept, " & ".join(self.definitions[concept])))
def cmd_learn(self, m): """ Learn a definition """ if (m == ""): return words = m.split() if (len(words) < 3): self.say('I need at least 3 words with an \'is\' in the middle') return try: pos = words.index('is') except: self.say('I need an \'is\' in the middle') return concept = string.lower(' '.join(words[:pos])) def...
dumbphrases = ('I am now a dumber bot','Dave, my mind is going...') self.say(dumbphrases[int(random.random() *len(dumbphrases))])
def cmd_forget(self, m): """ Forget a definition """ if (m == ""): return words = m.split() if (len(words) < 3): self.say('I need at least 3 words with an \'is\' in the middle') return try: pos = words.index('is') except: self.say('I need an \'is\' in the middle') return concept = string.lower(' '.join(words[:pos])) d...
current_version=0
current_version=1
def check_dbversion(): cfg = Config.Config() current_version=0 try: dbversion=cfg.GetConfigItem("dbversion") except: #print "WARNING: dbversion tag added to database." #dbversion=0 #print cfg.NewConfigItem("dbversion","%s"%dbversion) print "WARNING: dbversion tag not found." print " : Check that your DB structur...
print "WARNING: dbversion tag indicates your database is out of date." print " : Recommend running with -u option."
print "WARNING: dbversion tag indicates your database is out of date. Updating..." update_dbversion()
def check_dbversion(): cfg = Config.Config() current_version=0 try: dbversion=cfg.GetConfigItem("dbversion") except: #print "WARNING: dbversion tag added to database." #dbversion=0 #print cfg.NewConfigItem("dbversion","%s"%dbversion) print "WARNING: dbversion tag not found." print " : Check that your DB structur...
def update_dbversion(): cfg = Config.Config() current_version=1 dbversion=int(cfg.GetConfigItem("dbversion"))
def check_dbversion(): cfg = Config.Config() current_version=0 try: dbversion=cfg.GetConfigItem("dbversion") except: #print "WARNING: dbversion tag added to database." #dbversion=0 #print cfg.NewConfigItem("dbversion","%s"%dbversion) print "WARNING: dbversion tag not found." print " : Check that your DB structur...
page['pagelink']="%s?action=searchResults&search=%s&offset=%s&limit=%s%s"%( self.config['general.cgi_url'], searchstring, (tot/limit+1)*limit, limit, pageappend) page['pagename']=(tot/limit+1)
page['pagelink']="%s?action=searchResults&search=%s&offset=%s&limit=%s%s"%( self.config['general.cgi_url'], searchstring, ((tot/limit+1)-2)*limit, limit, pageappend) page['pagename']=((tot/limit+1)-1)
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
ALTER TABLE `users` ADD COLUMN `style` int(10) DEFAULT 1; """) c._do_query( """
def update_dbversion(): cfg = Config.Config() current_version=1 dbversion=int(cfg.GetConfigItem("dbversion")) if dbversion<1: c = HaloRadio.db.cursor() c._do_query( """
if ( (numpages < pagefootlimit) ):
if ( numpages < pagefootlimit ):
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
if curpage <= pagefootlimit:
if curpage <= (pagefootlimit / 2):
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
query = """SELECT songid, requests, kills FROM %s WHERE userid='%d' ORDER BY requests - kills DESC LIMIT %d""" % ( self.tablename, userid, num )
query = """SELECT songid, requests, kills FROM %s WHERE userid='%d' AND requests - kills > 0 ORDER BY requests - kills DESC LIMIT %d""" % ( self.tablename, userid, num )
def GetTopRank ( self, userid, num ): self.list = [ ] query = """SELECT songid, requests, kills FROM %s WHERE userid='%d' ORDER BY requests - kills DESC LIMIT %d""" % ( self.tablename, userid, num ) result = self.do_my_query( query ) for row in result: (id, requests, kills) = row self.list.append((id, requests, kills))...
numpages = int ( tot / limit +1 )
numpages = int ( (tot -1) / limit +1 )
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
context.addGlobal ("totpage", tot/limit+1)
context.addGlobal ("totpage", numpages)
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
if curpage<numpages:
if curpage<(numpages-(pagefootlimit/2)):
def handler(self, context): pageappend = "" recent = 0 if self.form.has_key("search"): searchstring = self.form['search'].value else: searchstring = "NOTHINGwillMATCHthis" if self.form.has_key("offset"): offset = int(self.form['offset'].value) else: offset = 0
logger("fifo made. going to fork :-/ ...")
logger("fifo made.") logger("forking...")
def logger( strg ): print strg
logger("%d:shout got kill from child. Killing."%(cpid))
logger("%d:shout got kill from parent. Killing."%(cpid))
def logger( strg ): print strg
text = Text(chat_bar, height=1, background = log["background"], font = log["font"])
self.chat_text_entry = text = Text(chat_bar, height=1, background = log["background"], font = log["font"])
def virtual_event_name(s): return ( "<<" + s + ">>") # must be on a separate line.
self.perspective.callRemote("send_message", txt).addErrback(self.exception) return
self.node.remote_send_message(txt, self.node) return def enableChat(self): """ enables chat text entry widget """ self.chat_text_entry["state"] = NORMAL
def onChattextEntry(self, event): """ Obtain the last line in the text widget. Put the cursor at the end of the widget. Send the message. The event callback is called *before* that the key modify the text widget. """ text = event.widget txt = text.get("insert linestart", "insert lineend") # extract the actual line ...
self.chalks_instance.enableChat()
def start_collaborating(self, ret_tuple): """ Callback for the connection procedure. """ insert_index = self.text_widget.index("insert") assert len(ret_tuple) == 7, 'wrong number of state parameters received' """ What's returned by get_state(): return self.sites_index, self.state_vector_table, self.minimum_state_vect...
""" assert new_text, 'you were supposed to send me some text'
"""
def set_text(self, new_text): """ Blindly overwrite the text of this site. (including the "to_send" elements) """ assert new_text, 'you were supposed to send me some text' self.log( "Calling set_text '%s'"%(new_text), color="yellow" ) # for debugging # maintain an unicode buffer equivalent ConcurrentEditableNode.set_...
keys = self.sites_index.keys
keys = self.sites_index.keys()
def add_site(self, site_id): """ Add a site to the list of known sites. Known sites (normally all the nodes of the network) are possibly more than connected_sites (parent and childrens of the node) When adding a site, his reference is stored and the state_vectors are expanded. Due of the dinamic nature of the decentra...
f = Tk.Frame(parent,bd=0,relief="flat")
f = Tk.Frame(parent,bd=0,relief="flat",width=640,height=480)
def body(self, base_frame): """ build the body of the dialog window """ # base_frame self.root = root = base_frame #@ << create frames >> #@+node:<< create frames >> #f = Frame(root,bd=0,relief="flat") #f.pack(expand=1,fill="both",pady=1) #pane1 = Frame(f) #pane2 = Frame(f) #bar = Frame(f,bd=2,relief="raised",bg...
compiled_sources = [] compilable_sources = ["ConcurrentEdition.n", "Network.n", "Helpers.n", "Interfaces.n"]
compiled_sources = ["ping.dll"] compilable_sources = ["ConcurrentEdition.n", "Network.n", "ZeroConf.n", "Helpers.n", "Interfaces.n"]
def chalks_core(): target = "chalks_core.dll" resources = [] compiled_sources = [] compilable_sources = ["ConcurrentEdition.n", "Network.n", "Helpers.n", "Interfaces.n"] sources = resources + compiled_sources + compilable_sources for source in compiled_sources: build(source) ret = is_older(target, sources) if ret...
self.log_error("Could not found an aviable port in the range %s to provide webpublishing of the contents." % [web_portno, web_portno+10])
self.log_error("Could not find an available port in the range %s to provide webpublishing of the text contents." % [web_portno, web_portno+10])
def __init__(self, web_service=1): """ At the instanciation create the gui and install the reactor support """ root = Tk() tksupport.install(root) # Install the Reactor support self.body(root) # build the gui self.encoding = "utf-8" # is this standard, sustainable ? self.version = '0.0.1' self.file = None # wil...
return failure.Failure(error.UnauthorizedLogin("%s is not listed in the authorized users." % credential.username))
return failure.Failure(error.UnauthorizedLogin("'%s' is not listed in the authorized users list." % credential.username))
def requestAvatarId(self, credential): """ give access to everyone that requests it """ if 1: return credential.username else: return failure.Failure(error.UnauthorizedLogin("%s is not listed in the authorized users." % credential.username))
Indicate if the contents of the file have changed since last saved.
Indicates if the contents of the file have changed since last saved.
def is_dirty(self): """ Indicate if the contents of the file have changed since last saved. Use a hash function """ return self.saved_version_hash != hash(self.text_widget.get("1.0", END))
message = "File %s contain change not yet saved.\nWhen connecting a new text will be downloaded.\nDo you want to save the file before connecting ?" % self.filename
message = "File %s contains changes not yet saved.\nOnce connected, a new text will be downloaded.\nDo you want to save the current file before connecting ?" % self.filename
def connect_to_callback(event=None): """ what happens when the "Connect to" button is pressed """ # if required, request a save as if self.is_dirty(): if self.filename: message = "File %s contain change not yet saved.\nWhen connecting a new text will be downloaded.\nDo you want to save the file before connecting ?" % s...
message = "The text has not been saved.\nWhen connecting a new text will be downloaded.\nSave before connecting ?"
message = "The text has not been saved.\nOnce connected, a new text will be downloaded.\nSave before connecting ?"
def connect_to_callback(event=None): """ what happens when the "Connect to" button is pressed """ # if required, request a save as if self.is_dirty(): if self.filename: message = "File %s contain change not yet saved.\nWhen connecting a new text will be downloaded.\nDo you want to save the file before connecting ?" % s...
print "Requesting a connection to 'chalks://%s:%s' as '%s'" % (address, port, nickname)
print "Requesting a connection to 'chalks://%s:%s' as '%s', please wait..." % (address, port, nickname)
def connect_to_callback(event=None): """ what happens when the "Connect to" button is pressed """ # if required, request a save as if self.is_dirty(): if self.filename: message = "File %s contain change not yet saved.\nWhen connecting a new text will be downloaded.\nDo you want to save the file before connecting ?" % s...
Show the help of the program
Show main help screen
def onHelp(self, event=None): """ Show the help of the program """ from ScrolledText import ScrolledText top = Toplevel(self.root) top.title("Help") t = ScrolledText(top, wrap=WORD, padx=50); t.pack(expand=1, fill=BOTH) # add apropos t.insert(END, "\nChalks 0.1.0. Rodrigo Benenson, LeoN project 2004.") link_text = " ...
t.insert(END, "\nChalks 0.1.0. Rodrigo Benenson, LeoN project 2004.") link_text = " Online homepage"
t.insert(END, "\nChalks " + self.version + "\nLicensed under the GNU GPL\nCopyright 2004, Chalks Development Team") link_text = " Project homepage"
def onHelp(self, event=None): """ Show the help of the program """ from ScrolledText import ScrolledText top = Toplevel(self.root) top.title("Help") t = ScrolledText(top, wrap=WORD, padx=50); t.pack(expand=1, fill=BOTH) # add apropos t.insert(END, "\nChalks 0.1.0. Rodrigo Benenson, LeoN project 2004.") link_text = " ...
self.log("HB after operation avoyance %s"% self.HB, color="yellow")
self.log("HB after operation avoidance %s"% self.HB, color="yellow")
def delete_text(self, startpos, length, op={}): """ Some one delete text on the actual node. Should delete text in non "to_send" locations. Delete only remote solicitations, local text was already deleted. """ if op.get("avoid"): self.log( "AutoDeletion is avoiyed", color="yellow") # for debugging del op["avoid"] # I...
return
def __init__(self, site_index, num_of_sites): """ if site_index == None then the site is and Observer """ self.site_index = site_index self.state_vector = [0] * num_of_sites self.state_vector_table = [[0]* num_of_sites]* num_of_sites # required by the garbage collector (SVT) self.minimum_state_vector = [0]*num_of...
return
def __init__(self, _type=None, pos=None, data=None, timestamp=None, source_site=None, **kws): d = self d["type"] = str(_type) d["pos"] = pos assert type(data) in [unicode, int], "Data has to be unicode or integer." d["data"] = data # text or len d["timestamp"] = timestamp d["source_site"] = source_site for k in ...
return
def __init__(self, text=u""): """ """ assert type(text) is unicode, "Internal text data is managed as unicode data. Tried to initialize the ConcurrentEditableServer node with data %s '%s'" % (type(text), text) # init the internal ConcurrentEditable ConcurrentEditable.__init__(self, None, 0) # (self, site_index, num_o...
t_text = Label(top, text="fill all the entry spaces,") t_text.pack()
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") t_text = Label(top, text="fill all the entry spaces,") t_text.pack() #|-|-| t_frame = Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, colu...
t_frame = Frame(top, borderwidth=2, relief=GROOVE)
t_frame = LabelFrame(top, text="Enter remote server info", padx=5, pady=5)
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") t_text = Label(top, text="fill all the entry spaces,") t_text.pack() #|-|-| t_frame = Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, colu...
tt_frame = Frame(t_frame)
tt_frame = LabelFrame(top, text="Identify yourself", padx=5, pady=5)
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") t_text = Label(top, text="fill all the entry spaces,") t_text.pack() #|-|-| t_frame = Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, colu...
tt_frame.grid(row=2, column=0, columnspan=2, sticky=W, pady=5)
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") t_text = Label(top, text="fill all the entry spaces,") t_text.pack() #|-|-| t_frame = Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, colu...
t_frame.pack(ipadx= 5)
t_frame.pack(ipadx = 5) tt_frame.pack(ipadx = 5)
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") t_text = Label(top, text="fill all the entry spaces,") t_text.pack() #|-|-| t_frame = Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, colu...
A remote node send a message to us we repeat it to every known node except from the one that gived the message to us (this method is used to manage both parent and children remote calls (childrens access to an avatar that call this method))
A remote node sends a message to us we repeat it to every known node except from the one that gave the message to us (this method is used to manage both parent and children remote calls (children access to an avatar calling this method))
def remote_send_message(self, txt, who=None): """ A remote node send a message to us we repeat it to every known node except from the one that gived the message to us (this method is used to manage both parent and children remote calls (childrens access to an avatar that call this method)) """ if not who: who = self....
Disconnect from the server. """ deferred = self.avatar.callRemote("collaborate_out") deferred.addCallback(self.disconnected) deferred.addErrback(self.exception) return
Disconnect from the server. Also warn all my children about my disconnection """ perspectives = self.childrens_perspectives + [self.parent_perspective] for t_perspective in perspectives: if not t_perspective: continue t_deferred = t_perspective.callRemote("collaborate_out") t_deferred.addErrback(self.exception) self...
def disconnect_from_server(self): """ Disconnect from the server. """ deferred = self.avatar.callRemote("collaborate_out") deferred.addCallback(self.disconnected) deferred.addErrback(self.exception) return
Main class that construct the Graphical User Interface and contain other interactive objects, as the CollaborativeEditableNode. This class take care principaly of the Gui, the other tasks are delegated (components architecture, has-a architecture).
Main class that builds the Graphical User Interface and contains other interactive objects, such as the CollaborativeEditableNode. This class takes care mainly of the GUI. Other tasks are delegated (components architecture, has-a architecture).
# - need to make congruent the def start_collaborating(self, ret_tuple):
print "Chalks 0.1.0, started. GNU GPL. Rodrigo Benenson, LeoN project 2004.\n"
print "Chalks " + self.version + ", started. Licensed under the GNU GPL. Copyright 2004, Chalks Development Team (http://chalks.berlios.de)\n"
def __init__(self, web_service=1): """ At the instanciation create the gui and install the reactor support """ root = Tk() tksupport.install(root) # Install the Reactor support self.body(root) # build the gui self.encoding = "utf-8" # is this standard, sustainable ? self.file = None # will keep the file instanc...
give access to every one that request it
give access to everyone that requests it
def requestAvatarId(self, credential): """ give access to every one that request it """ if 1: return credential.username else: return failure.Failure(error.UnauthorizedLogin("%s is not listed in the authorized users." % credential.username))
self.log_error("Could not found an aviable port in the range %s to provide the chalks service." % [pb.portno, pb.portno+10] )
self.log_error("Unable to find an available port in the range %s to provide the chalks service." % [pb.portno, pb.portno+10] )
def requestAvatarId(self, credential): """ give access to every one that request it """ if 1: return credential.username else: return failure.Failure(error.UnauthorizedLogin("%s is not listed in the authorized users." % credential.username))
message = "File %s contain change not yet saved.\nDo you want to save the file before quitting ?" % self.filename
message = "File %s contains changes not yet saved to disk.\nDo you want to save the file before quiting ?" % self.filename
def quit(self, *args): """ """ # ask if we need to save the file if self.is_dirty(): # if file is dirty if self.filename: message = "File %s contain change not yet saved.\nDo you want to save the file before quitting ?" % self.filename else: message = "The text has not been saved. Save before exit ?" ret = self.askYe...
top.title("Help about the Admin Window")
top.title("Help")
def onHelp(self, event=None): """ Show the help of the program """ from ScrolledText import ScrolledText top = Toplevel(self.root) top.title("Help about the Admin Window") t = ScrolledText(top, wrap=WORD, padx=50); t.pack(expand=1, fill=BOTH) # add apropos t.insert(END, "\nChalks 0.1.0. Rodrigo Benenson, LeoN project...
url = "http://souvenirs.sf.net"
url = "http://chalks.berlios.de"
def online_homepage(self, event=1): import webbrowser url = "http://souvenirs.sf.net" try: webbrowser.open_new(url) except: print "not found: " + url
if len(txt) == 0: return
def onChattextEntry(self, event): """ Obtain the last line in the text widget. Put the cursor at the end of the widget. Send the message. The event callback is called *before* that the key modify the text widget. """ text = event.widget txt = text.get("insert linestart", "insert lineend") # extract the actual line ...
t_entry.insert(END, "4321")
t_entry.insert(END, "8787")
def onConnectTo(self, event=None): """ Open the connect to dialog """ top = Toplevel(self.root) top.title("Connect to ...") #|-|-| t_frame = LabelFrame(top, text="Enter remote server info", padx=5, pady=5)#Frame(top, borderwidth=2, relief=GROOVE) t_text = Label(t_frame, text="Address:") t_text.grid(row=0, column=0...
t_sites_index, t_state_vector_table, t_msv, t_hb, t_delayed_operations , base_text, base_state_vector = ret_tuple ops_list = []
t_sites_index, t_state_vector_table, t_msv, t_HB, t_delayed_operations , base_text, base_state_vector = ret_tuple
def start_collaborating(self, ret_tuple): """ Callback for the connection procedure. """ insert_index = self.text_widget.index("insert") assert len(ret_tuple) == 7, 'wrong number of state parameters received' """ What's returned by get_state(): return self.sites_index, self.state_vector_table, self.minimum_state_vect...
self.log("Received ops_list (len == %s) %s"%( len(ops_list), ops_list), color="yellow") for t_dict in ops_list:
self.log("Received ops_list (len == %s) %s"%( len(t_HB), t_HB), color="yellow") from ConcurrentEditable import Operation for t_dict in t_HB:
def start_collaborating(self, ret_tuple): """ Callback for the connection procedure. """ insert_index = self.text_widget.index("insert") assert len(ret_tuple) == 7, 'wrong number of state parameters received' """ What's returned by get_state(): return self.sites_index, self.state_vector_table, self.minimum_state_vect...
return self.node.get_state()
t_state = self.node.get_state(); t_state = list(t_state); t_HB = t_state[3]; t_HB = map(dict, t_HB); t_state[3] = t_HB; return t_state
def perspective_collaborate_in(self, id): """ Start collaborating with the node proceeds with site registration and returns the necessary data to configure the client (children) the id is a unique identifier of the client (child) process """ self.id = id self.node.add_site(id) # we register us in the parent return se...
dbg = 0
dbg = 1
def get_test_suite(): """ run the tests """ global dbg dbg = 0 import unittest TestSuite = unittest.TestSuite() TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable1)) TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable2)) TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable...
TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable2)) TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditableServer))
def get_test_suite(): """ run the tests """ global dbg dbg = 0 import unittest TestSuite = unittest.TestSuite() TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable1)) TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable2)) TestSuite.addTest(unittest.FunctionTestCase(TestConcurrentEditable...
+ '-t:exe -out:"chalks.exe" ' \
+ "-t:exe " '-out:"%s" '%target \
def chalks(): target = "chalks.exe" resources = ["chalks.glade", "chalks.ico"] compiled_sources = ["chalks_core.dll"] compilable_sources = ["Chalks.n", "Gui.n", "ConcurrentEditionWidget.n"] sources = resources + compiled_sources + compilable_sources for source in compiled_sources: if not os.path.exists(source): bui...
+ '-t:library -out:"chalks_core.dll" ' \
+ "-t:library " + '-out:"%s" '%target \
def chalks_core(): target = "chalks_core.dll" resources = [] compiled_sources = [] compilable_sources = ["ConcurrentEdition.n", "Network.n", "Helpers.n"] sources = resources + compiled_sources + compilable_sources for source in compiled_sources: if not os.path.exists(source): build(source) ret = is_older(target, s...
raise "to be implemented" return
test_network() test_cce() return def test_network(): target = "test_network.exe" resources = ["chalks.glade", "chalks.ico"] compiled_sources = ["chalks_core.dll"] compilable_sources = ["TestNetwork.n", "Gui.n", "ConcurrentEditionWidget.n"] sources = resources + compiled_sources + compilable_sources for source in...
def test(): ''' test: test_network.exe test_cce.exe
if os.stat(target).st_mtime > target_mtime: ret.add(source)
if os.stat(source).st_mtime > target_mtime: ret.append(source)
def is_older(target, sources): # check modification time # return the list of newer files if not os.path.exists(target): return sources ret = [] target_mtime = os.stat(target).st_mtime; for source in sources: if os.stat(target).st_mtime > target_mtime: ret.add(source) return ret
metadata = getMetadata(xml) allImages.append(xml, metadata)
metadata = {} allImages.append((xml, metadata))
def __call__(self, q, statusCallback=None): "Given a query, search all repositories and return the net list of (xml, metadata) duples"
def getMetadata(xml): "Given an xml document, get the rdf dc title value" metadata = {} doc = libxml2.parseDoc(xml) xp = doc.xpathNewContext() xp.xpathRegisterNs('svg', 'http://www.w3.org/2000/svg') xp.xpathRegisterNs('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns xp.xpathRegisterNs('cc', 'http://web.resource.org...
def __call__(self, q, statusCallback=None): "Given a query, search all repositories and return the net list of (xml, metadata) duples"
def __init__(self, config, searcher, renderer, outFile=None):
def __init__(self, config, searcher, renderer, outFile=None, inkscape=False, filename=None):
def __init__(self, config, searcher, renderer, outFile=None): "Modules is a list of repository module api objects used for querying"
print imgXML else: file(self.outFile, 'w').write(imgXML)
print output else: file(self.outFile, 'w').write(output)
def on_iconview_item_activated(self, widget, path): #origxml = minidom.parseString(sys.stdin.read()) imgXML = self.store[path[0]][0] if self.outFile is None: print imgXML else: file(self.outFile, 'w').write(imgXML) gtk.main_quit()
opts, args = getopt.getopt(sys.argv[1:], 'f:')
opts, args = getopt.getopt(sys.argv[1:], 'f:', ('id='))
def changeSelected(self, path): "Sync the preview pane with the currently selected item" if path is not None: self.previewImg.set_from_pixbuf(self.store[path][2]) label = '<b>Title</b>: %s\n<b>Artist</b>: %s\n<b>Keywords</b>: %s' % (self.store[path][4], self.store[path][5], ', '.join(self.store[path][6].split(';;'))) s...
interface = Interface(config, searcher, renderer, outFile=outFile)
interface = Interface(config, searcher, renderer, outFile=outFile, inkscape=inkscape, filename=args[0])
def changeSelected(self, path): "Sync the preview pane with the currently selected item" if path is not None: self.previewImg.set_from_pixbuf(self.store[path][2]) label = '<b>Title</b>: %s\n<b>Artist</b>: %s\n<b>Keywords</b>: %s' % (self.store[path][4], self.store[path][5], ', '.join(self.store[path][6].split(';;'))) s...
self.cancelButton.connect('clicked', lambda widget: window.destroy())
self.cancelButton.connect('clicked', lambda widget: self.window.destroy())
def __init__(self, config, outfile): self.config = config self.outfile = outfile self.xml = gtk.glade.XML('clipartbrowser.glade', 'settingswindow') self.window = self.xml.get_widget('settingswindow') self.cancelButton = self.xml.get_widget('settings_cancelbutton') self.okButton = self.xml.get_widget('settings_okbutton'...
security.declareProtected(ManagePortal, 'manage_overview')
security.declareProtected(ManagePortal, 'setExpirationTimeout')
def resetPassword(self, userid, randomstring, password): """Set the password (in 'password') for the user who maps to the string in 'randomstring' iff the entered 'userid' is equal to the mapped userid. (This can be turned off with the 'toggleUserCheck' method.)
member = self.getValidUser(userid)
member = self.getValidUser(stored_user)
def resetPassword(self, userid, randomstring, password): """Set the password (in 'password') for the user who maps to the string in 'randomstring' iff the entered 'userid' is equal to the mapped userid. (This can be turned off with the 'toggleUserCheck' method.)
uf.userSetPassword(userid, password)
uf.userSetPassword(stored_user, password)
def resetPassword(self, userid, randomstring, password): """Set the password (in 'password') for the user who maps to the string in 'randomstring' iff the entered 'userid' is equal to the mapped userid. (This can be turned off with the 'toggleUserCheck' method.)
return self.manage_overview(manage_tabs_message="Returning username check turned" % m)
return self.manage_overview(manage_tabs_message="Returning username check turned %s" % m)
def manage_toggleUserCheck(self, REQUEST=None): """ZMI method for toggling the flag for checking user names on return."""
totalmsg = ""
def process_client(sock, addr, ip, port): cont = 1 asock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) asock.connect((ip,port)) #sock.setblocking(0) #asock.setblocking(0) #try and except below wer placed for the use of #non-blocking sockets. this was just a test and should be removed #from the final version. whil...
asock.send(msg)
if string.find(msg,"INSERT") >-1 or string.find(msg,"insert")>-1 or string.find(msg,"UPDATE")>-1 or string.find(msg,"update")>-1 or string.find(sub,"DELETE")>-1 or string.find(sub,"delete")>-1: print "processing updating query" mip, mport = servers[masterid] msock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mso...
def process_client(sock, addr, ip, port): cont = 1 asock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) asock.connect((ip,port)) #sock.setblocking(0) #asock.setblocking(0) #try and except below wer placed for the use of #non-blocking sockets. this was just a test and should be removed #from the final version. whil...
syslog("processing client "+peer":"+ignore+" with server "+currid+" ("+ip+":"+port+")")
syslog.syslog("mysql-proxy: processing client "+peer+":"+str(ignore)+" with server "+str(currid)+" ("+ip+":"+str(port)+")")
def process_client(sock, addr, ip, port): cont = 1 asock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) asock.connect((ip,port)) #sock.setblocking(0) #asock.setblocking(0) #try and except below wer placed for the use of #non-blocking sockets. this was just a test and should be removed #from the final version. whil...
self.TextCtrl_MYSQL_USER = wx.TextCtrl(self, -1, "ANONYMOUS")
self.TextCtrl_MYSQL_USER = wx.TextCtrl(self, -1, "selector")
def __init__(self, *args, **kwds): # begin wxGlade: ConfiguratorFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.L_CLUSTER_IP = wx.StaticText(self, -1, "CLUSTER_IP") self.TextCtrl_CLUSTER_IP = wx.TextCtrl(self, -1, "") self.L_SSH_PATIENCE = wx.StaticText(self, -1, "SSH_P...
self.TextCtrl_MYSQL_PASSWORD = wx.TextCtrl(self, -1, "EMPTY")
self.TextCtrl_MYSQL_PASSWORD = wx.TextCtrl(self, -1, "selector")
def __init__(self, *args, **kwds): # begin wxGlade: ConfiguratorFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.L_CLUSTER_IP = wx.StaticText(self, -1, "CLUSTER_IP") self.TextCtrl_CLUSTER_IP = wx.TextCtrl(self, -1, "") self.L_SSH_PATIENCE = wx.StaticText(self, -1, "SSH_P...
self.TextCtrl_MYSQL_DATABASE = wx.TextCtrl(self, -1, "")
self.TextCtrl_MYSQL_DATABASE = wx.TextCtrl(self, -1, "test")
def __init__(self, *args, **kwds): # begin wxGlade: ConfiguratorFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.L_CLUSTER_IP = wx.StaticText(self, -1, "CLUSTER_IP") self.TextCtrl_CLUSTER_IP = wx.TextCtrl(self, -1, "") self.L_SSH_PATIENCE = wx.StaticText(self, -1, "SSH_P...
def schandler(sig, frame): syslog.syslog("mysql-proxy: child exited")
servers[0] = "192.168.0.10", 3306 def schandler(signum, frame): syslog.syslog("child exited")
def schandler(sig, frame): syslog.syslog("mysql-proxy: child exited")
con = s.accept()
try: con = s.accept() except: con = s.accept()
def process_client(sock, addr, ip, port): cont = 1 asock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) asock.connect((ip,port)) #sock.setblocking(0) #asock.setblocking(0) #try and except below wer placed for the use of #non-blocking sockets. this was just a test and should be removed #from the final version. whil...
signal.signal(signal.SIGCHLD, schandler)
def process_client(sock, addr, ip, port): cont = 1 asock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) asock.connect((ip,port)) #sock.setblocking(0) #asock.setblocking(0) #try and except below wer placed for the use of #non-blocking sockets. this was just a test and should be removed #from the final version. whil...
id = normalize_case(id)
id = network.normalize_case(id)
def __init__(self, network, type, id, title=None): gtk.VBox.__init__(self, False) if network: id = normalize_case(id) self.network = network self.type = type self.id = id
events.trigger("Close", self.window_list[network, type, id])
def __delitem__(self, item): network, type, id = item if network: id = network.normalize_case(id)
def get_window_for(self, network=None, type=None, id=None):
def get_window_for(network=None, type=None, id=None):
def get_window_for(self, network=None, type=None, id=None): if network: id = network.normalize_case(id) for n, t, i in self.window_list: if network and n != network: continue if type and t != type: continue if id and i != id: continue yield self.window_list[n, t, i]
for n, t, i in self.window_list:
for n, t, i in window_list:
def get_window_for(self, network=None, type=None, id=None): if network: id = network.normalize_case(id) for n, t, i in self.window_list: if network and n != network: continue if type and t != type: continue if id and i != id: continue yield self.window_list[n, t, i]
yield self.window_list[n, t, i] def get_status_window(self, network): for n, t, i in self.window_list:
yield window_list[n, t, i] def get_status_window(network): for n, t, i in window_list:
def get_window_for(self, network=None, type=None, id=None): if network: id = network.normalize_case(id) for n, t, i in self.window_list: if network and n != network: continue if type and t != type: continue if id and i != id: continue yield self.window_list[n, t, i]
return self.window_list[n, t, i]
return window_list[n, t, i]
def get_status_window(self, network): for n, t, i in self.window_list: if n == network and t == "status": return self.window_list[n, t, i]
network_info.get('server', '') , network_info['port']
network_info.get('server', '') , network_info.get('port')
def server_get_data(network_info): if 'port' in network_info: return "%s:%s" % ( network_info.get('server', '') , network_info['port'] ) else: return network_info.get('server', '')
if 'port' in network_info: del network_info['port']
network_info.pop('port', None)
def server_set_data(text, network_info): if ':' in text: network_info['server'], port = text.rsplit(':',1) network_info['port'] = int(port) else: network_info['server'] = text if 'port' in network_info: del network_info['port']
return '\n'.join(network_info.get('join', []))
return '\n'.join(network_info.get('join', ()))
def channels_get_data(network_info): return '\n'.join(network_info.get('join', []))
return '\n'.join(network_info.get('perform', []))
return '\n'.join(network_info.get('perform', ()))
def perform_get_data(network_info): return '\n'.join(network_info.get('perform', []))
def show(self, network):
def update(self):
def show(self, network): for child in self.get_children(): self.remove(child) network_info = conf.get('networks', {}).get(network, {})
network_info = conf.get('networks', {}).get(network, {})
network_info = conf.get('networks', {}).get(self.network, {})
def show(self, network): for child in self.get_children(): self.remove(child) network_info = conf.get('networks', {}).get(network, {})
data.set_active(network in conf.get('start_networks', []))
data.set_active(self.network in conf.get('start_networks', []))
def get_text_from_textview(textview): buffer = textview.get_buffer() return buffer.get_text( buffer.get_start_iter(), buffer.get_end_iter() )
lambda w: autoconnect_set_data(w.get_active(), network)
lambda w: autoconnect_set_data(w.get_active(), self.network)
def get_text_from_textview(textview): buffer = textview.get_buffer() return buffer.get_text( buffer.get_start_iter(), buffer.get_end_iter() )
self.set_label(network)
self.set_label(self.network)
def get_text_from_textview(textview): buffer = textview.get_buffer() return buffer.get_text( buffer.get_start_iter(), buffer.get_end_iter() )
old_text = network_list[path_string][0]
def edit_network(self, cell, path_string, new_text): network_list = self.networks.get_model() networks = conf.get('networks') if network_list[path_string][0] in networks: networks[new_text] = networks.pop(network_list[path_string][0]) else: networks[new_text] = {}
if network_list[path_string][0] in networks: networks[new_text] = networks.pop(network_list[path_string][0]) else: networks[new_text] = {}
networks[new_text] = networks.pop(old_text, {}) start_networks = conf.get('start_networks', []) if old_text in start_networks: start_networks[start_networks.index(old_text)] = new_text
def edit_network(self, cell, path_string, new_text): network_list = self.networks.get_model() networks = conf.get('networks') if network_list[path_string][0] in networks: networks[new_text] = networks.pop(network_list[path_string][0]) else: networks[new_text] = {}
self.infobox.show(model.get_value(iter, 0))
self.infobox.network = model.get_value(iter, 0) self.infobox.update()
def on_selection_changed(self, selection): model, iter = selection.get_selected()
identify_files(abs_file, rel_file)
identify_files(abs_file, rel_file, sep)
def identify_files(path=os.curdir, prefix='', sep=os.path.join): #set files to a list of the files we want to install print "Searching for files to install" for filename in os.listdir(path): abs_file = os.path.join(path,filename) rel_file = sep(prefix,filename) if os.path.isfile(abs_file) and filename not in exclude_fi...