Beispiel #1
0
class ImagePrefs(QDialog):
    def __init__(self, res, *args, **kwargs):
        QDialog.__init__(self, *args, **kwargs)
        self.app = QApplication.instance()
        self.res = res
        self.ui = Ui_ImageDialog()
        self.ui.setupUi(self)
        self.setWindowIcon(get_icon())
        self.ui.widthBox.setValue(self.res.w)
        self.ui.heightBox.setValue(self.res.h)
        self.ui.widthBox.valueChanged.connect(self.width_changed)
        self.ui.heightBox.valueChanged.connect(self.height_changed)
        self._auto_change = False

    def get_size(self):
        return self.ui.widthBox.value(), self.ui.heightBox.value()

    @Slot()
    def width_changed(self):
        if self.ui.checkBox.isChecked() and not self._auto_change:
            self._auto_change = True
            self.ui.heightBox.setValue(
                self.ui.widthBox.value() * self.res.h / self.res.w, )
        else:
            self._auto_change = False

    @Slot()
    def height_changed(self):
        if self.ui.checkBox.isChecked() and not self._auto_change:
            self._auto_change = True
            self.ui.widthBox.setValue(
                self.ui.heightBox.value() * self.res.w / self.res.h, )
        else:
            self._auto_change = False
Beispiel #2
0
class ImagePrefs(QDialog):
    def __init__(self, app, res, *args, **kwargs):
        QDialog.__init__(self, *args, **kwargs)
        self.app = app
        self.res = res
        self.ui = Ui_ImageDialog()
        self.ui.setupUi(self)
        self.setWindowIcon(get_icon())
        self.ui.widthBox.setValue(self.res.w)
        self.ui.heightBox.setValue(self.res.h)
        self.ui.widthBox.valueChanged.connect(self.width_changed)
        self.ui.heightBox.valueChanged.connect(self.height_changed)
        self._auto_change = False

    def get_size(self):
        return self.ui.widthBox.value(), self.ui.heightBox.value()

    @Slot()
    def width_changed(self):
        if self.ui.checkBox.isChecked() and not self._auto_change:
            self._auto_change = True
            self.ui.heightBox.setValue(self.ui.widthBox.value() * self.res.h / self.res.w)
        else:
            self._auto_change = False

    @Slot()
    def height_changed(self):
        if self.ui.checkBox.isChecked() and not self._auto_change:
            self._auto_change = True
            self.ui.widthBox.setValue(self.ui.heightBox.value() * self.res.w / self.res.h)
        else:
            self._auto_change = False
Beispiel #3
0
 def __init__(self, res, *args, **kwargs):
     QDialog.__init__(self, *args, **kwargs)
     self.app = QApplication.instance()
     self.res = res
     self.ui = Ui_ImageDialog()
     self.ui.setupUi(self)
     self.setWindowIcon(get_icon())
     self.ui.widthBox.setValue(self.res.w)
     self.ui.heightBox.setValue(self.res.h)
     self.ui.widthBox.valueChanged.connect(self.width_changed)
     self.ui.heightBox.valueChanged.connect(self.height_changed)
     self._auto_change = False
Beispiel #4
0
 def __init__(self, app, res, *args, **kwargs):
     QDialog.__init__(self, *args, **kwargs)
     self.app = app
     self.res = res
     self.ui = Ui_ImageDialog()
     self.ui.setupUi(self)
     self.setWindowIcon(get_icon())
     self.ui.widthBox.setValue(self.res.w)
     self.ui.heightBox.setValue(self.res.h)
     self.ui.widthBox.valueChanged.connect(self.width_changed)
     self.ui.heightBox.valueChanged.connect(self.height_changed)
     self._auto_change = False