bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
---|---|---|
def testIllegalSamples(): canvas = Player.loadCanvasString( """<canvas id="brokencanvas" width="160" height="120" multisamplesamples="42"/>""")
|
def testIllegalSamples(): self.canvas = Player.loadCanvasString( """<canvas id="brokencanvas" width="160" height="120" multisamplesamples="42"/>""")
| 480,100 |
def screenshot(): bmp = canvas.screenshot() self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot", False)
|
def screenshot(): bmp = self.canvas.screenshot() self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot", False)
| 480,101 |
def screenshot(): bmp = canvas.screenshot() self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot", False)
|
def screenshot(): bmp = canvas.screenshot() self.compareBitmapToFile(bmp, "testOffscreenMultisampleScreenshot", False)
| 480,102 |
def setTransparentBorder(): self.rect.fillopacity = 0 self.rect.texhref = "rectborder.png" self.rect.strokewidth = 10
|
def setTransparentBorder(): self.rect.fillopacity = 0 self.rect.texhref = "rectborder.png" self.rect.strokewidth = 10
| 480,103 |
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" color="DDDDDD" text="multitouch emulation active!" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
|
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
| 480,104 |
def __init__(self, p): avg.ImageNode.__init__(self, pos=p, href="rgb24-64x64.png")
|
def __init__(self, p): avg.ImageNode.__init__(self, pos=p, href="rgb24-64x64.png")
| 480,105 |
def customMethod(self): pass
|
def customMethod(self): pass
| 480,106 |
def addShutter(shutter): camNode.shutter += shutter print "shutter:", camNode.shutter
|
def addShutter(shutter): camNode.shutter += shutter print "shutter:", camNode.shutter
| 480,107 |
def symtree(src, dest): os.mkdir(dest) for f in os.listdir(src): fpath = os.path.join(src, f) if (f and f[0] != '.' and (os.path.isdir(fpath) or (os.path.isfile(fpath) and os.path.splitext(f)[1] == '.py'))): os.symlink(os.path.join(os.pardir, src, f), os.path.join(dest, f))
|
def symtree(src, dest): os.mkdir(dest) for f in os.listdir(src): fpath = os.path.join(src, f) if (f and f[0] != '.' and (os.path.isdir(fpath) or (os.path.isfile(fpath) and os.path.splitext(f)[1] == '.py'))): os.symlink(os.path.join(os.pardir, src, f), os.path.join(dest, f))
| 480,108 |
def onMouseDown(event): self.__mouseDownCalled = True
|
def def addEmptyPolygon(): avg.PolygonNode(parent=canvas, fillopacity=1) onMouseDown(event): def addEmptyPolygon(): avg.PolygonNode(parent=canvas, fillopacity=1) self.__mouseDownCalled def addEmptyPolygon(): avg.PolygonNode(parent=canvas, fillopacity=1) = def addEmptyPolygon(): avg.PolygonNode(parent=canvas, fillopacity=1) True
| 480,109 |
def onMouseDown(event): self.__mouseDownCalled = True
|
def onMouseDown(event): self.__mouseDownCalled = True
| 480,110 |
def testVideoNullFX(self): self.loadEmptyScene() root = Player.getRootNode() Player.setFakeFPS(25) node = avg.VideoNode(parent=root, href="../video/testfiles/mjpeg-48x48.avi") node.setEffect(avg.NullFXNode()) node.play() self.start(None, (lambda: self.compareImage("testVideoNullFX", False), ))
|
def testVideoNullFX(self): self.loadEmptyScene() root = Player.getRootNode() Player.setFakeFPS(25) node = avg.VideoNode(parent=root, href="../video/testfiles/mjpeg-48x48.avi", threaded=False) node.setEffect(avg.NullFXNode()) node.play() self.start(None, (lambda: self.compareImage("testVideoNullFX", False), ))
| 480,111 |
def testWordsNullFX(self): self.loadEmptyScene() root = Player.getRootNode() node = avg.WordsNode(parent=root, text="testtext") node.setEffect(avg.NullFXNode()) self.start(None, (lambda: self.compareImage("testWordsNullFX", True), ))
|
def testWordsNullFX(self): self.loadEmptyScene() root = Player.getRootNode() node = avg.WordsNode(parent=root, text="testtext", font="Bitstream Vera Sans") node.setEffect(avg.NullFXNode()) self.start(None, (lambda: self.compareImage("testWordsNullFX", True), ))
| 480,112 |
def delete(self): """ after turning off the emulater the function unlinks all nodes of the emulator. so it be garanted that the application is working as before again. events will be cleared with two UP events. """ rootNode = Player.getRootNode() rootNode.setEventHandler(avg.CURSORMOTION, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORUP, avg.MOUSE, None) self.__layer.unlink() self.__container.unlink() self.__p1.unlink() self.__p2.unlink() self.__p1 = self.__p2 = None self.__container = self.__node2root = self.__layer = None Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, Point2D(0,0)) Player.getTestHelper().fakeTouchEvent(self.__getRightID(), avg.CURSORUP, self.EventMode, self.pos2, self.pos2, Point2D(0,0))
|
def delete(self): """ after turning off the emulater the function unlinks all nodes of the emulator. so it be garanted that the application is working as before again. events will be cleared with two UP events. """ rootNode = Player.getRootNode() rootNode.setEventHandler(avg.CURSORMOTION, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORUP, avg.MOUSE, None) self.__layer.unlink() self.__container.unlink() self.__p1.unlink() self.__p2.unlink() self.__p1 = self.__p2 = None self.__container = self.__node2root = self.__layer = None Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, Point2D(0,0)) Player.getTestHelper().fakeTouchEvent(self.__getRightID(), avg.CURSORUP, self.EventMode, self.pos2, self.pos2, Point2D(0,0))
| 480,113 |
def _getCoords(self): return zip(xrange(10,len(self._values)*self._xSkip, self._xSkip), self._values)
|
def class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos _getCoords(self): class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos return class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos zip(xrange(10,len(self._values)*self._xSkip, class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos self._xSkip), class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos self._values) class TouchVisualization(avg.CircleNode): def __init__(self, event, **kwargs): avg.CircleNode.__init__(self, **kwargs) self.cursorid = event.cursorid self.pos = event.pos self.r = 10 self.fillcolor = "FFFFFF" self.fillopacity = 0.5 self.strokewidth = 0 def move(self, event): self.pos = event.pos
| 480,114 |
def __init__(self, appClass, resolution, debugWindowSize = None): self._AppClass = appClass resolution = Point2D(resolution) testMode = self._AppClass.avg_deploy == None if testMode and debugWindowSize is not None: debugWindowSize = Point2D(debugWindowSize) else: debugWindowSize = Point2D(0, 0)
|
def __init__(self, appClass, resolution, debugWindowSize = None): self._AppClass = appClass resolution = Point2D(resolution) testMode = self._AppClass.avg_deploy == None if testMode and debugWindowSize is not None: debugWindowSize = Point2D(debugWindowSize) else: debugWindowSize = Point2D(0, 0)
| 480,115 |
def __switchMtemu(self): if self._mtEmu is None: self._mtEmu = MTemu() self.bindKey('left ctrl', self._mtEmu.changeMode, 'switch event mode') self.bindKey('right ctrl', self._mtEmu.changeMode, 'switch event mode') self.bindKey('left shift', self._mtEmu.multiTouch, 'create 2nd event') self.bindKey('right shift', self._mtEmu.multiTouch, 'create 2nd event') self.bindKey('left shift', self._mtEmu.multiTouch, 'create 2nd event', 'up') self.bindKey('right shift', self._mtEmu.multiTouch, 'create 2nd event', 'up') else: self.unbindKey('left ctrl') self.unbindKey('right ctrl') self.unbindKey('left shift') self.unbindKey('right shift') self._mtEmu.delete() self._mtEmu = None
|
def def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False __switchMtemu(self): def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False if def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False is def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False None: def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False = def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False MTemu() def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('left def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False ctrl', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.changeMode, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'switch def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False mode') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('right def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False ctrl', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.changeMode, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'switch def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False mode') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('left def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.multiTouch, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'create def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 2nd def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('right def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.multiTouch, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'create def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 2nd def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('left def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.multiTouch, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'create def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 2nd def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'up') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.bindKey('right def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.multiTouch, def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'create def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 2nd def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False event', def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False 'up') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False else: def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.unbindKey('left def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False ctrl') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.unbindKey('right def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False ctrl') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.unbindKey('left def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self.unbindKey('right def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False shift') def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu.delete() def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False self._mtEmu def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False = def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False None def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {} def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False
| 480,116 |
def showInfo(node): global len_filename node.play() info = "{File:%d}{Duration:12}{Bitrate:15}{VideoCodes:13}{VideoSize:11}{Pixel:14}{FPS:10}{AudioCodec:12}{SampleRate:13}{Channels:8}" % (len_filename+2) if node.hasAudio(): print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=node.getAudioCodec(), SampleRate=str(node.getAudioSampleRate()), Channels=str(node.getNumAudioChannels()))) else: print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=' ', SampleRate=' ', Channels=' '))
|
def showInfo(node): global len_filename node.play() if node.hasAudio(): vFile = str(os.path.basename(node.href)).ljust(len_filename+2) vDuration = str(node.getDuration()/1000.).ljust(12) vBitrate = str(node.getBitrate()).ljust(15) vVideoCodec = str(node.getVideoCodec()).ljust(13) vVideoSize = str(node.getMediaSize()).ljust(11) vPixel = str(node.getStreamPixelFormat()).ljust(14) vFPS = str(node.fps).ljust(10) vAudioCodec = str(node.getAudioCodec()).ljust(12) vSampleRate = str(node.getAudioSampleRate()).ljust(13) vChannels = str(node.getNumAudioChannels()).ljust(8) info = vFile + vDuration + vVideoCodec + vVideoSize + vPixel + vFPS + vAudioCodec + vSampleRate + vChannels print info else: vFile = str(os.path.basename(node.href)).ljust(len_filename+2) vDuration = str(node.getDuration()/1000.).ljust(12) vBitrate = str(node.getBitrate()).ljust(15) vVideoCodec = str(node.getVideoCodec()).ljust(13) vVideoSize = str(node.getMediaSize()).ljust(11) vPixel = str(node.getStreamPixelFormat()).ljust(14) vFPS = str(node.fps).ljust(10) vAudioCodec = "".ljust(12) vSampleRate = "".ljust(13) vChannels = "".ljust(8) info = vFile + vDuration + vVideoCodec + vVideoSize + vPixel + vFPS + vAudioCodec + vSampleRate + vChannels print info
| 480,117 |
def showInfo(node): global len_filename node.play() info = "{File:%d}{Duration:12}{Bitrate:15}{VideoCodes:13}{VideoSize:11}{Pixel:14}{FPS:10}{AudioCodec:12}{SampleRate:13}{Channels:8}" % (len_filename+2) if node.hasAudio(): print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=node.getAudioCodec(), SampleRate=str(node.getAudioSampleRate()), Channels=str(node.getNumAudioChannels()))) else: print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=' ', SampleRate=' ', Channels=' '))
|
def showInfo(node): global len_filename node.play() info = "{File:%d}{Duration:12}{Bitrate:15}{VideoCodes:13}{VideoSize:11}{Pixel:14}{FPS:10}{AudioCodec:12}{SampleRate:13}{Channels:8}" % (len_filename+2) if node.hasAudio(): print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=node.getAudioCodec(), SampleRate=str(node.getAudioSampleRate()), Channels=str(node.getNumAudioChannels()))) else: print (info.format( File=str(os.path.basename(node.href)), Duration=str(node.getDuration()/1000.), Bitrate=str(node.getBitrate()), VideoCodes=node.getVideoCodec(), VideoSize=str(node.getMediaSize()), Pixel=node.getStreamPixelFormat(), FPS='%2.2f'%node.fps, AudioCodec=' ', SampleRate=' ', Channels=' '))
| 480,118 |
def __init__(self, cid): """ CID is the community identifier. """ assert isinstance(cid, str) assert len(cid) == 20
|
def __init__(self, cid): """ CID is the community identifier. """ assert isinstance(cid, str) assert len(cid) == 20
| 480,119 |
def get_current_bloom_filter(self): """ Returns (global-time, bloom-filter) """ index = len(self._bloom_filters) - 1 while len(self._bloom_filters) <= index: self._bloom_filters.append(BloomFilter(100, 0.01)) return index * self._bloom_filter_stepping + 1, self._bloom_filters[index]
|
def get_current_bloom_filter(self): """ Returns (global-time, bloom-filter) """ index = len(self._bloom_filters) - 1 return index * self._bloom_filter_stepping + 1, self._bloom_filters[index]
| 480,120 |
def receive_message(self, timeout=10.0, addresses=None, packets=None, message_names=None, payload_types=None, distributions=None, destinations=None): assert isinstance(timeout, float) assert isinstance(addresses, (type(None), list)) assert isinstance(packets, (type(None), list)) assert isinstance(message_names, (type(None), list)) assert isinstance(payload_types, (type(None), list)) assert isinstance(distributions, (type(None), list)) assert isinstance(destinations, (type(None), list)) self._socket.settimeout(timeout) while True: address, packet = self.receive_packet(timeout, addresses, packets) message = self._community.get_conversion().decode_message(packet)
|
def receive_message(self, timeout=10.0, addresses=None, packets=None, message_names=None, payload_types=None, distributions=None, destinations=None): assert isinstance(timeout, float) assert isinstance(addresses, (type(None), list)) assert isinstance(packets, (type(None), list)) assert isinstance(message_names, (type(None), list)) assert isinstance(payload_types, (type(None), list)) assert isinstance(distributions, (type(None), list)) assert isinstance(destinations, (type(None), list)) self._socket.settimeout(timeout) while True: address, packet = self.receive_packet(timeout, addresses, packets) message = self._community.get_conversion().decode_message(packet)
| 480,121 |
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
|
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
| 480,122 |
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
|
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
| 480,123 |
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
|
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
| 480,124 |
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
|
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
| 480,125 |
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
|
def store_and_forward(self, messages): """ Queue MESSAGES to be dispersed to other nodes. """ if __debug__: from Message import Message assert isinstance(messages, (tuple, list)) assert len(messages) > 0 assert not filter(lambda x: not isinstance(x, Message.Implementation), messages)
| 480,126 |
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
|
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
| 480,127 |
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
|
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
| 480,128 |
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
|
def on_sync_message(self, address, message): """ We received a dispersy-sync message.
| 480,129 |
def permit(self, message, payload, authentication=(), distribution=(), destination=(), update_locally=True, store_and_forward=True): """ TODO
|
def permit(self, message, payload, authentication=(), distribution=(), destination=(), update_locally=True, store_and_forward=True): """ TODO
| 480,130 |
def encode_message(self, message): """ Encode a Message instance into a binary string that starts with CID and VID. """ assert isinstance(message, Message) raise NotImplementedError()
|
def encode_message(self, message): """ Encode a Message instance into a binary string that starts with CID and VID. """ assert isinstance(message, Message) raise NotImplementedError()
| 480,131 |
def copy_files(self): for min_path in self.files: if '*' in min_path: files = glob.glob( min_path ) else: files = [ min_path ]
|
def copy_files(self): for min_path in self.files: if '*' in min_path: files = glob.glob( min_path ) else: files = [ min_path ]
| 480,132 |
def umount(mp, mounts): if not mp in mounts: dbg("src=%s dest=%s root=%s not mounted" % (mp.src, mp.dest, mp.root)) return while mp in mounts: mounts.remove( mp ) fp = mp.root.pjoin(mp.dest) if cmd('umount %s' % fp, raise_exception=False) != 0: warn('Unmount of %s failed.' % fp) warn('Killing any processes still running in %s' % mp.root) pl = [] for root in glob.glob('/proc/[0-9][0-9]*/root'): if os.readlink(root).startswith(mp.root): pl.append( root[len('/proc/'):-len('/root')] ) _kill_pids(pl) if cmd('umount -f %s' % fp, raise_exception=False) != 0: err('Cound not unmount %s' % fp) return False if mp.rmdir: shutil.rmtree(fp) return True
|
def umount(mp, mounts): if not mp in mounts: dbg("src=%s dest=%s root=%s not mounted" % (mp.src, mp.dest, mp.root)) return while mp in mounts: mounts.remove( mp ) fp = mp.root.pjoin(mp.dest) if cmd('umount %s' % fp, raise_exception=False) != 0: warn('Unmount of %s failed.' % fp) warn('Killing any processes still running in %s' % mp.root) pl = [] for root in glob.glob('/proc/[0-9][0-9]*/root'): try: if os.readlink(root).startswith(mp.root): pl.append( root[len('/proc/'):-len('/root')] ) except OSError, e: if e.errno == 2: continue _kill_pids(pl) if cmd('umount -f %s' % fp, raise_exception=False) != 0: err('Cound not unmount %s' % fp) return False if mp.rmdir: shutil.rmtree(fp) return True
| 480,133 |
def _kill_pids(pids, ignore_exceptions=True): if type(pids) == int: pids = [pids] for p in pids: if p == -1: continue try: os.kill(p, signal.SIGTERM) if os.waitpid(p, os.WNOHANG)[1] == 0: os.kill(p, signal.SIGKILL) os.waitpid(p, 0) except OSError, e: if ignore_exceptions: warn('Child process %d failed to die' % (p,)) if not e.errno in (10, 3): raise e
|
def _kill_pids(pids, ignore_exceptions=True): if type(pids) == int: pids = [pids] for p in pids: if p == -1: continue try: os.kill(p, signal.SIGTERM) if os.waitpid(p, os.WNOHANG)[1] == 0: os.kill(p, signal.SIGKILL) os.waitpid(p, 0) except OSError, e: if ignore_exceptions: warn('Child process %d already exited or failed to die' % (p,)) if not e.errno in (10, 3): raise e
| 480,134 |
def _spawn(cmdline, env={}, return_output=False, timeout=0, exe=None, chdir=None): if type(cmdline) == types.StringType: cmdline = cmdline.split() if exe == None: exe = cmdline[0] if return_output: dbg("Getting output from '%s'" % ' '.join(cmdline)) fout = tempfile.NamedTemporaryFile() else: dbg("Calling '%s'" % ' '.join(cmdline)) fout = sys.stdout try: child = subprocess.Popen(cmdline, shell=False, executable=exe, env=env, stdout=fout, stderr=subprocess.STDOUT, close_fds=True, cwd=chdir) except (SystemExit, KeyboardInterrupt): _kill_pids(child.pid) raise except OSError, e: raise InhibitorError("Failed to spawn '%s': %s" % (cmdline, e)) if timeout == 0: ret = child.wait() else: start_time = time.time() ctime = start_time while True: time.sleep(1) ret = child.poll() if ret != None: break ctime = time.time() if (start_time + timeout) >= ctime: _kill_pids(child.pid) raise InhibitorError("Timeout (%d seconds) waiting for '%s'" % (int(timeout), cmdline)) if return_output: fout.flush() fout.seek(0) output = fout.read() ret = (ret, output) fout.close() return ret
|
def _spawn(cmdline, env={}, return_output=False, timeout=0, exe=None, chdir=None): if type(cmdline) == types.StringType: cmdline = cmdline.split() if exe == None: exe = cmdline[0] if return_output: dbg("Getting output from '%s'" % ' '.join(cmdline)) fout = tempfile.NamedTemporaryFile() else: dbg("Calling '%s'" % ' '.join(cmdline)) fout = sys.stdout try: child = subprocess.Popen(cmdline, shell=False, executable=exe, env=env, stdout=fout, stderr=subprocess.STDOUT, close_fds=True, cwd=chdir) except (SystemExit, KeyboardInterrupt): _kill_pids(child.pid) raise except OSError, e: raise InhibitorError("Failed to spawn '%s': %s" % (cmdline, e)) if timeout == 0: try: ret = child.wait() except (SystemExit, KeyboardInterrupt): raise InhibitorError( "Caught SystemExit or KeyboardInterrupt while running %s" % (cmdline)) else: start_time = time.time() ctime = start_time while True: time.sleep(1) ret = child.poll() if ret != None: break ctime = time.time() if (start_time + timeout) >= ctime: _kill_pids(child.pid) raise InhibitorError("Timeout (%d seconds) waiting for '%s'" % (int(timeout), cmdline)) if return_output: fout.flush() fout.seek(0) output = fout.read() ret = (ret, output) fout.close() return ret
| 480,135 |
def copy_files(self): fix_slash = re.compile('///*')
|
def copy_files(self): fix_slash = re.compile('///*')
| 480,136 |
def _write_dictionary(self, destdir, d): for k,v in d.items(): if type(v) == types.StringType: self._write_file(destdir.join(k), v) else: os.makedirs(destdir.pjoin(k)) self._write_dictionary(destdir.pjoin(k), v)
|
def _write_dictionary(self, destdir, d): for k,v in d.items(): if type(v) == types.StringType: self._write_file(destdir.pjoin(k), v) else: os.makedirs(destdir.pjoin(k)) self._write_dictionary(destdir.pjoin(k), v)
| 480,137 |
def install(self, root, dest): nkeys = None if self.output == None: # In case we're resuming a build where the fetch step was skipped. self.fetch()
|
def install(self, root, dest): nkeys = None if self.output == None: # In case we're resuming a build where the fetch step was skipped. self.fetch()
| 480,138 |
def install_busybox(self): ash_link = self.full_minroot.pjoin('/bin/ash') if os.path.exists(ash_link): os.unlink(ash_link) os.symlink('busybox', self.full_minroot.pjoin('/bin/ash'))
|
def install_busybox(self): ash_link = self.full_minroot.pjoin('/bin/ash') if os.path.exists(ash_link): os.unlink(ash_link) os.symlink('busybox', self.full_minroot.pjoin('/bin/ash'))
| 480,139 |
def chroot_failure(self, _): util.umount_all(self.istate.mount_points)
|
def chroot_failure(self): util.umount_all(self.istate.mount_points)
| 480,140 |
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
|
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
| 480,141 |
def make_profile_link(self): targ = self.target_root.pjoin( self.portage_cr.pjoin('/etc/make.profile') ) util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink(self.env['PORTDIR'] + '/profiles/%s' % self.profile, targ)
|
def make_profile_link(self): targ = self.target_root.pjoin( self.portage_cr.pjoin('/etc/make.profile') ) util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink(self.env['PORTDIR'] + '/profiles/%s' % self.profile, targ)
| 480,142 |
def clean_sources(self): for src in self.sources: src.finish() for _, src in self.aux_sources.items(): if not src in self.sources: src.finish()
|
def finish_sources(self): for src in self.sources: src.finish() for _, src in self.aux_sources.items(): if not src in self.sources: src.finish()
| 480,143 |
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
|
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
| 480,144 |
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
|
def post_conf(self, inhibitor_state): super(BaseStage, self).post_conf(inhibitor_state)
| 480,145 |
def make_profile_link(self): targ = self.target_root.pjoin(self.portage_cr + '/etc/make.profile') util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink('/usr/portage/profiles/%s' % self.conf.profile, targ)
|
def make_profile_link(self): targ = self.target_root.pjoin( self.portage_cr.pjoin('/etc/make.profile') ) util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink('/usr/portage/profiles/%s' % self.conf.profile, targ)
| 480,146 |
def make_profile_link(self): targ = self.target_root.pjoin(self.portage_cr + '/etc/make.profile') util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink('/usr/portage/profiles/%s' % self.conf.profile, targ)
|
def make_profile_link(self): targ = self.target_root.pjoin(self.portage_cr + '/etc/make.profile') util.mkdir( os.path.dirname(targ) ) if os.path.lexists(targ): os.unlink(targ) os.symlink('/usr/portage/profiles/%s' % self.conf.profile, targ)
| 480,147 |
def setup_chroot(self): dest = self.builddir.pjoin('tmp/inhibitor') if not os.path.isdir(dest.pjoin('sh')): os.makedirs(dest.pjoin('sh'))
|
def setup_chroot(self): dest = self.builddir.pjoin('tmp/inhibitor') if not os.path.isdir(dest.pjoin('sh')): os.makedirs(dest.pjoin('sh'))
| 480,148 |
def __init__(self, stage_conf, build_name, **keywds): super(InhibitorStage4, self).__init__(stage_conf, build_name, stage_name='stage4', **keywds)
|
def __init__(self, stage_conf, build_name, **keywds): super(InhibitorStage4, self).__init__(stage_conf, build_name, stage_name='stage4', **keywds)
| 480,149 |
def get_action_sequence(self): ret = self.setup_sequence[:] ret.extend([ Step(self.chroot, always=False), Step(self.install_kernel, always=False), Step(self.run_scripts, always=False) ]) ret.extend(self.cleanup_sequence) return ret
|
def get_action_sequence(self): ret = self.setup_sequence[:] ret.append( Step(self.chroot, always=False) ) if self.conf.has('kernel'): ret.append( Step(self.install_kernel, always=False) ) ret.append( Step(self.run_scripts, always=False) ) ret.extend(self.cleanup_sequence) return ret
| 480,150 |
def header_id_from_text(self, text, prefix, n): if n == 1 and not self._skipped_first_h1: self._skipped_first_h1 = True elif n == 1: return super(Markdown, self).header_id_from_text(text, prefix, n) elif n == 2: # "GET /sshkeys/:id" -> "GET-/sshkeys/:id" return text.replace(' ', '-')
|
def header_id_from_text(self, text, prefix, n): if n == 1 and not self._skipped_first_h1: self._skipped_first_h1 = True elif n == 1: return super(Markdown, self).header_id_from_text(text, prefix, n) elif n == 2: # "GET /sshkeys/:id" -> "GET-/sshkeys/:id" return text.replace(' ', '-')
| 480,151 |
def postprocess(self, text): # Add markup to endpoint h2's for styling. text = self._endpoint_header_re.sub( r'\1<span>\2</span>\3', text) # Add "req" class and sexify pre-blocks starting with '$'. text = self._pre_command_block_re.sub( r'<pre class="shell"><code class="prompt">\1</code></pre>', text) return text
|
def postprocess(self, text): # Add markup to endpoint h2's for styling. text = self._endpoint_header_re.sub( r'\1<span>\2</span>\3', text) # Add "req" class and sexify pre-blocks starting with '$'. text = self._pre_command_block_re.sub( r'<pre class="shell"><code class="prompt">\1</code></pre>', text) return text
| 480,152 |
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html print html.toc_html print html._toc bits = [] bits.append(u"""<!DOCTYPE html>
|
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html bits = [] bits.append(u"""<!DOCTYPE html>
| 480,153 |
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html print html.toc_html print html._toc bits = [] bits.append(u"""<!DOCTYPE html>
|
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html print html.toc_html print html._toc bits = [] bits.append(u"""<!DOCTYPE html>
| 480,154 |
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html print html.toc_html print html._toc bits = [] bits.append(u"""<!DOCTYPE html>
|
def restdown(metadata, markdown): #TODO: START HERE # - "endpoint" JS. Does the new markup and lack of "enpoint fixed" work? # - fill in content html = Markdown(**opts).convert(markdown) metadata["toc_html"] = html.toc_html print html.toc_html print html._toc bits = [] bits.append(u"""<!DOCTYPE html>
| 480,155 |
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
|
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
| 480,156 |
def _action_pay(self, cursor, user, data, context=None): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
|
def _action_pay(self, cursor, user, data, context=None): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
| 480,157 |
def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('account_invoice'))
|
def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('account_invoice'))
| 480,158 |
def _action_pay(self, cursor, user, data, context=None): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
|
def _action_pay(self, cursor, user, data, context=None): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
| 480,159 |
def _credit(self, invoice): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
|
def _credit(self, invoice): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
| 480,160 |
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
|
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
| 480,161 |
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
|
def _credit(self, cursor, user, invoice, context=None): ''' Return values to credit invoice. ''' invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax')
| 480,162 |
def _action_pay(self, data): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
|
def _action_pay(self, data): invoice_obj = self.pool.get('account.invoice') currency_obj = self.pool.get('currency.currency') move_line_obj = self.pool.get('account.move.line')
| 480,163 |
def get_codec(self): if not self.loaded: raise FileNotLoadedException e = self._fetch_events([0]) if(len(e) == 0): return None raw_codec = e[0].value codec = {} for key in raw_codec.keys(): codec[key] = raw_codec[key]["tagname"] return codec
|
@property def codec(self): if not self.loaded: raise FileNotLoadedException e = self._fetch_events([0]) if(len(e) == 0): return None raw_codec = e[0].value codec = {} for key in raw_codec.keys(): codec[key] = raw_codec[key]["tagname"] return codec
| 480,164 |
def get_reverse_codec(self): if not self.loaded: raise FileNotLoadedException c = self.codec keys = c.keys() values = c.values() rc = {} for i in range(0, len(keys)): k = keys[i] v = values[i] print("key: %d, value %s" % (k,v)) rc[v] = k return rc
|
@property def reverse_codec(self): if not self.loaded: raise FileNotLoadedException c = self.codec keys = c.keys() values = c.values() rc = {} for i in range(0, len(keys)): k = keys[i] v = values[i] print("key: %d, value %s" % (k,v)) rc[v] = k return rc
| 480,165 |
def get_reverse_codec(self): if not self.loaded: raise FileNotLoadedException c = self.codec keys = c.keys() values = c.values() rc = {} for i in range(0, len(keys)): k = keys[i] v = values[i] print("key: %d, value %s" % (k,v)) rc[v] = k return rc
|
def get_reverse_codec(self): if not self.loaded: raise FileNotLoadedException c = self.codec keys = c.keys() values = c.values() rc = {} for i in range(0, len(keys)): k = keys[i] v = values[i] rc[v] = k return rc
| 480,166 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building metapackage") filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,167 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,168 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,169 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,170 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,171 |
def send_data(self, code, data): dtype = data.__class__ if dtype == float or dtype == numpy.float32 or dtype == numpy.float64: self.send_float(code, data) elif dtype == int or dtype == numpy.int16 or dtype == numpy.int32 or dtype == numpy.int64: self.send_integer(code, data) else: self.send_object(code, data)
|
class _ConduitMixin(object): def initialize(self): self._initialize() def send_data(self, code, data): dtype = type(data) if dtype in (float, numpy.float32, numpy.float64): self.send_float(code, data) elif dtype in (int, numpy.int16, numpy.int32, numpy.int64): self.send_integer(code, data) else: self.send_object(code, data)
| 480,172 |
def send_data(self, code, data): dtype = data.__class__ if dtype == float or dtype == numpy.float32 or dtype == numpy.float64: self.send_float(code, data) elif dtype == int or dtype == numpy.int16 or dtype == numpy.int32 or dtype == numpy.int64: self.send_integer(code, data) else: self.send_object(code, data)
|
def send_data(self, code, data): dtype = data.__class__ if dtype == float or dtype == numpy.float32 or dtype == numpy.float64: self.send_float(code, data) elif dtype == int or dtype == numpy.int16 or dtype == numpy.int32 or dtype == numpy.int64: self.send_integer(code, data) else: self.send_object(code, data)
| 480,173 |
def handle_codec_(self, evt): self.reverse_codec = {} self.codec = {} codec_datum = evt.value() for k in codec_datum.keys(): name = codec_datum[k]["tagname"] self.codec[k] = name self.reverse_codec[name] = k
|
class IPCServerConduit(_ConduitMixin, _IPCServerConduit): pass codec_datum = evt.value() for k in codec_datum.keys(): name = codec_datum[k]["tagname"] self.codec[k] = name self.reverse_codec[name] = k
| 480,174 |
def handle_codec_(self, evt): self.reverse_codec = {} self.codec = {} codec_datum = evt.value() for k in codec_datum.keys(): name = codec_datum[k]["tagname"] self.codec[k] = name self.reverse_codec[name] = k
|
def handle_codec_(self, evt): self.reverse_codec = {} self.codec = {} codec_datum = evt.value() for k in codec_datum.keys(): name = codec_datum[k]["tagname"] self.codec[k] = name self.reverse_codec[name] = k
| 480,175 |
def initialize_(self): # register a pure python handler for the codec #self.register_callback_for_code(0, lambda e: self.handle_codec(self, e)) # call the C++ initialize method self.__initialize()
|
def initialize_(self): # register a pure python handler for the codec #self.register_callback_for_code(0, lambda e: self.handle_codec(self, e)) # call the C++ initialize method self.__initialize()
| 480,176 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building metapackage") filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,177 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,178 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,179 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,180 |
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
|
def build_metapackage(doc, version, output_path, output_name): print("Building: %s" % pkg) filename = output_name + "_" + version + ".pkg" full_output_path = output_path + "/" + filename cmd = "%s --doc %s --id %s --version %s --out %s" % (package_maker, doc, project_id, version, full_output_path) print(cmd) os.system(cmd) os.system("cd %s; zip -r %s %s" % (output_path, filename +".zip", filename))
| 480,181 |
def unindex(self): if(os.path.isdir(self.file)): split_file_name = os.path.split(self.file) file_name = split_file_name[-1:][0] parent_path = os.pathsep.join(split_file_name[0:-1]) true_mwk_file = os.path.join(self.file,file_name) print "parent_path: ", parent_path print "file_name: ", file_name print "true_mwk_file; ", true_mwk_file aside_path = os.path.join(parent_path, file_name + ".aside") os.rename( self.file, aside_path) #print "rename %s to %s" % ( self.file, aside_path) os.rename( os.path.join(aside_path, file_name), os.path.join(parent_path,file_name) ) #print "rename %s to %s" % ( os.path.join(aside_path, file_name), os.path.join(parent_path,file_name) ) os.system("rm -rf %s" % aside_path) #print "remove %s" % aside_path else: raise IndexingException("Attempt to re-index a file that has not yet been indexed")
|
def unindex(self): if(os.path.isdir(self.file)): split_file_name = os.path.split(self.file) file_name = split_file_name[-1:][0] parent_path = os.pathsep.join(split_file_name[0:-1]) true_mwk_file = os.path.join(self.file,file_name) aside_path = os.path.join(parent_path, file_name + ".aside") os.rename( self.file, aside_path) #print "rename %s to %s" % ( self.file, aside_path) os.rename( os.path.join(aside_path, file_name), os.path.join(parent_path,file_name) ) #print "rename %s to %s" % ( os.path.join(aside_path, file_name), os.path.join(parent_path,file_name) ) os.system("rm -rf %s" % aside_path) #print "remove %s" % aside_path else: raise IndexingException("Attempt to re-index a file that has not yet been indexed")
| 480,182 |
def get_events(self, **kwargs): event_codes = [] time_range = [] # shortcut to argument-free version if "codes" not in kwargs and "time_range" not in kwargs: return self.__fetch_all_events() codec = self.codec if codec is None: raise NoValidCodecException reverse_codec = self.reverse_codec if reverse_codec is None: raise NoValidCodecException if "codes" in kwargs: event_codes = kwargs["codes"] for i in range(0, len(event_codes)): code = event_codes[i] if(type(code) == str): if(code in reverse_codec): event_codes[i] = reverse_codec[code] else: event_codes = codec.keys() # all events if "time_range" in kwargs: time_range = kwargs["time_range"] else: time_range = [self.minimum_time, self.maximum_time] # TODO: convert possible string-based event codes events = self.__fetch_events(event_codes, time_range[0], time_range[1]) return events
|
def get_events(self, **kwargs): event_codes = [] time_range = [] # shortcut to argument-free version if "codes" not in kwargs and "time_range" not in kwargs: return self._fetch_all_events() codec = self.codec if codec is None: raise NoValidCodecException reverse_codec = self.reverse_codec if reverse_codec is None: raise NoValidCodecException if "codes" in kwargs: event_codes = kwargs["codes"] for i in range(0, len(event_codes)): code = event_codes[i] if(type(code) == str): if(code in reverse_codec): event_codes[i] = reverse_codec[code] else: event_codes = codec.keys() # all events if "time_range" in kwargs: time_range = kwargs["time_range"] else: time_range = [self.minimum_time, self.maximum_time] # TODO: convert possible string-based event codes events = self.__fetch_events(event_codes, time_range[0], time_range[1]) return events
| 480,183 |
def get_events(self, **kwargs): event_codes = [] time_range = [] # shortcut to argument-free version if "codes" not in kwargs and "time_range" not in kwargs: return self.__fetch_all_events() codec = self.codec if codec is None: raise NoValidCodecException reverse_codec = self.reverse_codec if reverse_codec is None: raise NoValidCodecException if "codes" in kwargs: event_codes = kwargs["codes"] for i in range(0, len(event_codes)): code = event_codes[i] if(type(code) == str): if(code in reverse_codec): event_codes[i] = reverse_codec[code] else: event_codes = codec.keys() # all events if "time_range" in kwargs: time_range = kwargs["time_range"] else: time_range = [self.minimum_time, self.maximum_time] # TODO: convert possible string-based event codes events = self.__fetch_events(event_codes, time_range[0], time_range[1]) return events
|
def get_events(self, **kwargs): event_codes = [] time_range = [] # shortcut to argument-free version if "codes" not in kwargs and "time_range" not in kwargs: return self.__fetch_all_events() codec = self.codec if codec is None: raise NoValidCodecException reverse_codec = self.reverse_codec if reverse_codec is None: raise NoValidCodecException if "codes" in kwargs: event_codes = kwargs["codes"] for i in range(0, len(event_codes)): code = event_codes[i] if(type(code) == str): if(code in reverse_codec): event_codes[i] = reverse_codec[code] else: event_codes = codec.keys() # all events if "time_range" in kwargs: time_range = kwargs["time_range"] else: time_range = [self.minimum_time, self.maximum_time] # TODO: convert possible string-based event codes events = self._fetch_events(event_codes, time_range[0], time_range[1]) return events
| 480,184 |
def get_codec(self): if not self.loaded: raise FileNotLoadedException e = self.__fetch_events([0]) if(len(e) == 0): return None raw_codec = e[0].value codec = {} for key in raw_codec.keys(): codec[key] = raw_codec[key]["tagname"] return codec
|
def get_codec(self): if not self.loaded: raise FileNotLoadedException e = self._fetch_events([0]) if(len(e) == 0): return None raw_codec = e[0].value codec = {} for key in raw_codec.keys(): codec[key] = raw_codec[key]["tagname"] return codec
| 480,185 |
def display(self, strings, show_intersections): # unset and set model for speed store = self.tree.get_model() self.tree.set_model(None) self.data = [] colors = {True: '<span color="black">', False: '<span color="gray">'} for word, has_intersections in strings: display = "".join([colors[has_intersections], word, "</span>"]) self.data.append([word, has_intersections, display]) self._display_data(store, show_intersections) self.tree.set_model(store) self.tree.queue_draw()
|
def display(self, strings, show_intersections): # unset and set model for speed store = self.tree.get_model() self.tree.set_model(None) self.data = [] colors = {True: '<span color="black">', False: '<span color="gray">'} for word, has_intersections in strings: display = "".join([colors[has_intersections], word, "</span>"]) self.data.append((word, has_intersections, display)) self._display_data(store, show_intersections) self.tree.set_model(store) self.tree.queue_draw()
| 480,186 |
def refresh_visual_size(self): self.puzzle.view.refresh_visual_size(self.drawing_area)
|
def refresh_visual_size(self): self.puzzle.view.grid = self.puzzle.grid self.puzzle.view.properties.grid = self.puzzle.grid width = self.puzzle.view.properties.visual_width() height = self.puzzle.view.properties.visual_height() self.drawing_area.set_size_request(width, height)
| 480,187 |
def render(context, grid, props): lines = grid.get_lines(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) lwidth = props.line["width"] bwidth = props.border["width"] cellsize = props.cell["size"] bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if side == "normal": context.set_line_width(lwidth) elif border: context.set_line_width(bwidth) if side == "normal": start = -0.5 * lwidth elif side == "outerborder": start = -0.5 * bwidth elif side == "innerborder": start = 0.5 * bwidth if not grid.is_available(x, y + 1) or not grid.is_available(x, y): start -= lwidth if ltype == "left": render_line(context, props, sx + start, sy, 0, cellsize, bar, border) elif ltype == "top": rx = sx ry = sy + start rdx = cellsize def get_delta(x, y, side_no_extend, side_extend): """ Determine the delta in pixels. The delta is at least the normal line width. """ if ((x, y, "left", side_no_extend) in lines or (x, y - 1, "left", side_no_extend) in lines): return False, props.line["width"] if ((x, y, "left", "normal") in lines or (x, y - 1, "left", "normal") in lines): return False, props.line["width"] if ((x, y, "left", side_extend) in lines or (x, y - 1, "left", side_extend) in lines): return True, 0 return False, 0 is_lb, dxl = get_delta(x, y, "innerborder", "outerborder") is_rb, dxr = get_delta(x + 1, y, "outerborder", "innerborder") # adjust horizontal lines to fill empty spaces in corners rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) if is_lb: rx -= bwidth render_line(context, props, rx, ry, bwidth, 0, False, True) if is_rb: rx += (cellsize + dxl) render_line(context, props, rx, ry, bwidth, 0, False, True)
|
def render(context, grid, props): lines = grid.get_lines(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) lwidth = props.line["width"] bwidth = props.border["width"] cellsize = props.cell["size"] bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if side == "normal": context.set_line_width(lwidth) elif border: context.set_line_width(bwidth) if side == "normal": start = -0.5 * lwidth elif side == "outerborder": start = -0.5 * bwidth elif side == "innerborder": start = 0.5 * bwidth if ltype == "top": bdx, bdy = 0, 1 elif ltype == "left": bdx, bdy = 1, 0 if not grid.is_available(x + bdx, y + bdy) or not grid.is_available(x, y): start -= lwidth if ltype == "left": render_line(context, props, sx + start, sy, 0, cellsize, bar, border) elif ltype == "top": rx = sx ry = sy + start rdx = cellsize def get_delta(x, y, side_no_extend, side_extend): """ Determine the delta in pixels. The delta is at least the normal line width. """ if ((x, y, "left", side_no_extend) in lines or (x, y - 1, "left", side_no_extend) in lines): return False, props.line["width"] if ((x, y, "left", "normal") in lines or (x, y - 1, "left", "normal") in lines): return False, props.line["width"] if ((x, y, "left", side_extend) in lines or (x, y - 1, "left", side_extend) in lines): return True, 0 return False, 0 is_lb, dxl = get_delta(x, y, "innerborder", "outerborder") is_rb, dxr = get_delta(x + 1, y, "outerborder", "innerborder") # adjust horizontal lines to fill empty spaces in corners rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) if is_lb: rx -= bwidth render_line(context, props, rx, ry, bwidth, 0, False, True) if is_rb: rx += (cellsize + dxl) render_line(context, props, rx, ry, bwidth, 0, False, True)
| 480,188 |
def parse_grid_size(attr, name): try: dim = int(element.get(attr)) if dim < 3: msg = name + u" attribute of grid must be at least 3." raise PalabraParserError(msg) return int(dim) except TypeError, ValueError: msg = name + u" attribute of grid not or incorrectly specified." raise PalabraParserError(msg)
|
def parse_grid_size(attr, name): try: dim = int(element.get(attr)) if dim < 3: msg = name + u" attribute of grid must be at least 3." raise PalabraParserError(msg) return dim except TypeError, ValueError: msg = name + u" attribute of grid not or incorrectly specified." raise PalabraParserError(msg)
| 480,189 |
def render(context, grid, props): context.set_line_width(props.line["width"]) lines = grid.lines_of_cell(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if ltype == "top": rx = sx if side == "normal": context.set_line_width(props.line["width"]) ry = sy - 0.5 * props.line["width"] rdx = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": ry = sy - 0.5 * props.border["width"] elif side == "innerborder": ry = sy + 0.5 * props.border["width"] if not grid.is_available(x, y): ry -= props.line["width"] rdx = props.cell["size"] # adjust horizontal lines to fill empty spaces in corners dxl, dxr = get_adjustments(lines, props, x, y) rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) elif ltype == "left": if side == "normal": context.set_line_width(props.line["width"]) rx = sx - 0.5 * props.line["width"] rdy = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": rx = sx - 0.5 * props.border["width"] elif side == "innerborder": rx = sx + 0.5 * props.border["width"] if not grid.is_available(x, y): rx -= props.line["width"] rdy = props.cell["size"] render_line(context, props, rx, sy, 0, rdy, bar, border)
|
def render(context, grid, props): context.set_line_width(props.line["width"]) lines = grid.lines_of_cell(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if ltype == "top": rx = sx if side == "normal": context.set_line_width(props.line["width"]) ry = sy - 0.5 * props.line["width"] rdx = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": ry = sy - 0.5 * props.border["width"] elif side == "innerborder": ry = sy + 0.5 * props.border["width"] if not grid.is_available(x, y + 1): ry -= props.line["width"] rdx = props.cell["size"] # adjust horizontal lines to fill empty spaces in corners dxl, dxr = get_adjustments(lines, props, x, y) rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) elif ltype == "left": if side == "normal": context.set_line_width(props.line["width"]) rx = sx - 0.5 * props.line["width"] rdy = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": rx = sx - 0.5 * props.border["width"] elif side == "innerborder": rx = sx + 0.5 * props.border["width"] if not grid.is_available(x, y + 1): rx -= props.line["width"] rdy = props.cell["size"] render_line(context, props, rx, sy, 0, rdy, bar, border)
| 480,190 |
def render(context, grid, props): context.set_line_width(props.line["width"]) lines = grid.lines_of_cell(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if ltype == "top": rx = sx if side == "normal": context.set_line_width(props.line["width"]) ry = sy - 0.5 * props.line["width"] rdx = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": ry = sy - 0.5 * props.border["width"] elif side == "innerborder": ry = sy + 0.5 * props.border["width"] if not grid.is_available(x, y): ry -= props.line["width"] rdx = props.cell["size"] # adjust horizontal lines to fill empty spaces in corners dxl, dxr = get_adjustments(lines, props, x, y) rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) elif ltype == "left": if side == "normal": context.set_line_width(props.line["width"]) rx = sx - 0.5 * props.line["width"] rdy = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": rx = sx - 0.5 * props.border["width"] elif side == "innerborder": rx = sx + 0.5 * props.border["width"] if not grid.is_available(x, y): rx -= props.line["width"] rdy = props.cell["size"] render_line(context, props, rx, sy, 0, rdy, bar, border)
|
def render(context, grid, props): context.set_line_width(props.line["width"]) lines = grid.lines_of_cell(x, y) for p, q, ltype, side in lines: sx = props.grid_to_screen_x(p, False) sy = props.grid_to_screen_y(q, False) bar = grid.is_valid(x, y) and grid.has_bar(x, y, ltype) border = "border" in side if ltype == "top": rx = sx if side == "normal": context.set_line_width(props.line["width"]) ry = sy - 0.5 * props.line["width"] rdx = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": ry = sy - 0.5 * props.border["width"] elif side == "innerborder": ry = sy + 0.5 * props.border["width"] if not grid.is_available(x + 1, y): ry -= props.line["width"] rdx = props.cell["size"] # adjust horizontal lines to fill empty spaces in corners dxl, dxr = get_adjustments(lines, props, x, y) rx -= dxl rdx += dxl rdx += dxr render_line(context, props, rx, ry, rdx, 0, bar, border) elif ltype == "left": if side == "normal": context.set_line_width(props.line["width"]) rx = sx - 0.5 * props.line["width"] rdy = props.cell["size"] elif border: context.set_line_width(props.border["width"]) if side == "outerborder": rx = sx - 0.5 * props.border["width"] elif side == "innerborder": rx = sx + 0.5 * props.border["width"] if not grid.is_available(x + 1, y): rx -= props.line["width"] rdy = props.cell["size"] render_line(context, props, rx, sy, 0, rdy, bar, border)
| 480,191 |
def modify_chars(puzzle, chars): modify_chars.__setattr__('type', constants.TRANSFORM_CONTENT) """Modify the characters at the given locations.""" for x, y, c in chars: puzzle.grid.set_char(x, y, c)
|
def modify_chars(puzzle, chars): modify_chars.__setattr__('type', constants.TRANSFORM_STRUCTURE) """Modify the characters at the given locations.""" for x, y, c in chars: puzzle.grid.set_char(x, y, c)
| 480,192 |
def write_pattern_file(filename, metadata, contents): root = etree.Element("palabra") root.set("version", constants.VERSION) container = etree.SubElement(root, "container") container.set("content", "grid") _write_metadata(container, metadata) for i, (j, grid) in enumerate(contents.items()): _write_grid(container, grid, str(i)) contents = etree.tostring(root, xml_declaration=True, encoding="UTF-8") f = open(filename, "w") f.write(contents) f.close()
|
def write_pattern_file(filename, metadata, contents): root = etree.Element("palabra") root.set("version", constants.VERSION) container = etree.SubElement(root, "container") container.set("content", "grid") _write_metadata(container, metadata) for i, (j, grid) in enumerate(contents.items(), start=1): _write_grid(container, grid, str(i)) contents = etree.tostring(root, xml_declaration=True, encoding="UTF-8") f = open(filename, "w") f.write(contents) f.close()
| 480,193 |
def remove_word_list(self): store, it = self.tree.get_selection().get_selected() name = self.store.get_value(it, 0) nextprefs = [p for p in preferences.prefs["word_files"] if p["name"]["value"] != name] preferences.prefs["word_files"] = nextprefs self.palabra_window.wordlists = create_wordlists(preferences.prefs["word_files"]) self.palabra_window.editor.refresh_words(True) self._load_wordlists()
|
def remove_word_list(self): store, it = self.tree.get_selection().get_selected() name = self.store.get_value(it, 0) nextprefs = [p for p in preferences.prefs["word_files"] if p["name"]["value"] != name] preferences.prefs["word_files"] = nextprefs self.palabra_window.wordlists = create_wordlists(preferences.prefs["word_files"]) try: self.palabra_window.editor.refresh_words(True) except AttributeError: pass self._load_wordlists()
| 480,194 |
if self.grid.word_length(x, y, d) == 2:def render_all_lines_of_cell(self, context, x, y):
|
if self.grid.word_length(x, y, d) == 2:def render_all_lines_of_cell(self, context, x, y):
| 480,195 |
def process_row(direction, row): n = row[0] x = row[1] y = row[2] word = row[3] clue = row[4] explanation = row[5] display = self.create_display_string(n, direction, word, clue) return (n, x, y, direction, word, clue, explanation, display)
|
def process_row(direction, row): n = row[0] x = row[1] y = row[2] word = row[3] clue = row[4] explanation = row[5] display = self.create_display_string(n, direction, word, clue) return (n, x, y, direction, word, clue, explanation, display)
| 480,196 |
def create_statistic(table, title, value, x, y): label = gtk.Label(title) label.set_alignment(0, 0) table.attach(label, x, x + 1, y, y + 1) label = gtk.Label(value) label.set_alignment(1, 0) table.attach(label, x + 1, x + 2, y, y + 1)
|
def create_statistic(table, title, value, x, y): label = gtk.Label(title) label.set_alignment(0, 0) table.attach(label, x, x + 1, y, y + 1) label = gtk.Label(value) label.set_alignment(1, 0) table.attach(label, x + 1, x + 2, y, y + 1)
| 480,197 |
def show_error(title, message): mdialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL , gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, message) mdialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) mdialog.set_title(title) mdialog.run() mdialog.destroy()
|
def show_error(title, message): mdialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL , gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, message) mdialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) mdialog.set_title(title) mdialog.run() mdialog.destroy()
| 480,198 |
def __init__(self, palabra_window): gtk.Dialog.__init__(self, u"Pattern file manager" , palabra_window, gtk.DIALOG_MODAL) self.palabra_window = palabra_window self.set_size_request(640, 512) self.preview = GridPreview() self.preview.set_size_request(200, 256) self.patterns = {} # display_string filename id_of_grid self.store = gtk.TreeStore(str, str, str) self.reset_pattern_list() self.tree = gtk.TreeView(self.store) self.tree.set_headers_visible(False) self.tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.tree.get_selection().connect("changed", self.on_selection_changed) cell = gtk.CellRendererText() column = gtk.TreeViewColumn() column.pack_start(cell, True) column.set_attributes(cell, text=0) self.tree.append_column(column) right_vbox = gtk.VBox(False, 6) label = gtk.Label() label.set_markup(u"<b>Options for pattern files</b>") align = gtk.Alignment(0, 0.5) align.add(label) right_vbox.pack_start(align, False, False, 0) add_button = gtk.Button(stock=gtk.STOCK_ADD) add_button.connect("clicked", lambda button: self.add_file()) align = add_button.get_children()[0] hbox = align.get_children()[0] image, label = hbox.get_children() label.set_text(u"Add pattern file"); right_vbox.pack_start(add_button, False, False, 0) self.remove_button = gtk.Button(stock=gtk.STOCK_REMOVE) self.remove_button.connect("clicked", lambda button: self.remove_file()) self.remove_button.set_sensitive(False) align = self.remove_button.get_children()[0] hbox = align.get_children()[0] image, label = hbox.get_children() label.set_text(u"Remove pattern file(s)"); right_vbox.pack_start(self.remove_button, False, False, 0)
|
def __init__(self, palabra_window): gtk.Dialog.__init__(self, u"Pattern file manager" , palabra_window, gtk.DIALOG_MODAL) self.palabra_window = palabra_window self.set_size_request(640, 512) self.preview = GridPreview() self.preview.set_size_request(200, 256) self.patterns = {} # display_string filename id_of_grid self.store = gtk.TreeStore(str, str, str) self.reset_pattern_list() self.tree = gtk.TreeView(self.store) self.tree.set_headers_visible(False) self.tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.tree.get_selection().connect("changed", self.on_selection_changed) cell = gtk.CellRendererText() column = gtk.TreeViewColumn() column.pack_start(cell, True) column.set_attributes(cell, text=0) self.tree.append_column(column) right_vbox = gtk.VBox(False, 6) label = gtk.Label() label.set_markup(u"<b>Options for pattern files</b>") align = gtk.Alignment(0, 0.5) align.add(label) right_vbox.pack_start(align, False, False, 0) add_button = gtk.Button(stock=gtk.STOCK_ADD) add_button.connect("clicked", lambda button: self.add_file()) align = add_button.get_children()[0] hbox = align.get_children()[0] image, label = hbox.get_children() label.set_text(u"Add pattern file"); right_vbox.pack_start(add_button, False, False, 0) self.remove_button = gtk.Button(stock=gtk.STOCK_REMOVE) self.remove_button.connect("clicked", lambda button: self.remove_file()) self.remove_button.set_sensitive(False) align = self.remove_button.get_children()[0] hbox = align.get_children()[0] image, label = hbox.get_children() label.set_text(u"Remove pattern file(s)"); right_vbox.pack_start(self.remove_button, False, False, 0)
| 480,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.