| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
from gi.repository import Gtk |
| 19 |
from .abstract_optionsbar import AbstractOptionsBar |
| 20 |
from .utilities_units import utilities_add_unit_to_spinbtn |
| 21 |
|
| 22 |
class OptionsBarCrop(AbstractOptionsBar): |
| 23 |
__gtype_name__ = 'OptionsBarCrop' |
| 24 |
|
| 25 |
def __init__(self): |
| 26 |
super().__init__() |
| 27 |
|
| 28 |
self._build_ui('transform/abstract-optionsbar-transform.ui') |
| 29 |
builder = self._hydrate_transform_tool('transform/optionsbar-crop.ui') |
| 30 |
|
| 31 |
self.height_btn = builder.get_object('height_btn') |
| 32 |
self.width_btn = builder.get_object('width_btn') |
| 33 |
utilities_add_unit_to_spinbtn(self.height_btn, 4, 'px') |
| 34 |
utilities_add_unit_to_spinbtn(self.width_btn, 4, 'px') |
| 35 |
|
| 36 |
|
| 37 |
self.width_label = builder.get_object('width_label') |
| 38 |
self.height_label = builder.get_object('height_label') |
| 39 |
self.separator = builder.get_object('separator') |
| 40 |
|
| 41 |
def init_adaptability(self): |
| 42 |
super().init_adaptability() |
| 43 |
temp_limit_size = self.centered_box.get_preferred_width()[0] + \ |
| 44 |
self.cancel_btn.get_preferred_width()[0] + \ |
| 45 |
self.options_btn.get_preferred_width()[0] + \ |
| 46 |
self.help_btn.get_preferred_width()[0] + \ |
| 47 |
self.apply_btn.get_preferred_width()[0] |
| 48 |
self._set_limit_size(temp_limit_size) |
| 49 |
|
| 50 |
def set_compact(self, state): |
| 51 |
super().set_compact(state) |
| 52 |
if state: |
| 53 |
self.centered_box.set_orientation(Gtk.Orientation.VERTICAL) |
| 54 |
else: |
| 55 |
self.centered_box.set_orientation(Gtk.Orientation.HORIZONTAL) |
| 56 |
self.width_label.set_visible(not state) |
| 57 |
self.height_label.set_visible(not state) |
| 58 |
self.separator.set_visible(not state) |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|