IconEditor/IconEditorGrid.py

changeset 2334
fc69ad77e18a
parent 2302
f29e9405c851
child 2404
cba0ff902c2b
equal deleted inserted replaced
2331:9e623311630d 2334:fc69ad77e18a
71 @signal imageChanged(bool) emitted after the image was modified 71 @signal imageChanged(bool) emitted after the image was modified
72 @signal positionChanged(int, int) emitted after the cursor poition was changed 72 @signal positionChanged(int, int) emitted after the cursor poition was changed
73 @signal previewChanged(QPixmap) emitted to signal a new preview pixmap 73 @signal previewChanged(QPixmap) emitted to signal a new preview pixmap
74 @signal selectionAvailable(bool) emitted to signal a change of the selection 74 @signal selectionAvailable(bool) emitted to signal a change of the selection
75 @signal sizeChanged(int, int) emitted after the size has been changed 75 @signal sizeChanged(int, int) emitted after the size has been changed
76 @signal zoomChanged(int) emitted to signal a change of the zoom value
76 """ 77 """
77 canRedoChanged = pyqtSignal(bool) 78 canRedoChanged = pyqtSignal(bool)
78 canUndoChanged = pyqtSignal(bool) 79 canUndoChanged = pyqtSignal(bool)
79 clipboardImageAvailable = pyqtSignal(bool) 80 clipboardImageAvailable = pyqtSignal(bool)
80 colorChanged = pyqtSignal(QColor) 81 colorChanged = pyqtSignal(QColor)
81 imageChanged = pyqtSignal(bool) 82 imageChanged = pyqtSignal(bool)
82 positionChanged = pyqtSignal(int, int) 83 positionChanged = pyqtSignal(int, int)
83 previewChanged = pyqtSignal(QPixmap) 84 previewChanged = pyqtSignal(QPixmap)
84 selectionAvailable = pyqtSignal(bool) 85 selectionAvailable = pyqtSignal(bool)
85 sizeChanged = pyqtSignal(int, int) 86 sizeChanged = pyqtSignal(int, int)
87 zoomChanged = pyqtSignal(int)
86 88
87 Pencil = 1 89 Pencil = 1
88 Rubber = 2 90 Rubber = 2
89 Line = 3 91 Line = 3
90 Rectangle = 4 92 Rectangle = 4
99 RectangleSelection = 20 101 RectangleSelection = 20
100 CircleSelection = 21 102 CircleSelection = 21
101 103
102 MarkColor = QColor(255, 255, 255, 255) 104 MarkColor = QColor(255, 255, 255, 255)
103 NoMarkColor = QColor(0, 0, 0, 0) 105 NoMarkColor = QColor(0, 0, 0, 0)
106
107 ZoomMinimum = 100
108 ZoomMaximum = 10000
109 ZoomStep = 100
110 ZoomDefault = 1200
111 ZoomPercent = True
104 112
105 def __init__(self, parent=None): 113 def __init__(self, parent=None):
106 """ 114 """
107 Constructor 115 Constructor
108 116
350 """ 358 """
351 return self.__image.width(), self.__image.height() 359 return self.__image.width(), self.__image.height()
352 360
353 def setZoomFactor(self, newZoom): 361 def setZoomFactor(self, newZoom):
354 """ 362 """
355 Public method to set the zoom factor. 363 Public method to set the zoom factor in percent.
356 364
357 @param newZoom zoom factor (integer >= 1) 365 @param newZoom zoom factor (integer >= 100)
358 """ 366 """
359 newZoom = max(1, newZoom) # must not be less than 1 367 newZoom = max(100, newZoom) # must not be less than 100
360 if newZoom != self.__zoom: 368 if newZoom != self.__zoom:
361 self.__zoom = newZoom 369 self.__zoom = newZoom // 100
362 self.update() 370 self.update()
363 self.updateGeometry() 371 self.updateGeometry()
364 self.resize(self.sizeHint()) 372 self.resize(self.sizeHint())
373 self.zoomChanged.emit(int(self.__zoom * 100))
365 374
366 def zoomFactor(self): 375 def zoomFactor(self):
367 """ 376 """
368 Public method to get the current zoom factor. 377 Public method to get the current zoom factor in percent.
369 378
370 @return zoom factor (integer) 379 @return zoom factor (integer)
371 """ 380 """
372 return self.__zoom 381 return self.__zoom * 100
373 382
374 def setGridEnabled(self, enable): 383 def setGridEnabled(self, enable):
375 """ 384 """
376 Public method to enable the display of grid lines. 385 Public method to enable the display of grid lines.
377 386

eric ide

mercurial