Exemple #1
0
	def addMouseToolsBind( self ):
		"Add the mouse tool and bind button one clicked, button one released and motion."
		self.xScrollbar.config( command = self.relayXview )
		self.yScrollbar.config( command = self.relayYview )
		self.canvas[ 'xscrollcommand' ] = self.xScrollbar.set
		self.canvas[ 'yscrollcommand' ] = self.yScrollbar.set
		settings.CloseListener( self, self.destroyAllDialogWindows ).listenToWidget( self.canvas )
		self.canvasScreenCenter = 0.5 * complex( float( self.canvasWidth ) / float( self.screenSize.real ), float( self.canvasHeight ) / float( self.screenSize.imag ) )
		self.addPhotoImage( 'stop.ppm', self.gridPosition )
		self.gridPosition.increment()
		self.addLayer( getGridHorizontalFrame( self.gridPosition ) )
		self.gridPosition.increment()
		self.addLine( getGridHorizontalFrame( self.gridPosition ) )
		self.gridPosition.increment()
		self.addScale( getGridHorizontalFrame( self.gridPosition ) )
		self.gridPosition = settings.GridVertical( self.gridPosition.columnStart + 1, self.gridPosition.row )
		self.gridPosition.master = self.root
		for name in self.repository.frameList.value:
			entity = self.getEntityFromName( name )
			if entity != None:
				self.gridPosition.incrementGivenNumberOfColumns( 3 )
				entity.addToDialog( getGridHorizontalFrame( self.gridPosition ) )
		for menuRadio in self.repository.mouseMode.menuRadios:
			menuRadio.mouseTool = menuRadio.getNewMouseToolFunction().getReset( self )
			self.mouseTool = menuRadio.mouseTool
		self.createMouseModeTool()
		self.canvas.bind( '<Button-1>', self.button1 )
		self.canvas.bind( '<ButtonRelease-1>', self.buttonRelease1 )
		self.canvas.bind( '<KeyPress-Down>', self.keyPressDown )
		self.canvas.bind( '<KeyPress-Left>', self.keyPressLeft )
		self.canvas.bind( '<KeyPress-Right>', self.keyPressRight )
		self.canvas.bind( '<KeyPress-Up>', self.keyPressUp )
		self.canvas.bind( '<Motion>', self.motion )
		self.canvas.bind( '<Return>', self.keyPressReturn )
		self.canvas.bind( '<Shift-ButtonRelease-1>', self.shiftButtonRelease1 )
		self.canvas.bind( '<Shift-Motion>', self.shiftMotion )
		self.layerEntry.bind( '<Destroy>', self.cancelTimer )
		self.root.grid_columnconfigure( 44, weight = 1 )
		self.root.grid_rowconfigure( 44, weight = 1 )
		self.resetPeriodicButtonsText()
		self.repository.animationLineQuickening.setUpdateFunction( self.repository.setToDisplaySave )
		self.repository.animationSlideShowRate.setUpdateFunction( self.repository.setToDisplaySave )
		self.repository.screenHorizontalInset.setUpdateFunction( self.redisplayWindowUpdate )
		self.repository.screenVerticalInset.setUpdateFunction( self.redisplayWindowUpdate )
		rankZeroSeperation = self.getRulingSeparationWidthPixels( 0 )
		zoom = self.rulingTargetSeparation / rankZeroSeperation
		self.rank = euclidean.getRank( zoom )
		rankTop = self.rank + 1
		seperationBottom = self.getRulingSeparationWidthPixels( self.rank )
		seperationTop = self.getRulingSeparationWidthPixels( rankTop )
		bottomDifference = getGeometricDifference( self.rulingTargetSeparation, seperationBottom )
		topDifference = getGeometricDifference( self.rulingTargetSeparation, seperationTop )
		if topDifference < bottomDifference:
			self.rank = rankTop
		self.rulingSeparationWidthMillimeters = euclidean.getIncrementFromRank( self.rank )
		self.canvas.focus_set()
Exemple #2
0
 def getRulingSeparationWidthPixels(self, rank):
     "Get the separation width in pixels."
     return euclidean.getIncrementFromRank(rank) * self.skein.scale
Exemple #3
0
 def addMouseToolsBind(self):
     "Add the mouse tool and bind button one clicked, button one released and motion."
     self.xScrollbar.config(command=self.relayXview)
     self.yScrollbar.config(command=self.relayYview)
     self.canvas['xscrollcommand'] = self.xScrollbar.set
     self.canvas['yscrollcommand'] = self.yScrollbar.set
     settings.CloseListener(
         self, self.destroyAllDialogWindows).listenToWidget(self.canvas)
     self.canvasScreenCenter = 0.5 * complex(
         float(self.canvasWidth) / float(self.screenSize.real),
         float(self.canvasHeight) / float(self.screenSize.imag))
     self.addPhotoImage('stop.ppm', self.gridPosition)
     self.gridPosition.increment()
     self.addLayer(getGridHorizontalFrame(self.gridPosition))
     self.gridPosition.increment()
     self.addLine(getGridHorizontalFrame(self.gridPosition))
     self.gridPosition.increment()
     self.addScale(getGridHorizontalFrame(self.gridPosition))
     self.gridPosition = settings.GridVertical(
         self.gridPosition.columnStart + 1, self.gridPosition.row)
     self.gridPosition.master = self.root
     for name in self.repository.frameList.value:
         entity = self.getEntityFromName(name)
         if entity != None:
             self.gridPosition.incrementGivenNumberOfColumns(3)
             entity.addToDialog(getGridHorizontalFrame(self.gridPosition))
     for menuRadio in self.repository.mouseMode.menuRadios:
         menuRadio.mouseTool = menuRadio.getNewMouseToolFunction().getReset(
             self)
         self.mouseTool = menuRadio.mouseTool
     self.createMouseModeTool()
     self.canvas.bind('<Button-1>', self.button1)
     self.canvas.bind('<ButtonRelease-1>', self.buttonRelease1)
     self.canvas.bind('<KeyPress-Down>', self.keyPressDown)
     self.canvas.bind('<KeyPress-Left>', self.keyPressLeft)
     self.canvas.bind('<KeyPress-Right>', self.keyPressRight)
     self.canvas.bind('<KeyPress-Up>', self.keyPressUp)
     self.canvas.bind('<Motion>', self.motion)
     self.canvas.bind('<Return>', self.keyPressReturn)
     self.canvas.bind('<Shift-ButtonRelease-1>', self.shiftButtonRelease1)
     self.canvas.bind('<Shift-Motion>', self.shiftMotion)
     self.layerEntry.bind('<Destroy>', self.cancelTimer)
     self.root.grid_columnconfigure(44, weight=1)
     self.root.grid_rowconfigure(44, weight=1)
     self.resetPeriodicButtonsText()
     self.repository.animationLineQuickening.setUpdateFunction(
         self.repository.setToDisplaySave)
     self.repository.animationSlideShowRate.setUpdateFunction(
         self.repository.setToDisplaySave)
     self.repository.screenHorizontalInset.setUpdateFunction(
         self.redisplayWindowUpdate)
     self.repository.screenVerticalInset.setUpdateFunction(
         self.redisplayWindowUpdate)
     rankZeroSeperation = self.getRulingSeparationWidthPixels(0)
     zoom = self.rulingTargetSeparation / rankZeroSeperation
     self.rank = euclidean.getRank(zoom)
     rankTop = self.rank + 1
     seperationBottom = self.getRulingSeparationWidthPixels(self.rank)
     seperationTop = self.getRulingSeparationWidthPixels(rankTop)
     bottomDifference = getGeometricDifference(self.rulingTargetSeparation,
                                               seperationBottom)
     topDifference = getGeometricDifference(self.rulingTargetSeparation,
                                            seperationTop)
     if topDifference < bottomDifference:
         self.rank = rankTop
     self.rulingSeparationWidthMillimeters = euclidean.getIncrementFromRank(
         self.rank)
     self.canvas.focus_set()
Exemple #4
0
	def getRulingSeparationWidthPixels( self, rank ):
		"Get the separation width in pixels."
		return euclidean.getIncrementFromRank( rank ) * self.skein.scale