rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
nsize = int(varsize(size)) if nsize > max: max = nsize outsize = test[2] if outsize == 'v': outsize = str(max) f.write(' ShAttrib<' + outsize + ', SH_OUTPUT> out;\n') f.write(' out = ' + test[3][0] + ';\n') f.write(' } SH_END;\n') f.write(' ' + prgname + '->name("' + prgname + '");\n') f.write('\n') for case in...
nsize = int(varsize(size)) if nsize > max: max = nsize outsize = test[2] if outsize == 'v': outsize = str(max) f.write(' ShAttrib<' + outsize + ', SH_OUTPUT> out;\n') f.write(' ' + op + ';\n') f.write(' } SH_END;\n') f.write(' ' + prgname + '->name("' + op + ' [' + ' x '.join(combination) + ']");\n') f.write('\...
def varsize(s): if s == 'v': return '3' if s == 's': return '1' return s
def make_variable(arg, binding_type, value_type):
def make_variable(arg, binding_type, value_type, immediate=False):
def make_variable(arg, binding_type, value_type): if is_array(arg) and is_array(arg[0]): nrows = len(arg[0]) ncols = len(arg) return 'ShMatrix<' + str(nrows) + ', ' + str(ncols) + ', ' + binding_type + ', ' + value_type + '>' elif is_array(arg): size = len(arg) return 'ShAttrib<' + str(size) + ', ' + binding_type + ', ...
nrows = len(arg[0]) ncols = len(arg)
ncols = len(arg[0]) nrows = len(arg)
def make_variable(arg, binding_type, value_type): if is_array(arg) and is_array(arg[0]): nrows = len(arg[0]) ncols = len(arg) return 'ShMatrix<' + str(nrows) + ', ' + str(ncols) + ', ' + binding_type + ', ' + value_type + '>' elif is_array(arg): size = len(arg) return 'ShAttrib<' + str(size) + ', ' + binding_type + ', ...
def init_scalar(indent, arg, argtype, varname):
def init_scalar(indent, arg, argtype, varname, immediate):
def init_scalar(indent, arg, argtype, varname): out = indent out += make_variable(arg, 'SH_CONST', argtype) + ' ' + varname out += '(' + argtype + '(' + str(arg) + '));\n' return out
out += make_variable(arg, 'SH_CONST', argtype) + ' ' + varname
out += make_variable(arg, 'SH_CONST', argtype, immediate) + ' ' + varname
def init_scalar(indent, arg, argtype, varname): out = indent out += make_variable(arg, 'SH_CONST', argtype) + ' ' + varname out += '(' + argtype + '(' + str(arg) + '));\n' return out
def init_variable(indent, arg, argtype, varname):
def init_variable(indent, arg, argtype, varname, immediate):
def init_variable(indent, arg, argtype, varname): if is_array(arg) and is_array(arg[0]): return init_matrix(indent, arg, argtype, varname) elif is_array(arg): return init_attrib(indent, arg, argtype, varname) else: return init_scalar(indent, arg, argtype, varname)
return init_scalar(indent, arg, argtype, varname) def init_inputs(indent, src_arg_types):
return init_scalar(indent, arg, argtype, varname, immediate) def init_inputs(indent, src_arg_types, immediate=False):
def init_variable(indent, arg, argtype, varname): if is_array(arg) and is_array(arg[0]): return init_matrix(indent, arg, argtype, varname) elif is_array(arg): return init_attrib(indent, arg, argtype, varname) else: return init_scalar(indent, arg, argtype, varname)
out += init_variable(indent, arg, argtype, varname)
out += init_variable(indent, arg, argtype, varname, immediate)
def init_inputs(indent, src_arg_types): out = '' i = 0 for arg, argtype in src_arg_types: varname = string.ascii_lowercase[i] out += init_variable(indent, arg, argtype, varname) i += 1; return out
def init_expected(indent, arg, argtype):
def init_expected(indent, arg, argtype, immediate=False):
def init_expected(indent, arg, argtype): out = '' varname = 'exp' out += init_variable(indent, arg, argtype, varname) return out
out += init_variable(indent, arg, argtype, varname)
out += init_variable(indent, arg, argtype, varname, immediate)
def init_expected(indent, arg, argtype): out = '' varname = 'exp' out += init_variable(indent, arg, argtype, varname) return out
out.write(init_inputs(' ', src_arg_types)) out.write(init_expected(' ', test[0], types[0]))
out.write(init_inputs(' ', src_arg_types, True)) out.write(init_expected(' ', test[0], types[0], True))
def output(self, out): self.output_header(out) test_nb = 0 for test, testcalls in self.tests: types = test[2] src_arg_types = zip(test[1], types[1:]) for i, call in enumerate(testcalls): testname = make_testname(src_arg_types, types, call.key()) out.write(' { // ' + testname + '\n') out.write(init_inputs(' ', src_a...
out.write(' ' + make_variable(test[0], 'SH_TEMP', types[0]) + ' out;\n')
out.write(' ' + make_variable(test[0], 'SH_TEMP', types[0], True) + ' out;\n')
def output(self, out): self.output_header(out) test_nb = 0 for test, testcalls in self.tests: types = test[2] src_arg_types = zip(test[1], types[1:]) for i, call in enumerate(testcalls): testname = make_testname(src_arg_types, types, call.key()) out.write(' { // ' + testname + '\n') out.write(init_inputs(' ', src_a...
if args[0][0] == "T":
if args[0][0] != "host_type":
def scalarcons(self, args, size, extraTplArg=[]): common.inprint(self.tpl(size)) if len(extraTplArg) > 0: common.inprint("template<" + ", ".join(extraTplArg) + ">") common.inprint("inline") common.inprint(self.tplcls(size) + "::" + self.name + "(" + ', '.join([' '.join(x) for x in args]) + ")") common.inprint(" : ShGe...
val = "ShAttrib<1, SH_CONST, T>(s" + str(i) + ")" common.inprint("(*this)[" + str(i) + "] = " + val + ";")
common.inprint("(*this)[" + str(i) + "] = s" + str(i) + ";")
def scalarcons(self, args, size, extraTplArg=[]): common.inprint(self.tpl(size)) if len(extraTplArg) > 0: common.inprint("template<" + ", ".join(extraTplArg) + ">") common.inprint("inline") common.inprint(self.tplcls(size) + "::" + self.name + "(" + ', '.join([' '.join(x) for x in args]) + ")") common.inprint(" : ShGe...
common.endguard("ATTRIBIMPL_HPP")
common.endguard("SHATTRIBIMPL_HPP")
def constructors(self, size = 0): common.inprint(self.tpl(size)) #common.inprint("inline") common.inprint(self.tplcls(size) + "::" + self.name + "()") common.inprint(" : Generic<" + self.sizevar(size) + ", T>" + "(new VariableNode(Binding, " + self.sizevar(size) + ", StorageTypeInfo<T>::value_type, Semantic))") common...
def atan2_test(p, q, types=[]):
def atan2_test(p, q, types=[], epsilon=0):
def atan2_test(p, q, types=[]): result = [math.atan2(b, a) for (a, b) in common.upzip(p, q)] return shtest.make_test(result, [p, q], types)
return shtest.make_test(result, [p, q], types)
return shtest.make_test(result, [p, q], types, epsilon)
def atan2_test(p, q, types=[]): result = [math.atan2(b, a) for (a, b) in common.upzip(p, q)] return shtest.make_test(result, [p, q], types)
test.add_test(atan2_test((1.0, 1.0, 1.0, 1.0), (0.0, 1.0, 2.0, 3.0))) test.add_test(atan2_test((0.5, 1.5, 3.0, 50.0), (0.0, 1.0, 2.0, 3.0))) test.add_test(atan2_test((1.0, 1.0, 1.0, 1.0), (0.3, 0.5, 0.8, 0.9))) test.add_test(atan2_test((1.0, 1.0, 1.0), (math.pi, -math.pi, 0.0))) test.add_test(atan2_test((math.pi*2.0, ...
test.add_test(atan2_test((1.0, math.pi*2.0, 50, 1.0), (0.3, 1.0, 3.0, -math.pi*2.0), [], 0.015)) test.add_test(atan2_test((1.0, 1.0, 1.0), (0.0, 1.0, 2.0), [], 0.003)) test.add_test(atan2_test((0.5, 1.5, 3.0), (0.0, 1.0, 2.0), [], 0.003)) test.add_test(atan2_test((1.0, 1.0, 1.0), (0.5, 0.8, 0.9), [], 0.002)) test.add_t...
def insert_into5(test): test.add_test(atan2_test((1.0, 1.0, 1.0, 1.0), (0.0, 1.0, 2.0, 3.0))) test.add_test(atan2_test((0.5, 1.5, 3.0, 50.0), (0.0, 1.0, 2.0, 3.0))) test.add_test(atan2_test((1.0, 1.0, 1.0, 1.0), (0.3, 0.5, 0.8, 0.9))) test.add_test(atan2_test((1.0, 1.0, 1.0), (math.pi, -math.pi, 0.0))) #test.add_test(a...
r += " image.load_PNG(\"" + self.filename + "\");\n"
r += " ShUtil::load_PNG(image, \"" + self.filename + "\");\n"
def __str__(self): # @todo type move this into test.hpp or test.cpp r = " " + self.textype + " " + self.name + ";\n"; r += " {\n" r += " ShImage image;\n" r += " image.load_PNG(\"" + self.filename + "\");\n" r += " " + self.name + ".size(image.width(), image.height());\n" r += " " + self.name + "....
if to != "":
if to.startswith(" to = "" else:
def addMessage(self, text, from_, to=""): """Formats a message in a pretty way with the given arguments.
new_topic = " ".join(params[1:])
new_topic = " ".join(params[0:])
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
self.connection.topic(channel=params[0], new_topic=new_topic)
if params[0] in self.channels: new_topic = " ".join(params[1:]) if new_topic: self.connection.topic(channel=param[0], new_topic=" ".join(param[1:])) window.sever_event("%s has changed the topic of %s: %s" % (self.connection.get_nickname(), param[0], " ".join(param[1:]))) else: self.connection.topic(channel=window.get_c...
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
self.connection.topic(channel=params[0])
self.connection.topic(channel=window.get_channelname())
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ALEFT, "Align switch_bar &Left") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ARIGHT, "Align switch_bar &Right") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ATOP, "Align switch_bar &Top") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ABOTTOM, "Align switch_bar &Bottom")
menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ALEFT, "Align Switchbar &Left") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ARIGHT, "Align Switchbar &Right") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ATOP, "Align Switchbar &Top") menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ABOTTOM, "Align Switchbar &Bottom")
def create_menu(self): menu_file = wx.Menu() menu_file.Append(ID_MENU_FILE_ABOUT, "&About", "About %s" % (circe_globals.APPNAME)) menu_file.AppendSeparator() menu_file.Append(ID_MENU_FILE_EXIT, "E&xit", "Exit %s" % (circe_globals.APPNAME)) menu_switchbar = wx.Menu() menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ALEFT, ...
menu_tree.Append(ID_MENU_VIEW_TREE_ALEFT, "Align Tree &Left") menu_tree.Append(ID_MENU_VIEW_TREE_ARIGHT, "Align Tree &Right")
menu_tree.Append(ID_MENU_VIEW_TREE_ALEFT, "Align Treebar &Left") menu_tree.Append(ID_MENU_VIEW_TREE_ARIGHT, "Align Treebar &Right")
def create_menu(self): menu_file = wx.Menu() menu_file.Append(ID_MENU_FILE_ABOUT, "&About", "About %s" % (circe_globals.APPNAME)) menu_file.AppendSeparator() menu_file.Append(ID_MENU_FILE_EXIT, "E&xit", "Exit %s" % (circe_globals.APPNAME)) menu_switchbar = wx.Menu() menu_switchbar.Append(ID_MENU_VIEW_SWITCHBAR_ALEFT, ...
self.connection.topice(channel=params[0], new_topic=new_topic)
self.connection.topic(channel=params[0], new_topic=new_topic)
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
self.connection.whois(targets=params[0])
self.connection.whois(targets=params)
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
len(params) > 1 and params[1] or ""
len(params) > 1 and params[1] or "", len(params) > 2 and params[2] or ""
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
except IndexError:
except ValueError:
def text_command(self,cmdstring,window): if not cmdstring: return # is raising a exception necessary? # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
self.server_event(text)
window.server_event(text)
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
import config
import config_engine config=config_engine.Config()
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
print e
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
self.Bind(wx.EVT_CLOSE, self.evt_window_del)
def bind_events(self): self.panel_switchbar.bind_click(self.evt_switchbar_event) self.panel_windowarea.bind_add(self.evt_windowarea_addwindow) self.panel_windowarea.bind_del(self.evt_windowarea_delwindow) self.panel_windowarea.bind_show(self.evt_windowarea_showwindow) self.panel_windowarea.bind_set_caption(self.evt_win...
except:
except (ValueError, KeyError):
def __getitem__(self, k): try: return self.config.get(self.section, k) except: try: v = DEFAULTS[k] self.__setitem__(k,v) return v except: raise KeyError, k
self.txt_edit.SetValue(user+": ")
self.txt_edit.SetValue("%s%s " % (user, self.complete_suffix))
def autocomplete(self): """Autocompletes the current input""" value = self.txt_edit.GetValue() if not value: # ignore if nothing typed return get_channelname = getattr(self, "get_channelname", None) if not get_channelname: # ignore if cannot get channel name return channel = get_channelname() # get the channel name if...
self.connection.privmsg(target, cmdstring) mynick = self.connection.get_nickname() window.add_message(cmdstring, mynick)
for line in cmdstring.split("\n"): self.connection.privmsg(target, line) mynick = self.connection.get_nickname() window.add_message(line, mynick)
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
window.server_event("%s has joined %s." % (self.connection.get_nickname(), params[0]))
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
if len(params) >= 0: if "," in params[0]:
if len(params) > 0: if params[0].find(",") != -1:
def cmd_names(self,window,server,params): if len(params) >= 0: if "," in params[0]: server.connection.names(params[0].split(",")) else: server.connection.names(params) else: server.connection.names(window.get_channelname())
raise "channel_closed called for unknown channel!"
return
def channel_closed(self, channel): if channel in self.channels: del self.channels[self.channels.index(channel)] else: raise "channel_closed called for unknown channel!"
raise "Empty command"
return
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
cmdlist = cmdstring.split() cmd = cmdlist.pop(0) params = cmdlist
params = cmdstring.split() cmd = params.pop(0)
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
raise TypeError, "You should supply two arguments: servername\ and nick"
raise TypeError, "/server syntax: /server servername [nick]"
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
nick = params[1] if len(params) > 2:
try: nick = params[1] except IndexError: nick = "circe" try:
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
else:
except (IndexError,ValueError):
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
port = int(params[1])
try: port = int(params[1]) except (IndexError,ValueError): port = 6667 try: remote_server = params[2] except IndexError: pass
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
elif cmd == "ctcp": pass
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
nicks = params[0].split(",")
if ',' in params[0]: nicks = params[0].split(',') elif ' ' in params[0]: nicks = params[0].split(' ')
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
channel = params[0] nick = params[1] if len(params) > 2:
try: channel = params[0] except IndexError: channel = window.get_channelname() try: nick = params[1] except IndexError: nick = self.connection.get_nickname() try:
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
else:
except IndexError:
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
if params:
if params[0]:
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
else:
elif ' ' in params[0]:
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
channels = params
channels = params[0]
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
chans = params[0].split(",") self.connection.part(params)
try: params[0] except IndexError: chans = ['%s' % window.get_channelname()] self.connection.part(chans) return if ',' in params[0]: chans = params[0].split(",") elif ' ' in params[0]: chans = params[0].split(' ') else: chans = [params[0]] self.connection.part(chans)
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
nicks = params[0].split(",")
if params: if ',' in params[0]: nicks = params[0].split(",") elif ' ' in params[0]: nicks = params[0].split(" ")
def text_command(self,cmdstring,window): if not cmdstring: raise "Empty command"
if e.source() and e.source().startswith("NickServ"): text = "NickServ: " + e.arguments()[0] self.statuswindow.server_event(text) elif e.source() and e.source().startswith("MemoServ"): text = "MemoServ: " + e.arguments()[0] self.statuswindow.server_event(text) elif e.source() and e.source().startswith("ChanServ"): text ...
source = e.source() prefixes = ["Nick", "Memo", "Chan"] for prefix in prefixes: if source and source.startswith("%sServ" % prefix): text = "%sServ: %s" % (prefix, e.arguments()[0]) self.statuswindow.server_event(text)
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
text = "[%s] %s" % (etype, args) window.server_event(text)
if etype == "topic": text = "Topic for %s is: %s" % (chan, args) else: text = "[%s] %s" % (etype, args) if etype == "topic": topic.append(text) else: window.server_event(text)
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
text = "[%s] %s on %s" % (etype, sender, date) window.server_event(text)
text = "Topic for %s set by %s on %s" % (e.arguments()[0], sender, date) topic.append(text) window.server_event("\n".join(topic)) topic = []
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
def nick(self, nick, user="circe", host="circe"): IC.send("USER %s %s %s %s\r\n" % (nick, user,host,user)) IC.send("NICK %s %s\r\n" % (nick, user))
def nick(self, nick, host="circe"): IC.send("USER ident * * :%s\r\n" % (host)) IC.send("NICK %s\r\n" % (nick))
def nick(self, nick, user="circe", host="circe"): IC.send("USER %s %s %s %s\r\n" % (nick, user,host,user)) IC.send("NICK %s %s\r\n" % (nick, user))
self.command_buffer = [] self.current_area_up = 0 self.current_area_down = 0 self.tmp_buffer = ""
def __init__(self, windowarea, server, channelname): WindowServer.__init__(self, windowarea, server, channelname)
window.server_event("%s has changed the topic of %s to: %s" % (e.source(), e.target(), args))
window.server_event("%s has changed the topic of %s to: %s" % (e.source().split("!")[0], e.target(), args[0]))
def check_events(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.get_events():
self.NewChannelWindow(*params)
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
for chan in chans: window = self.getChannelWindowRef(chan) if window: self.RemoveChannelWindow(chan)
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
window = self.getChannelWindowRef(e.target()) if window: text = "%s has left %s" % (e.source(), e.target())
chan = e.target() src = e.source() window = self.getChannelWindowRef(chan) if irclib.nm_to_n(src) == self.connection.get_nickname(): if window: self.RemoveChannelWindow(chan) return if window: text = "%s has left %s" % (src, chan)
def checkEvents(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.getEvents():
window.delUsers([e.source().split("!")[0]])
window.delUsers([src.split("!")[0]])
def checkEvents(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.getEvents():
del self._users[u]
del self._users[self._users.index(u)]
def del_user(self, users): """Delete some users from the users list.
class CheckVersion(wx.MessageDialog):
class CheckVersion:
def OnClick(self, *a): self.Destroy()
elif ' ' in params[0]: nicks = params[0].split(' ') else: nicks = params[0]
else: nicks = params
def text_command(self,cmdstring,window): if not cmdstring: return # is raising a exception necessary? # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
self.connection.privmsg(target, line) mynick = self.connection.get_nickname() window.add_message(line, mynick)
if line.strip().strip("\n"): self.connection.privmsg(target, line) mynick = self.connection.get_nickname() window.add_message(line, mynick)
def text_command(self,cmdstring,window): if not cmdstring: return # in a debug window, do nothing if hasattr(window, "get_channelname") and \ window.get_channelname() == "debug": return
self.txt_edit.SetValue(user)
self.txt_edit.SetValue(user+": ") self.txt_edit.SetInsertionPointEnd()
def txt_edit_evt_char(self, event): """Called when the user enter some text in the entry widget.""" key = event.GetKeyCode() if key == 13: # enter # Enter pressed value = self.txt_edit.GetValue() if not value: # ignore event if nothing typed event.Skip() return self.txt_edit.SetValue("") self.server.text_command(value,...
if e.source().split("!")[0] == self.connection.get_nickname():
src = e.source() if irclib.nm_to_n(src) == self.connection.get_nickname():
def checkEvents(self): """Redirects all received events to the correct windows.""" # Print events and display them in the rigth windows. for e in self.getEvents():
elif cmd == "msg": target = window.getChannelname() text = params[0]
elif cmd in ("msg","privmsg"): if len(params) == 0: raise "MSGError", "You must supply the target and the message" target = params[0] if len(params) == 2: text = params[1] else: text = " " .join(params[1:]) print target, text
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
if target == window.getChannelname(): target = "" window.addMessage(text, self.connection.get_nickname(), to=target) elif cmd == "privmsg": if len(params) < 2: raise "PRIVMSGError", "You must supply two arguments" target = params[0] text = params[1] self.connection.privmsg(target, text) if target == window.getChanneln...
if hasattr(window, "getChannelname"): window.addMessage(text, self.connection.get_nickname(),target) else: window.ServerEvent("[%s(%s)] %s" % ("msg", target, text))
def TextCommand(self,cmdstring,window): if not cmdstring: raise "Empty command"
"""Deletes some users from the users list.
"""Delete some users from the users list.
def del_user(self, users): """Deletes some users from the users list.
self._users()
self.users()
def del_user(self, users): """Deletes some users from the users list.
"""Formats a message in a pretty way with the given arguments.
"""Format a message in a pretty way with the given arguments.
def add_message(self, text, from_, to=""): """Formats a message in a pretty way with the given arguments.
for chan in self.server.channels: print "Closing channel: %s" % chan._channelname
for chan in channellist:
def evt_disconnect(self): self.disableChecking() # Close all channels for chan in self.server.channels: print "Closing channel: %s" % chan._channelname chan.CloseWindow()
self.other_text = "%s Version: %s\nWxPython Version: %s\npython-irclib Version: %s\n" % (circe_globals.APPNAME, circe_globals.VERSION, python_version, irclib_version[:5])
self.other_text = "%s Version: %s\nPython Version: %s\nWxPython Version: %s\npython-irclib Version: %s\n" % (circe_globals.APPNAME, \ circe_globals.VERSION, \ python_version, wx.VERSION_STRING, irclib_version[:5])
def __init__(self,event): windowname = "About "+circe_globals.APPNAME+" "+circe_globals.VERSION wx.Dialog.__init__(self, None, -1, windowname, style=wx.DEFAULT_DIALOG_STYLE)
def __init__(self,**kwargs): circelib.Server(**kwargs[0],**kwargs[1])
def __init__(self,*options): Server.__init__(self,*options)
def __init__(self,**kwargs): circelib.Server(**kwargs[0],**kwargs[1]) self.statuswindow = None self.channels = None
def AddServer(**options): s = WXServer(**options[0],**options[1])
def AddServer(*options): s = WXServer(*options)
def AddServer(**options): s = WXServer(**options[0],**options[1]) servers.append(s) return s
return users.sort()
users.sort(lambda x, y: cmp(string.lower(x), string.lower(y))) self._users = users
def sort(self): users = list(self._users) return users.sort()
print self._users for u in self._users.keys():
for u in self._users:
def users(self, users=None): """Update the uers list and eventually add the given users.""" if not users: users = []
for u in self._users.keys():
for u in self._users:
def del_user(self, users): """Delete some users from the users list.
try: if not self.in_use: raise IndexError args[0] except IndexError:
if self.in_use: return super(AskNicknameDialog, self).__init__(None, "Nickname (%s) is in use. Please select a different one:" % args[0]) else:
def __init__(self, *args, **kwargs): self.in_use = kwargs.get("in_use") self.times = 2 try: if not self.in_use: raise IndexError args[0] except IndexError: return super(AskNicknameDialog, self).__init__(None, "Please select a nickname:") self.nickname = args[0] super(AskNicknameDialog, self).__init__(None, "Nickname (%...
self.nickname = args[0] super(AskNicknameDialog, self).__init__(None, "Nickname (%s) is in use. Please select a different one:" % args[0])
def __init__(self, *args, **kwargs): self.in_use = kwargs.get("in_use") self.times = 2 try: if not self.in_use: raise IndexError args[0] except IndexError: return super(AskNicknameDialog, self).__init__(None, "Please select a nickname:") self.nickname = args[0] super(AskNicknameDialog, self).__init__(None, "Nickname (%...
self.server_event("%s has quit: %s" % (user, " ".join(event.arguments())))
msg = event.arguments() self.server_event("%s has quit (%s)" % (user, msg))
def user_quit(self, event): """Remove a users from the list and informs that the user has quit."""
self.txt_edit = wx.TextCtrl(self,ID_TXT_EDIT,"",wx.DefaultPosition,wx.DefaultSize)
self.txt_edit = wx.TextCtrl(self,ID_TXT_EDIT,"",wx.DefaultPosition,wx.DefaultSize,wx.TE_PROCESS_TAB)
def __init__(self, windowarea, server, channelname): WindowServer.__init__(self, windowarea, server, channelname)
if key == 13:
if key == wx.WXK_RETURN or key == wx.WXK_NUMPAD_ENTER:
def txt_edit_evt_char(self, event): """Called when the user enter some text in the entry widget.""" key = event.GetKeyCode() if key == 13: # enter # Enter pressed value = self.txt_edit.GetValue() if not value: # ignore event if nothing typed event.Skip() return self.command_buffer.append(value) self.txt_edit.SetValue("...
event.Skip()
def txt_edit_evt_char(self, event): """Called when the user enter some text in the entry widget.""" key = event.GetKeyCode() if key == 13: # enter # Enter pressed value = self.txt_edit.GetValue() if not value: # ignore event if nothing typed event.Skip() return self.command_buffer.append(value) self.txt_edit.SetValue("...
elif key == 9:
elif key == wx.WXK_TAB:
def txt_edit_evt_char(self, event): """Called when the user enter some text in the entry widget.""" key = event.GetKeyCode() if key == 13: # enter # Enter pressed value = self.txt_edit.GetValue() if not value: # ignore event if nothing typed event.Skip() return self.command_buffer.append(value) self.txt_edit.SetValue("...
else: if len(users) > 0: event.Skip() return else:
else:
def txt_edit_evt_char(self, event): """Called when the user enter some text in the entry widget.""" key = event.GetKeyCode() if key == 13: # enter # Enter pressed value = self.txt_edit.GetValue() if not value: # ignore event if nothing typed event.Skip() return self.command_buffer.append(value) self.txt_edit.SetValue("...
wx.Dialog.__init__(self, None, -1, windowname, style=wx.DEFAULT_DIALOG_STYLE)
wx.Dialog.__init__(self, None, -1, windowname, style=wx.DEFAULT_DIALOG_STYLE, size=(370,205))
def __init__(self,event): windowname = "About "+circe_globals.APPNAME+" "+circe_globals.VERSION wx.Dialog.__init__(self, None, -1, windowname, style=wx.DEFAULT_DIALOG_STYLE)
self._users = {}
self._users = []
def __init__(self,windowarea,server,channelname): WindowTextEdit.__init__(self, windowarea, server, channelname) self.windowarea = windowarea self.channelname = channelname self._users = {} # Store info about users self.create_controls() self.create_sizers() self.add_controls()
for u in users: if u not in self._users.keys(): self._users[u] = ""
for user in users: self._users.append(user)
def users(self, users=None): """Update the uers list and eventually add the given users.""" if not users: users = []
if user in self._users.keys():
if user in self._users:
def user_quit(self, event): """Remove a users from the list and informs that the user has quit."""
return
return 0
def GetCurrentVersion(self): try: curver = self.curver except AttributeError: import urllib2 a = urllib2.urlopen("http://circe.berlios.de/version.php") curver2 = a.read() curver = curver2.split(".") self.curver = curver runver = circe_globals.VERSION.split(".")
if os.getenv("APPDATA") != "":
if type(os.getenv("APPDATA")) == "NoneType":
def main(): # Some globals and variables global config global homedir config = {} options = [ "--config", "--configdump", "--daemon", "--debug", "--verbose", "--version" ] shortoptions = { "c":"--config", "d":"--debug", "D":"--daemon", "v":"--verbose", "V":"--version" } overwrite = [ "--daemon", "--debug", "--verbose...
print "!!! Error: -"+y+" is an invalid option."
print "!!! Error: -"+y+" is an invalid shortoption."
def main(): # Some globals and variables global config global homedir config = {} options = [ "--config", "--configdump", "--debug", "--daemon", "--verbose", "--version" ] shortoptions = { "c":"--config", "d":"--debug", "D":"--daemon", "v":"--verbose", "V":"--version" } overwrite = [ "--daemon", "--debug", "--verbose...
if len(x) >= 2 and x[0:2] != "--":
if len(x) >= 2 and x[0:2] == "--": if x in options: opts.append(x) else: print "!!! Error "+x+" is an invalid option." sys.exit(1) else:
def main(): # Some globals and variables global config global homedir config = {} options = [ "--config", "--configdump", "--debug", "--daemon", "--verbose", "--version" ] shortoptions = { "c":"--config", "d":"--debug", "D":"--daemon", "v":"--verbose", "V":"--version" } overwrite = [ "--daemon", "--debug", "--verbose...
elif len(x) >= 2 and x[0:2] == "--": opts.append(x) elif x not in options: print "!!! Error: "+x+" is an invalid option." sys.exit(1) if "--daemon" in opts and "--nodaemon" in opts: print "!!! Error: You can not use --daemon and --nodaemon at the same time" sys.exit(1)
def main(): # Some globals and variables global config global homedir config = {} options = [ "--config", "--configdump", "--debug", "--daemon", "--verbose", "--version" ] shortoptions = { "c":"--config", "d":"--debug", "D":"--daemon", "v":"--verbose", "V":"--version" } overwrite = [ "--daemon", "--debug", "--verbose...
if opts[opts.index("--config")+1][0:2] == "--": print "!!! Error: You specified --config but no file was appended!"
if len(opts) == 1: print "!!! Error: You want to use --config, but no file was appended!" sys.exit(1) elif opts[opts.index("--config")+1][0:2] == "--" or len(opts) <= 1: print "!!! Error: You want to use --config, but no file was appended!"
def main(): # Some globals and variables global config global homedir config = {} options = [ "--config", "--configdump", "--debug", "--daemon", "--verbose", "--version" ] shortoptions = { "c":"--config", "d":"--debug", "D":"--daemon", "v":"--verbose", "V":"--version" } overwrite = [ "--daemon", "--debug", "--verbose...