How to use the photini.pyqt.QtWidgets.QFormLayout function in Photini

To help you get started, we’ve selected a few Photini examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jim-easterbrook / Photini / src / photini / descriptive.py View on Github external
def __init__(self, image_list, *arg, **kw):
        super(TabWidget, self).__init__(*arg, **kw)
        self.config_store = QtWidgets.QApplication.instance().config_store
        self.image_list = image_list
        self.form = QtWidgets.QFormLayout()
        self.setLayout(self.form)
        # construct widgets
        self.widgets = {}
        # title
        self.widgets['title'] = SingleLineEdit(spell_check=True)
        self.widgets['title'].editingFinished.connect(self.new_title)
        self.form.addRow(translate(
            'DescriptiveTab', 'Title / Object Name'), self.widgets['title'])
        # description
        self.widgets['description'] = MultiLineEdit(spell_check=True)
        self.widgets['description'].editingFinished.connect(self.new_description)
        self.form.addRow(translate(
            'DescriptiveTab', 'Description / Caption'), self.widgets['description'])
        # keywords
        self.widgets['keywords'] = KeywordsEditor()
        self.widgets['keywords'].editingFinished.connect(self.new_keywords)
github jim-easterbrook / Photini / src / photini / technical.py View on Github external
def __init__(self, images, *arg, **kw):
        super(NewLensDialog, self).__init__(*arg, **kw)
        self.setWindowTitle(translate('TechnicalTab', 'Photini: define lens'))
        self.setLayout(QtWidgets.QVBoxLayout())
        # main dialog area
        scroll_area = QtWidgets.QScrollArea()
        scroll_area.setWidgetResizable(True)
        self.layout().addWidget(scroll_area)
        panel = QtWidgets.QWidget()
        panel.setLayout(QtWidgets.QFormLayout())
        panel.layout().setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        # ok & cancel buttons
        button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.accept)
        button_box.rejected.connect(self.reject)
        self.layout().addWidget(button_box)
        # model
        self.lens_model = QtWidgets.QLineEdit()
        self.lens_model.setMinimumWidth(
            width_for_text(self.lens_model, 'x' * 35))
        panel.layout().addRow(
            translate('TechnicalTab', 'Model name'), self.lens_model)
        # maker
        self.lens_make = QtWidgets.QLineEdit()
github jim-easterbrook / Photini / src / photini / technical.py View on Github external
date_group.layout().addRow(translate('TechnicalTab', 'Digitised'),
                                   self.date_widget['digitised'])
        date_group.layout().addRow('', self.link_widget['digitised', 'modified'])
        date_group.layout().addRow(translate('TechnicalTab', 'Modified'),
                                   self.date_widget['modified'])
        # offset
        self.offset_widget = OffsetWidget()
        self.offset_widget.apply_offset.connect(self.apply_offset)
        date_group.layout().addRow(
            translate('TechnicalTab', 'Adjust times'), self.offset_widget)
        self.layout().addWidget(date_group)
        # other
        other_group = QtWidgets.QGroupBox(translate('TechnicalTab', 'Other'))
        other_group.setLayout(QtWidgets.QFormLayout())
        other_group.layout().setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        # orientation
        self.widgets['orientation'] = DropdownEdit()
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'normal'), 1)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'rotate -90'), 6)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'rotate +90'), 8)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'rotate 180'), 3)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'reflect left-right'), 2)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'reflect top-bottom'), 4)
        self.widgets['orientation'].add_item(
            translate('TechnicalTab', 'reflect tr-bl'), 5)
github jim-easterbrook / Photini / src / photini / importer.py View on Github external
def __init__(self, image_list, parent=None):
        super(TabWidget, self).__init__(parent)
        app = QtWidgets.QApplication.instance()
        app.aboutToQuit.connect(self.shutdown)
        if gp and app.test_mode:
            self.gp_log = gp.check_result(gp.use_python_logging())
        self.config_store = app.config_store
        self.image_list = image_list
        self.setLayout(QtWidgets.QGridLayout())
        form = QtWidgets.QFormLayout()
        form.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.nm = NameMangler()
        self.file_data = {}
        self.file_list = []
        self.source = None
        self.file_copier = None
        # source selector
        box = QtWidgets.QHBoxLayout()
        box.setContentsMargins(0, 0, 0, 0)
        self.source_selector = QtWidgets.QComboBox()
        self.source_selector.currentIndexChanged.connect(self.new_source)
        box.addWidget(self.source_selector)
        refresh_button = QtWidgets.QPushButton(
            translate('ImporterTab', 'refresh'))
        refresh_button.clicked.connect(self.refresh)
        box.addWidget(refresh_button)
        box.setStretch(0, 1)
github jim-easterbrook / Photini / src / photini / flickr.py View on Github external
date_taken = candidate.metadata.date_taken.datetime
            if date_taken < min_taken_date or date_taken > max_taken_date:
                continue
            candidates.append(candidate)
        if not candidates:
            return None
        rsp = requests.get(photo['url_t'])
        if rsp.status_code == 200:
            flickr_icon = rsp.content
        else:
            logger.error('HTTP error %d (%s)', rsp.status_code, photo['url_t'])
            return None
        # get user to choose matching image file
        dialog = QtWidgets.QDialog(parent=self)
        dialog.setWindowTitle(translate('FlickrTab', 'Select an image'))
        dialog.setLayout(QtWidgets.QFormLayout())
        dialog.layout().setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        pixmap = QtGui.QPixmap()
        pixmap.loadFromData(flickr_icon)
        label = QtWidgets.QLabel()
        label.setPixmap(pixmap)
        dialog.layout().addRow(label, QtWidgets.QLabel(translate(
            'FlickrTab', 'Which image file matches\nthis picture on Flickr?')))
        divider = QtWidgets.QFrame()
        divider.setFrameStyle(QtWidgets.QFrame.HLine)
        dialog.layout().addRow(divider)
        buttons = {}
        for candidate in candidates:
            label = QtWidgets.QLabel()
            pixmap = candidate.image.pixmap()
            if pixmap:
github jim-easterbrook / Photini / src / photini / technical.py View on Github external
def __init__(self, image_list, *arg, **kw):
        super(TabWidget, self).__init__(*arg, **kw)
        self.config_store = QtWidgets.QApplication.instance().config_store
        self.image_list = image_list
        self.setLayout(QtWidgets.QHBoxLayout())
        self.widgets = {}
        self.date_widget = {}
        self.link_widget = {}
        # store lens data in another object
        self.lens_data = LensData()
        # date and time
        date_group = QtWidgets.QGroupBox(
            translate('TechnicalTab', 'Date and time'))
        date_group.setLayout(QtWidgets.QFormLayout())
        # create date and link widgets
        for master in self._master_slave:
            self.date_widget[master] = DateAndTimeWidget(master)
            self.date_widget[master].new_value.connect(self.new_date_value)
            slave = self._master_slave[master]
            if slave:
                self.link_widget[master, slave] = DateLink(master)
                self.link_widget[master, slave].new_link.connect(self.new_link)
        self.link_widget['taken', 'digitised'].setText(
            translate('TechnicalTab', "Link 'taken' and 'digitised'"))
        self.link_widget['digitised', 'modified'].setText(
            translate('TechnicalTab', "Link 'digitised' and 'modified'"))
        # add to layout
        date_group.layout().addRow(translate('TechnicalTab', 'Taken'),
                                   self.date_widget['taken'])
        date_group.layout().addRow('', self.link_widget['taken', 'digitised'])
github jim-easterbrook / Photini / src / photini / importer.py View on Github external
def __init__(self, image_list, parent=None):
        super(TabWidget, self).__init__(parent)
        app = QtWidgets.QApplication.instance()
        app.aboutToQuit.connect(self.shutdown)
        if gp and app.test_mode:
            self.gp_log = gp.check_result(gp.use_python_logging())
        self.config_store = app.config_store
        self.image_list = image_list
        self.setLayout(QtWidgets.QGridLayout())
        form = QtWidgets.QFormLayout()
        form.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.nm = NameMangler()
        self.file_data = {}
        self.file_list = []
        self.source = None
        self.file_copier = None
        # source selector
        box = QtWidgets.QHBoxLayout()
        box.setContentsMargins(0, 0, 0, 0)
        self.source_selector = QtWidgets.QComboBox()
        self.source_selector.currentIndexChanged.connect(self.new_source)
        box.addWidget(self.source_selector)
        refresh_button = QtWidgets.QPushButton(
            translate('ImporterTab', 'refresh'))
        refresh_button.clicked.connect(self.refresh)
        box.addWidget(refresh_button)
github jim-easterbrook / Photini / src / photini / gpximporter.py View on Github external
pass
        elif qt_version_info >= (5, 0):
            args += [None, QtWidgets.QFileDialog.DontUseNativeDialog]
        else:
            args += [QtWidgets.QFileDialog.DontUseNativeDialog]
        path = QtWidgets.QFileDialog.getOpenFileName(*args)
        if qt_version_info >= (5, 0):
            path = path[0]
        if not path:
            return
        parent.app.config_store.set('paths', 'gpx', os.path.dirname(path))
        # get user options
        config_store = QtWidgets.QApplication.instance().config_store
        dialog = QtWidgets.QDialog(parent=parent)
        dialog.setWindowTitle(self.tr('GPX options'))
        dialog.setLayout(QtWidgets.QFormLayout())
        max_interval = QtWidgets.QSpinBox()
        max_interval.setRange(60, 300)
        max_interval.setValue(
            int(config_store.get('gpx_importer', 'interval', '120')))
        max_interval.setSuffix(self.tr(' secs'))
        dialog.layout().addRow(self.tr('Max time between points'), max_interval)
        max_dilution = QtWidgets.QDoubleSpinBox()
        max_dilution.setRange(1.0, 100.0)
        max_dilution.setValue(
            float(config_store.get('gpx_importer', 'dilution', '2.5')))
        max_dilution.setSingleStep(0.1)
        dialog.layout().addRow(
            self.tr('Max dilution of precision'), max_dilution)
        if hasattr(parent.tabs.currentWidget(), 'plot_track'):
            plot_track = QtWidgets.QCheckBox()
            plot_track.setChecked(