rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
FILE.write(repr(self.d.upTotal)+"\n") FILE.write(repr(self.d.downTotal)+"\n") | FILE.write(repr(self.upTotal)+"\n") FILE.write(repr(self.downTotal)+"\n") | def shutdown(): print "shutdown." self.d.display({'activity':_("shutting down"), 'fractionDone':0}) if self.multitorrent: df = self.multitorrent.shutdown() stop_rawserver = lambda *a : rawserver.stop() df.addCallbacks(stop_rawserver, stop_rawserver) else: rawserver.stop() |
""" return int(n) | def fmtsize(n): s = str(n) size = s[-3:] while len(s) > 3: s = s[:-3] size = '%s,%s' % (s[-3:], size) size = '%s (%s)' % (size, str(Size(n))) return size | |
self.downRate = '---' | self.downRate = '0.0 kB/s' | def finished(self): self.done = True # self.downRate = '---' # self.downRate = '0.0 kB/s' self.downRate = '---' self.display({'activity':_("download succeeded"), 'fractionDone':1}) |
if not self.errors: print _("Log: none") else: print _("Log:") for err in self.errors[-4:]: print err print print _("saving: "), self.file print _("file size: "), self.fileSize print _("percent done: "), self.percentDone print _("time left: "), self.timeEst print _("download to: "), self.downloadTo pr... | def display(self, statistics): fractionDone = statistics.get('fractionDone') activity = statistics.get('activity') timeEst = statistics.get('timeEst') downRate = statistics.get('downRate') upRate = statistics.get('upRate') spew = statistics.get('spew') | |
FILE.write(repr(self.fileSize)) | FILE.write(repr(self.fileSize_stat)) | def display(self, statistics): fractionDone = statistics.get('fractionDone') activity = statistics.get('activity') timeEst = statistics.get('timeEst') downRate = statistics.get('downRate') upRate = statistics.get('upRate') spew = statistics.get('spew') |
FILE.write(repr(self.d.fileSize)) | FILE.write(repr(self.d.fileSize_stat)) | def shutdown(): print "shutdown." self.d.display({'activity':_("shutting down"), 'fractionDone':0}) if self.multitorrent: df = self.multitorrent.shutdown() stop_rawserver = lambda *a : rawserver.stop() df.addCallbacks(stop_rawserver, stop_rawserver) else: rawserver.stop() |
for x in arange(100)/5. - 10.: | for x in Numeric.arange(100)/5. - 10.: | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
x = arange(100)/5. - 10. | x = Numeric.arange(100)/5. - 10. | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
x = arange(35)/2.0 y = arange(30)/10.0 - 1.5 | x = Numeric.arange(35)/2.0 y = Numeric.arange(30)/10.0 - 1.5 | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
m = (sin(xm) + 0.1*xm) - ym**2 | m = (Numeric.sin(xm) + 0.1*xm) - ym**2 | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
g.splot(gp.GridFunc(lambda x,y: sin(x) + 0.1*x - y**2, x,y)) | g.splot(gp.GridFunc(lambda x,y: math.sin(x) + 0.1*x - y**2, x,y)) | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
g.splot(gp.GridFunc(lambda x,y: sin(x) + 0.1*x - y**2, x,y, | g.splot(gp.GridFunc(lambda x,y: Numeric.sin(x) + 0.1*x - y**2, x,y, | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = gp.Gnuplot() g.clear() # Make a temporary file: file1 = gp.TempFile() # will be deleted upon exit f = open(file1.filename, 'w') for x in arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x... |
g = Gnuplot.Gnuplot() | g = Gnuplot.Gnuplot(debug=1) | def main(): """Exercise the Gnuplot module.""" wait('Popping up a blank gnuplot window on your screen.') g = Gnuplot.Gnuplot() g.clear() # Make a temporary file: filename1 = tempfile.mktemp() f = open(filename1, 'w') for x in Numeric.arange(100)/5. - 10.: f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x))) f.close(... |
class file(plotitem): """a plotitem representing a file that contains gnuplot data.""" _option_list = plotitem._option_list.copy() | class File(PlotItem): """A PlotItem representing a file that contains gnuplot data.""" _option_list = PlotItem._option_list.copy() | def __del__(self): """Delete the referenced file.""" |
'smooth', smooth, none, 'smooth %s'), | 'smooth', smooth, None, 'smooth %s'), | def __del__(self): """Delete the referenced file.""" |
"""construct a file object. | """Construct a File object. | def __init__(self, file, **keyw): """construct a file object. |
class OptionException(Exception): pass | class OptionException(Exception): pass class DataException(Exception): pass | def test_persist(): global _recognizes_persist if _recognizes_persist is None: g = os.popen('echo | gnuplot -persist 2>&1', 'r') response = g.readlines() g.close() _recognizes_persist = ((not response) or (string.find(response[0], '-persist') == -1)) return _recognizes_persist |
if item.shape[1] == 1: newitems.append(Data(item, with='lines')) | dim = len(item.shape) if dim == 1: newitems.append(Data(item[:, Numeric.NewAxis], with='lines')) elif dim == 2: if item.shape[1] == 1: newitems.append(Data(item, with='lines')) else: tempf = TempArrayFile(item) for col in range(1, item.shape[1]): newitems.append(File(tempf, using=(1,col+1), with='lines')) | def plot(*items, **kw): """plot data using gnuplot. This command is roughly compatible with old Gnuplot plot command. It is provided for backwards compatibility only. It is recommended that you use the new object-oriented Gnuplot interface, which is much more flexible. It can only plot Numeric array data. In this r... |
tempf = TempArrayFile(item) for col in range(1, item.shape[1]): newitems.append(File(tempf, using=(1,col+1), with='lines')) | raise DataException("Data array must be 1 or 2 dimensional") | def plot(*items, **kw): """plot data using gnuplot. This command is roughly compatible with old Gnuplot plot command. It is provided for backwards compatibility only. It is recommended that you use the new object-oriented Gnuplot interface, which is much more flexible. It can only plot Numeric array data. In this r... |
print "\n Generating postscript file 'junk.ps'\n" g2.hardcopy('junk.ps', color=1) | print "\n Generating postscript file 'gnuplot_test1.ps'\n" g2.hardcopy('gnuplot_test1.ps', color=1) | def plot(*items, **kw): """plot data using gnuplot. This command is roughly compatible with old Gnuplot plot command. It is provided for backwards compatibility only. It is recommended that you use the new object-oriented Gnuplot interface, which is much more flexible. It can only plot Numeric array data. In this r... |
print setterm | def hardcopy(self, filename=None, terminal='postscript', **keyw): """Create a hardcopy of the current plot. | |
def set_option(self, with=_unset, title=_unset, **keyw): | def set_option(self, with=_unset, smooth=_unset, title=_unset, **keyw): | def set_option(self, with=_unset, title=_unset, **keyw): """Set or change a plot option for this PlotItem. |
_option_sequence = ['binary', 'using', 'title', 'with'] | _option_sequence = ['binary', 'using', 'smooth', 'title', 'with'] | def clear_option(self, name): """Clear (unset) a plot option. No error if option was not set.""" |
set = Numeric.asarray(set, Numeric.Float) | set = Numeric.asarray(set[0], Numeric.Float) | def __init__(self, *set, **keyw): """Construct a Data object from a numeric array. |
def grid_function(f, xvals, yvals, typecode=Numeric.Float32): | def grid_function(f, xvals, yvals, typecode=None, ufunc=0): | def grid_function(f, xvals, yvals, typecode=Numeric.Float32): """Evaluate and tabulate a function on a grid. 'xvals' and 'yvals' should be 1-D arrays listing the values of x and y at which 'f' should be tabulated. 'f' should be a function taking two floating point arguments. The return value is a matrix M where 'M[i... |
Note that 'f' is evaluated at each pair of points using a Python loop, which can be slow if the number of points is large. If speed is an issue, you should if possible compute functions matrix-wise using Numeric's built-in ufuncs. | If 'ufunc=0', then 'f' is evaluated at each pair of points using a Python loop. This can be slow if the number of points is large. If speed is an issue, you should write 'f' in terms of Numeric ufuncs and use the 'ufunc=1' feature described next. If called with 'ufunc=1', then 'f' should be a function that is compose... | def grid_function(f, xvals, yvals, typecode=Numeric.Float32): """Evaluate and tabulate a function on a grid. 'xvals' and 'yvals' should be 1-D arrays listing the values of x and y at which 'f' should be tabulated. 'f' should be a function taking two floating point arguments. The return value is a matrix M where 'M[i... |
m = Numeric.zeros((len(xvals), len(yvals)), typecode) for xi in range(len(xvals)): x = xvals[xi] for yi in range(len(yvals)): y = yvals[yi] m[xi,yi] = f(x,y) return m | xvals = Numeric.asarray(xvals, typecode) yvals = Numeric.asarray(yvals, typecode) if ufunc: return f(xvals[:,Numeric.NewAxis], yvals[Numeric.NewAxis,:]) else: m = Numeric.zeros((len(xvals), len(yvals)), xvals.typecode()) for xi in range(len(xvals)): x = xvals[xi] for yi in range(len(yvals)): y = yvals[yi] m[xi,yi] = ... | def grid_function(f, xvals, yvals, typecode=Numeric.Float32): """Evaluate and tabulate a function on a grid. 'xvals' and 'yvals' should be 1-D arrays listing the values of x and y at which 'f' should be tabulated. 'f' should be a function taking two floating point arguments. The return value is a matrix M where 'M[i... |
If 'binary=1' is passed to the constructor, the data will be passed to gnuplot in binary format and the 'binary' option added to the splot command line. Binary format is faster and usually saves disk space but is not human-readable. If your version of gnuplot doesn't support binary format (it is a recently-added feat... | def pipein(self, f): if self._data: f.write(self._data) | |
def __init__(self, toplot, xvals=None, yvals=None, | def __init__(self, data, xvals=None, yvals=None, | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
'toplot' -- the thing to plot: a 2-d array with dimensions (numx,numy), OR a callable object for which toplot(x,y) returns a number. | 'data' -- the data to plot: a 2-d array with dimensions (numx,numy). | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
'toplot' can be a data array, in which case it should hold the values of a function f(x,y) tabulated on a grid of points, such that 'toplot[i,j] == f(xvals[i], yvals[j])'. If 'xvals' and/or 'yvals' are omitted, integers (starting with 0) are used for that coordinate. The data are written to a temporary file; no copy ... | 'data' must be a data array holding the values of a function f(x,y) tabulated on a grid of points, such that 'data[i,j] == f(xvals[i], yvals[j])'. If 'xvals' and/or 'yvals' are omitted, integers (starting with 0) are used for that coordinate. The data are written to a temporary file; no copy of the data is kept in me... | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
f(x,y)' triplets that can be used by gnuplot's 'splot' command. If 'binary=1' then the data are written to a file in a binary format that 'splot' can understand. | f(x,y)' triplets (y changes most rapidly) that can be used by gnuplot's 'splot' command. Blank lines are included each time the value of x changes so that gnuplot knows to plot a surface through the data. If 'binary=1' then the data are written to a file in a binary format that 'splot' can understand. Binary format ... | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
try: data = float_array(toplot) except TypeError: | data = float_array(data) assert len(data.shape) == 2 (numx, numy) = data.shape if xvals is None: xvals = Numeric.arange(numx) else: | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
(numx,) = xvals.shape | assert xvals.shape == (numx,) if yvals is None: yvals = Numeric.arange(numy) else: | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
(numy,) = yvals.shape try: data = toplot(xvals,yvals) except: data = grid_function(toplot, xvals, yvals) else: assert len(data.shape) == 2 (numx, numy) = data.shape if xvals is None: xvals = Numeric.arange(numx) else: xvals = float_array(xvals) assert xvals.shape == (numx,) if yvals is None: yvals = Numeric.ara... | assert yvals.shape == (numy,) | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
inline = not binary and _prefer_inline_data | inline = (not binary) and _prefer_inline_data | def __init__(self, toplot, xvals=None, yvals=None, binary=1, inline=_unset, **keyw): """GridData constructor. |
raw_input('Please press return to continue...\n') def f(x,y): import math print x,y return math.exp(- 0.01 * (x**2 + y**2)) g.splot(GridFunc(f, x,y, binary=0)) | def demo(): """Demonstrate the package.""" from Numeric import * # A straightforward use of gnuplot. The `debug=1' switch is used # in these examples so that the commands that are sent to gnuplot # are also output on stderr. g = Gnuplot(debug=1) g.title('A simple example') # (optional) g('set data style linespoints'... | |
m = Numeric.zeros((len(xvals), len(yvals)), xvals.typecode()) | if typecode is None: typecode = (Numeric.zeros((1,), xvals.typecode()) + Numeric.zeros((1,), yvals.typecode())).typecode() m = Numeric.zeros((len(xvals), len(yvals)), typecode) | def grid_function(f, xvals, yvals, typecode=None, ufunc=0): """Evaluate and tabulate a function on a grid. 'xvals' and 'yvals' should be 1-D arrays listing the values of x and y at which 'f' should be tabulated. 'f' should be a function taking two floating point arguments. The return value is a matrix M where 'M[i,j... |
super( D20Damage, self ).__init__( 'Damage', 0, self.range.roll ) | super( D20Damage, self ).__init__( 'Damage', 0, self.__int__ ) | def __init__( self, types, size=0, roll="1d8", range=None ): self.range = range or D20DamageRange( size, roll ) self.types = types super( D20Damage, self ).__init__( 'Damage', 0, self.range.roll ) self.mod.static = True |
bob = D20Character( "Bob", race, { 'STR': 13, 'DEX':15, 'CON':12, 'INT':10, 'WIS':8, 'CHA':18, 'HEIGHT':72, 'WEIGHT':221, 'WIDTH':24, 'DEPTH':12 } ) | bob = D20Character( "Bob", race, { 'STR': 150, 'DEX':15, 'CON':12, 'INT':10, 'WIS':8, 'CHA':18, 'HEIGHT':72, 'WEIGHT':221, 'WIDTH':24, 'DEPTH':12 } ) | def getLevel( self ): charlevelnum = 1 try: for level in self.levels[ 'RACE' ].values( ): if level.enabled: charlevelnum += 1 except KeyError: pass return charlevelnum |
dmg = att.resolve( 18 ) | dmg = att.resolve( 19, 1 ) """ | def getLevel( self ): charlevelnum = 1 try: for level in self.levels[ 'RACE' ].values( ): if level.enabled: charlevelnum += 1 except KeyError: pass return charlevelnum |
self.canvas.set_size_request(self.bg.get_width(), self.bg.get_height()) | def __init__(self, deferred, netclient, fps): self.fps = fps self.deferred = deferred self.netclient = netclient | |
self.canvas.root().add("GnomeCanvasPixbuf", pixbuf=self.bg, ) | self.tiles = [] | def __init__(self, deferred, netclient, fps): self.fps = fps self.deferred = deferred self.netclient = netclient |
self.canvas.connect('size-allocate', self.on_canvas_expose_event) | def __init__(self, deferred, netclient, fps): self.fps = fps self.deferred = deferred self.netclient = netclient | |
def paintDefault(self): | def on_canvas_expose_event(self, w, ev): | def paintDefault(self): """Draw the default background""" tile_w = self.bg.get_width() tile_h = self.bg.get_height() # tile the texture root = self.canvas.root() if self.model is None: # root.add("GnomeCanvasPixbuf", x=0, y=0, # pixbuf=self.bg) #root.add("GnomeCanvasPixbuf", x=-129, y=0, # pixbuf=... |
tile_w = self.bg.get_width() tile_h = self.bg.get_height() | def paintDefault(self): """Draw the default background""" tile_w = self.bg.get_width() tile_h = self.bg.get_height() # tile the texture root = self.canvas.root() if self.model is None: # root.add("GnomeCanvasPixbuf", x=0, y=0, # pixbuf=self.bg) #root.add("GnomeCanvasPixbuf", x=-129, y=0, # pixbuf=... | |
root.add("GnomeCanvasRect", x1=0, x2=384, y1=0, y2=384, fill_color="blue", outline_color="black") root.add("GnomeCanvasText", x=0, y=0, text="0,0") root.add("GnomeCanvasText", x=300, y=300, text="300,300") root.add("GnomeCanvasText", x=0, y=300, text="0,300") root.add("GnomeCanvasText", x=300, y=0, text="300,0") return | tile_w = self.bg.get_width() tile_h = self.bg.get_height() view_w = self.gw_scrolledwindow1.get_hadjustment().page_size view_h = self.gw_scrolledwindow1.get_vadjustment().page_size num_x = (view_w / tile_w) + 1 num_y = (view_h / tile_h) + 1 [w.destroy() for w in self.tiles] self.tiles = [] | def paintDefault(self): """Draw the default background""" tile_w = self.bg.get_width() tile_h = self.bg.get_height() # tile the texture root = self.canvas.root() if self.model is None: # root.add("GnomeCanvasPixbuf", x=0, y=0, # pixbuf=self.bg) #root.add("GnomeCanvasPixbuf", x=-129, y=0, # pixbuf=... |
root.add("GnomeCanvasPixbuf", | w = root.add("GnomeCanvasPixbuf", | def paintDefault(self): """Draw the default background""" tile_w = self.bg.get_width() tile_h = self.bg.get_height() # tile the texture root = self.canvas.root() if self.model is None: # root.add("GnomeCanvasPixbuf", x=0, y=0, # pixbuf=self.bg) #root.add("GnomeCanvasPixbuf", x=-129, y=0, # pixbuf=... |
FIXME | if self.tiles: [w.destroy() for w in self.tiles] self.tiles = [] | def paintDefault(self): """Draw the default background""" tile_w = self.bg.get_width() tile_h = self.bg.get_height() # tile the texture root = self.canvas.root() if self.model is None: # root.add("GnomeCanvasPixbuf", x=0, y=0, # pixbuf=self.bg) #root.add("GnomeCanvasPixbuf", x=-129, y=0, # pixbuf=... |
self.model = Model(pygame.image.load(fs.downloads(mapinfo['name']))) self.main.blit(self.model.background, (0,0)) | background = gdk.pixbuf_new_from_file(fs.downloads(mapinfo['name'])) self.model = Model(background) root = self.canvas.root() root.add("GnomeCanvasPixbuf", pixbuf=background) self.canvas.set_size_request(background.get_width(), background.get_height() ) | def displayModel(self): mapinfo = self._getMapInfo() log.msg('displaying map %s' % (mapinfo['name'],)) self.model = Model(pygame.image.load(fs.downloads(mapinfo['name']))) self.main.blit(self.model.background, (0,0)) for n, character in enumerate(self._getCharacterInfo()): icon_image = pygame.image.load(fs.downloads(ch... |
icon_image = pygame.image.load(fs.downloads(character['name'])) | icon_image = gdk.pixbuf_new_from_file( fs.downloads(character['name']) ) | def displayModel(self): mapinfo = self._getMapInfo() log.msg('displaying map %s' % (mapinfo['name'],)) self.model = Model(pygame.image.load(fs.downloads(mapinfo['name']))) self.main.blit(self.model.background, (0,0)) for n, character in enumerate(self._getCharacterInfo()): icon_image = pygame.image.load(fs.downloads(ch... |
self.main.blit(icon.image, icon.xy) | self.canvas.root().add("GnomeCanvasPixbuf", pixbuf=icon.image, x=icon.xy[0], y=icon.xy[1], ) | def displayModel(self): mapinfo = self._getMapInfo() log.msg('displaying map %s' % (mapinfo['name'],)) self.model = Model(pygame.image.load(fs.downloads(mapinfo['name']))) self.main.blit(self.model.background, (0,0)) for n, character in enumerate(self._getCharacterInfo()): icon_image = pygame.image.load(fs.downloads(ch... |
args=args[len(groups[0])-1:].lstrip() groups=groups[0].split(',') groups=[conv.group.account.getGroup(group.lstrip(' | args = args[len(groups[0])-1:].lstrip() acct = conv.group.account groups = groups[0].split(',') groups = [acct.getGroup(group.lstrip(' | def irccmd_join(self, args, conv): groups=args.split() |
tabs = IChatConversations(widget) self.webPrint = lambda m: tabs.printClean(m, self.person.name) | def __init__(self, widget, *a, **kw): components.Componentized.__init__(self) basechat.Conversation.__init__(self, *a, **kw) self.widget = widget tabs = IChatConversations(widget) self.webPrint = lambda m: tabs.printClean(m, self.person.name) | |
return self.webPrint(t) | return ITextArea(self).printClean(t) | def showMessage(self, text, metadata=None): if metadata and metadata.get("style", None) == "emote": t = '* %s %s' % (self.person.name, text) else: t = "<%s> %s" % (self.person.name, text) return self.webPrint(t) |
return self.webPrint(event) | return ITextArea(self).printClean(event) | def contactChangedNick(self, person, newnick): basechat.Conversation.contactChangedNick(self, person, newnick) event = "-!- %s is now known as %s" % (person.name, newnick) return self.webPrint(event) |
self.webPrint(out) | ITextArea(self).printClean(out) | def sendText(self, text, metadata=None): r = self.person.sendMessage(text, metadata) me = self.person.account.client.name if metadata and metadata.get('style', None) == 'emote': out = u'* %s %s' % (me, text) else: out = u'<%s> %s' % (me, text) self.webPrint(out) |
scale100px = A.point4decimal("Distance in meters of 100 map px @ 100% zoom") | scale100px = A.point4decimal() | def installOn(self, other): other.powerUp(self, IArticle) |
('MFen', 'VellumTalk', 'MFen', '{100x2}', r'MFen, you rolled: 100x2 = {100, 100} \(sorted\)'), | def clientConnectionFailed(self, connector, reason): print "connection failed:", reason reactor.stop() | |
acct = VellumIRCAccount("IRC", 1, username, password, host, | acct = ircsupport.IRCAccount("IRC", 1, username, password, host, | def doConnection(self, host, username, password, channels): if username in ACCOUNTS and ACCOUNTS[username].isOnline(): self.disconnect(ACCOUNTS[username]) |
self.webPrint = lambda m: widget.printClean(self.group.name, m) | self.webPrint = lambda m: widget.printClean(' | def __init__(self, widget, *a, **kw): basechat.GroupConversation.__init__(self, *a, **kw) self.widget = widget self.webPrint = lambda m: widget.printClean(self.group.name, m) |
if self.group.name in self.widget.conversations: | groupname = ' if groupname in self.widget.conversations: | def show(self): """If you don't have a GUI, this is a no-op. """ if self.group.name in self.widget.conversations: self.widget.foregroundConversation = self self.widget.callRemote("show", unicode(self.group.name)) |
self.widget.callRemote("show", unicode(self.group.name)) | self.widget.callRemote("show", unicode(groupname)) | def show(self): """If you don't have a GUI, this is a no-op. """ if self.group.name in self.widget.conversations: self.widget.foregroundConversation = self self.widget.callRemote("show", unicode(self.group.name)) |
class Zoom(Operation): | class Magnify(Operation): | def update(self, x, y): ha = self.gui.canvas.get_hadjustment() va = self.gui.canvas.get_vadjustment() |
_d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) | x1 = self.drawn.get_property('x1') y1 = self.drawn.get_property('y1') x2 = self.drawn.get_property('x2') y2 = self.drawn.get_property('y2') | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
current_w = alloc.width current_h = alloc.height box_w = abs(_d['x2'] - _d['x1']) box_h = abs(_d['y2'] - _d['y1']) ratio_w = current_w / box_w ratio_h = current_h / box_h | box_w = abs(x2 - x1) box_h = abs(y2 - y1) ratio_w = alloc.width / box_w ratio_h = alloc.height / box_h | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
current_zoom = 10.0 / canvas.c2w(10, 10)[0] | last_zoom = 10.0 / canvas.c2w(10, 10)[0] | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
zoom = current_zoom | zoom = last_zoom | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
if _d['x1'] < _d['x2']: west = _d['x1'] else: west = _d['x2'] if _d['y1'] < _d['y2']: north = _d['y1'] else: north = _d['y2'] hadj, vadj = canvas.w2c(west, north) | if x1 < x2: west = x1 if y1 < y2: north = y1 | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
x_offset = hadj y_offset = vadj + box_h/2 - (alloc.height/2 * zoom) | x_offset = west y_offset = north - (alloc.height - box_h) / 2 | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
y_offset = vadj x_offset = hadj + box_w/2 - (alloc.width/2 * zoom) | x_offset = west - (alloc.width - box_w) / 2 y_offset = north | def finish(self): """Zoom so the inscribed area is maximized in the main window""" if self.drawn: _d = {} for point in ('x1', 'y1', 'x2', 'y2'): _d[point] = self.drawn.get_property(point) |
'zoom_on': Zoom, | 'magnify_on': Magnify, | def __init__(self, deferred, netclient, fps): self.fps = fps self.deferred = deferred self.netclient = netclient |
'Tabby': _f('tab.js'), 'Tabby.Tests': _f('livetest_tab.js') | 'Tabby': _f('tabs.js'), 'Tabby.Tests': _f('livetest_tabs.js'), | def _f(*sib): return util.sibpath(webby.__file__, '/'.join(sib)) |
log.msg('|||'.join(prefix, command, params)) | log.msg('|||'.join((prefix, command, params))) | def irc_unknown(self, prefix, command, params): log.msg('|||'.join(prefix, command, params)) |
acct = proto.WebbyAccount('%s@%s' % key, | acct = WebbyAccount('%s@%s' % key, | def doConnection(self, host, username, password, channels): key = (username, host) if key in ACCOUNTS and ACCOUNTS[key].isOnline(): self.disconnect(ACCOUNTS[key]) |
def render_debug(self, ctx, data): f = athena.IntrospectionFragment() f.setFragmentParent(self) return ctx.tag[f] | def render_debug(self, ctx, data): f = athena.IntrospectionFragment() f.setFragmentParent(self) return ctx.tag[f] | |
print "3 !!!!!!!!!!!!!!!!!!!!!!! abstract connectionLost", self | def connectionLost(self, reason): """ Basically, t.words.im.basesupport.AbstractClientMixin is completely *fucked* in the head. Subclassing it is impossible, because of the stupid fucking self._protoBase, which turns out to be IRCProto, not this class. | |
self.__dict__['observers'] = [] | self.observers = [] | def __init__(self): self.__dict__['observers'] = [] |
def __setattr__(self, name, value): raise RuntimeError("Assignments must be made through an Arbiter.") | def __setattr__(self, name, value): raise RuntimeError("Assignments must be made through an Arbiter.") | |
old = getattr(n, name, None) | def __setattr__(self, name, value): n = self.noumenon old = getattr(n, name, None) | |
if name in self.noumenon.__phenomena__: return getattr(self.noumenon, name) raise AttributeError(name) | return getattr(self.noumenon, name) | def __getattr__(self, name): if name in self.noumenon.__phenomena__: return getattr(self.noumenon, name) raise AttributeError(name) |
h = Hork() | h = Hork().getArbiter('ROOT') | def bar_changed(self, tag, model, old, new): output.append(('bar', old, new, tag)) |
try: h.foo = 1 except RuntimeError, e: pass else: assert 0, "should not be able to assign to h.foo" | def bar_changed(self, tag, model, old, new): output.append(('bar', old, new, tag)) | |
print 'TODO: fit' | alloc = self.canvas.get_allocation() _, _, canv_w, canv_h = self.canvas.get_scroll_region() ratio_w = alloc.width / canv_w ratio_h = alloc.height / canv_h self.canvas.set_pixels_per_unit(min([ratio_w, ratio_h])) | def on_zoomfit_activate(self, widget): if self.canvas: print 'TODO: fit' |
log.msg('|||'.join((prefix, command, params))) | log.msg('|||'.join((prefix, command, repr(params)))) | def irc_unknown(self, prefix, command, params): log.msg('|||'.join((prefix, command, params))) |
dispatcher.connect(self.receivePropertyChange, self) def receivePropertyChange(self, property, value): setattr(self, property, value) | self.receiver = lambda property,value:setattr(self, property, value) dispatcher.connect(self.receiver, self) | def __init__(self): dispatcher.connect(self.receivePropertyChange, self) |
assert None, "begin must be implemented in a subclass" | pass | def begin(self): assert None, "begin must be implemented in a subclass" |
finish = begin class Drag(Operation): def begin(self): pass | def endAt(self, x, y): self.end_x = x self.end_y = y self.finish() | |
pass | cursor = gdk.Cursor(gdk.TARGET) def beginState(self): self.gui.canvas.window.set_cursor(self.cursor) def endState(self): self.gui.canvas.window.set_cursor(None) | def update(self, x, y): viewport = self.gui.gw_viewport1 ha = viewport.get_hadjustment() va = viewport.get_vadjustment() |
'drag_on': Drag, | 'pan_on': Pan, | def __init__(self, deferred, netclient, fps): self.fps = fps self.deferred = deferred self.netclient = netclient |
self.tool_active = widget.name | tool_changed = (self.tool_active != widget.name) if self.active_operation and tool_changed: self.active_operation.endState() | def on_toolbar_toggled(self, widget): """Toggle off any button which is clicked while on. Otherwise there's always one button that's "on". """ if widget.get_active(): # TODO - cancel current operation self.tool_active = widget.name for child in self.gw_toolbar1.get_children(): if child is not widget: child.set_active(F... |
op = self.active_operation = self.operations[opname](self) op.beginAt(x,y) | self._mousedown = 1 self.active_operation.beginAt(x,y) | def beginOperation(self, opname, x, y): op = self.active_operation = self.operations[opname](self) op.beginAt(x,y) |
self.active_operation = None | def finishOperation(self, opname, x, y): self.active_operation.endAt(x, y) self.active_operation = None | |
if self.active_operation: | if self._mousedown: | def on_canvas_motion_notify_event(self, widget, ev): if self.active_operation: self.updateOperation(self.tool_active, ev.x, ev.y) |
print self.canvas.get_size_request() | def displayModel(self): if self.canvas is None: self.canvas = gnomecanvas.Canvas() # make canvas draw widgets in the NW corner... self.canvas.set_center_scroll_region(False) self.gw_viewport1.add(self.canvas) self.canvas.show() | |
if targ is not None: return self.avatar.sendNotice(targ, {"text": messageText}) | if target is not None: return self.avatar.sendNotice(target, {"text": messageText}) | def irctarget_NOTICE(self, (target, messageText), prefix): if targ is not None: return self.avatar.sendNotice(targ, {"text": messageText}) |
nonrandom = dice_count + dice_optionals | nonrandom = (dice_count + dice_optionals) | def combineBonus(sign, num): values = {'-':-1, '+':1} return num * values[sign] |
dice = (random | nonrandom).setResultsName('dice') | dice = (random | nonrandom).setResultsName('DICE') | def combineBonus(sign, num): values = {'-':-1, '+':1} return num * values[sign] |
ParseResults object can be return instead of a scanString result. | ParseResults object can be returned instead of a scanString result. | def formatNormalized(actor, verb_phrases, targets): """Return a string with only the parts of speech, so a parseString ParseResults object can be return instead of a scanString result. """ _fm_verb_phrases = [] for vp in verb_phrases: verb_list = ' '.join(vp.verbs) if vp.dice: dice_expr = reverseFormatDice(vp.dice) eli... |
if vp.dice: dice_expr = reverseFormatDice(vp.dice) | if vp.DICE: dice_expr = reverseFormatDice(vp) | def formatNormalized(actor, verb_phrases, targets): """Return a string with only the parts of speech, so a parseString ParseResults object can be return instead of a scanString result. """ _fm_verb_phrases = [] for vp in verb_phrases: verb_list = ' '.join(vp.verbs) if vp.dice: dice_expr = reverseFormatDice(vp.dice) eli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.