Exemplo n.º 1
0
    def create_layout(self):
        layout = QtWidgets.QVBoxLayout()

        upper_toolbar = QtWidgets.QHBoxLayout()
        self.add_format_box(upper_toolbar)
        self.add_size_boxes(upper_toolbar)
        upper_toolbar.addStretch()
        self.add_flip_checkbox(upper_toolbar)
        self.add_brightness_box(upper_toolbar)

        lower_toolbar = QtWidgets.QHBoxLayout()
        self.add_address_label(lower_toolbar)
        lower_toolbar.addStretch()
        self.add_goto_button(lower_toolbar)
        self.add_redraw_button(lower_toolbar)
        self.add_save_button(lower_toolbar)

        self.image_label = QtWidgets.QLabel()
        self.image_label.setAlignment(QtCore.Qt.AlignCenter)
        scroll_area = QtWidgets.QScrollArea()
        scroll_area.setWidget(self.image_label)
        scroll_area.setWidgetResizable(True)
        layout.addLayout(upper_toolbar)
        layout.addWidget(scroll_area)
        layout.addLayout(lower_toolbar)

        return layout
Exemplo n.º 2
0
 def add_brightness_box(self, layout):
     layout.addWidget(QtWidgets.QLabel('Brightness:'))
     self.brightness_box = QtWidgets.QDoubleSpinBox()
     self.brightness_box.setMinimum(0.0)
     self.brightness_box.setMaximum(100.0)
     self.brightness_box.valueChanged.connect(self.brightness_changed)
     layout.addWidget(self.brightness_box)
Exemplo n.º 3
0
 def add_size_boxes(self, layout):
     self.width_box = QtWidgets.QSpinBox()
     self.width_box.setMinimum(1)
     self.width_box.setMaximum(4096)
     self.width_box.valueChanged.connect(self.width_changed)
     layout.addWidget(self.width_box)
     layout.addWidget(QtWidgets.QLabel('x'))
     self.height_box = QtWidgets.QSpinBox()
     self.height_box.setMinimum(1)
     self.height_box.setMaximum(4096)
     self.height_box.valueChanged.connect(self.height_changed)
     layout.addWidget(self.height_box)
Exemplo n.º 4
0
 def add_save_button(self, layout):
     save_button = QtWidgets.QPushButton('&Save...')
     save_button.clicked.connect(self.save)
     layout.addWidget(save_button)
Exemplo n.º 5
0
 def add_address_label(self, layout):
     address_label1 = QtWidgets.QLabel('Address:')
     address_label2 = QtWidgets.QLabel('...')
     layout.addWidget(address_label1)
     layout.addWidget(address_label2)
     self.address_label = address_label2
Exemplo n.º 6
0
 def add_goto_button(self, layout):
     goto_button = QtWidgets.QPushButton('&Go to... [G]')
     goto_button.setDefault(True)
     goto_button.clicked.connect(self.change_address)
     layout.addWidget(goto_button)
Exemplo n.º 7
0
 def add_flip_checkbox(self, layout):
     self.flip_checkbox = QtWidgets.QCheckBox()
     self.flip_checkbox.stateChanged.connect(self.flip_changed)
     self.flip_checkbox.setText('Flip vertically')
     layout.addWidget(self.flip_checkbox)
Exemplo n.º 8
0
 def add_format_box(self, layout):
     self.format_box = QtWidgets.QComboBox()
     for key, text in PixelFormats.get_long_names().items():
         self.format_box.addItem(text, key)
     self.format_box.currentIndexChanged.connect(self.format_changed)
     layout.addWidget(self.format_box)
Exemplo n.º 9
0
 def define_shortcut(self, shortcut, widget, func):
     # pylint: disable=unnecessary-lambda
     # shortcuts don't get triggered if the func isn't wrapped in a lambda
     QtWidgets.QShortcut(QtGui.QKeySequence(shortcut), widget,
                         lambda: func())
Exemplo n.º 10
0
 def add_redraw_button(self, layout):
     redraw_button = QtWidgets.QPushButton('&Redraw')
     redraw_button.clicked.connect(self.draw)
     layout.addWidget(redraw_button)
Exemplo n.º 11
0
 def add_address_label(self, layout):
     layout.addWidget(QtWidgets.QLabel("Address:"))
     self.address_label = QtWidgets.QLabel("...")
     self.size_label = QtWidgets.QLabel("...")
     layout.addWidget(self.address_label)
     layout.addWidget(self.size_label)