Exemplo n.º 1
0
class BeeScaleImageDialog(qtgui.QDialog):
	def __init__(self,parent,width,height):
		qtgui.QDialog.__init__(self,parent)
		self.ui=Ui_CanvasScaleDialog()
		self.ui.setupUi(self)

		self.ratiolock=False

		self.startwidth=width
		self.startheight=height

		self.curwidth=width
		self.curheight=width

		self.ui.width_spin_box.setValue(width)
		self.ui.height_spin_box.setValue(height)

	def on_width_spin_box_editingFinished(self):
		newval=self.ui.width_spin_box.value()
		if self.ratiolock and newval and newval != self.curwidth:
			self.curheight=(newval*self.startheight)/self.startwidth
			self.ui.height_spin_box.setValue(self.curheight)

		self.curwidth=newval

	def on_height_spin_box_editingFinished(self):
		newval=self.ui.height_spin_box.value()
		if self.ratiolock and newval and newval != self.curheight:
			self.curwidth=(newval*self.startwidth)/self.startheight
			self.ui.width_spin_box.setValue(self.curwidth)

		self.curheight=newval

	def on_lock_ratio_checkBox_toggled(self,val):
		self.ratiolock=val
		if self.ratiolock:
			self.curheight=(self.curwidth*self.startheight)/self.startwidth
			self.ui.height_spin_box.setValue(self.curheight)
Exemplo n.º 2
0
	def __init__(self,parent,width,height):
		qtgui.QDialog.__init__(self,parent)
		self.ui=Ui_CanvasScaleDialog()
		self.ui.setupUi(self)

		self.ratiolock=False

		self.startwidth=width
		self.startheight=height

		self.curwidth=width
		self.curheight=width

		self.ui.width_spin_box.setValue(width)
		self.ui.height_spin_box.setValue(height)