def __init__(self, *arg, **kw): super(FlickrUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) # privacy settings self.privacy = {} privacy_group = QtWidgets.QGroupBox(self.tr('Who can see the photos?')) privacy_group.setLayout(QtWidgets.QVBoxLayout()) self.privacy['private'] = QtWidgets.QRadioButton(self.tr('Only you')) privacy_group.layout().addWidget(self.privacy['private']) ff_group = QtWidgets.QGroupBox() ff_group.setFlat(True) ff_group.setLayout(QtWidgets.QVBoxLayout()) ff_group.layout().setContentsMargins(10, 0, 0, 0) self.privacy['friends'] = QtWidgets.QCheckBox(self.tr('Your friends')) ff_group.layout().addWidget(self.privacy['friends']) self.privacy['family'] = QtWidgets.QCheckBox(self.tr('Your family')) ff_group.layout().addWidget(self.privacy['family']) privacy_group.layout().addWidget(ff_group) self.privacy['public'] = QtWidgets.QRadioButton(self.tr('Anyone')) self.privacy['public'].toggled.connect(self.enable_ff) self.privacy['public'].setChecked(True) privacy_group.layout().addWidget(self.privacy['public']) self.hidden = QtWidgets.QCheckBox(self.tr('Hidden from search')) privacy_group.layout().addWidget(self.hidden) privacy_group.layout().addStretch(1) self.layout().addWidget(privacy_group, 0, 0, 2, 1) # content type self.content_type = {} content_group = QtWidgets.QGroupBox(self.tr('Content type')) content_group.setLayout(QtWidgets.QVBoxLayout()) self.content_type['photo'] = QtWidgets.QRadioButton(self.tr('Photo')) self.content_type['photo'].setChecked(True) content_group.layout().addWidget(self.content_type['photo']) self.content_type['screenshot'] = QtWidgets.QRadioButton(self.tr('Screenshot')) content_group.layout().addWidget(self.content_type['screenshot']) self.content_type['other'] = QtWidgets.QRadioButton(self.tr('Art/Illustration')) content_group.layout().addWidget(self.content_type['other']) content_group.layout().addStretch(1) self.layout().addWidget(content_group, 0, 1) # create new set new_set_button = QtWidgets.QPushButton(self.tr('New album')) new_set_button.clicked.connect(self.new_set) self.layout().addWidget(new_set_button, 1, 1) # list of sets widget sets_group = QtWidgets.QGroupBox(self.tr('Add to albums')) sets_group.setLayout(QtWidgets.QVBoxLayout()) scrollarea = QtWidgets.QScrollArea() scrollarea.setFrameStyle(QtWidgets.QFrame.NoFrame) scrollarea.setStyleSheet("QScrollArea { background-color: transparent }") self.sets_widget = QtWidgets.QWidget() self.sets_widget.setLayout(QtWidgets.QVBoxLayout()) self.sets_widget.layout().setSpacing(0) self.sets_widget.layout().setSizeConstraint( QtWidgets.QLayout.SetMinAndMaxSize) scrollarea.setWidget(self.sets_widget) self.sets_widget.setAutoFillBackground(False) sets_group.layout().addWidget(scrollarea) self.layout().addWidget(sets_group, 0, 2, 2, 1) self.layout().setColumnStretch(2, 1)
def __init__(self, *arg, **kw): super(GoogleUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) # create new set new_set_button = QtWidgets.QPushButton( translate('GooglePhotosTab', 'New album')) new_set_button.clicked.connect(self.new_set) self.layout().addWidget(new_set_button, 2, 1) # list of sets widget sets_group = QtWidgets.QGroupBox( translate('GooglePhotosTab', 'Add to albums')) sets_group.setLayout(QtWidgets.QVBoxLayout()) scrollarea = QtWidgets.QScrollArea() scrollarea.setFrameStyle(QtWidgets.QFrame.NoFrame) scrollarea.setStyleSheet( "QScrollArea { background-color: transparent }") self.sets_widget = QtWidgets.QWidget() self.sets_widget.setLayout(QtWidgets.QVBoxLayout()) self.sets_widget.layout().setSpacing(0) self.sets_widget.layout().setSizeConstraint( QtWidgets.QLayout.SetMinAndMaxSize) scrollarea.setWidget(self.sets_widget) self.sets_widget.setAutoFillBackground(False) sets_group.layout().addWidget(scrollarea) self.layout().addWidget(sets_group, 0, 2, 3, 1) self.layout().setColumnStretch(2, 1)
def __init__(self, upload_config_widget, image_list, *arg, **kw): super(PhotiniUploader, self).__init__(*arg, **kw) self.app = QtWidgets.QApplication.instance() self.app.aboutToQuit.connect(self.shutdown) logger.debug('using %s', keyring.get_keyring().__module__) self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) self.session = self.session_factory() self.session.connection_changed.connect(self.connection_changed) self.upload_worker = None # user details self.user = {} user_group = QtWidgets.QGroupBox(translate('UploaderTabsAll', 'User')) user_group.setLayout(QtWidgets.QVBoxLayout()) self.user_photo = QtWidgets.QLabel() self.user_photo.setAlignment(Qt.AlignHCenter | Qt.AlignTop) user_group.layout().addWidget(self.user_photo) self.user_name = QtWidgets.QLabel() self.user_name.setWordWrap(True) self.user_name.setFixedWidth(80) user_group.layout().addWidget(self.user_name) user_group.layout().addStretch(1) self.layout().addWidget(user_group, 0, 0, 1, 2) # connect / disconnect button self.user_connect = StartStopButton( translate('UploaderTabsAll', 'Log in'), translate('UploaderTabsAll', 'Log out')) self.user_connect.click_start.connect(self.log_in) self.user_connect.click_stop.connect(self.session.log_out) self.layout().addWidget(self.user_connect, 1, 0, 1, 2) # 'service' specific widget self.layout().addWidget(upload_config_widget, 0, 2, 2, 2) # upload button self.upload_button = StartStopButton( translate('UploaderTabsAll', 'Start upload'), translate('UploaderTabsAll', 'Stop upload')) self.upload_button.setEnabled(False) self.upload_button.click_start.connect(self.start_upload) self.upload_button.click_stop.connect(self.stop_upload) self.layout().addWidget(self.upload_button, 2, 3) # progress bar self.layout().addWidget( QtWidgets.QLabel(translate('UploaderTabsAll', 'Progress')), 2, 0) self.total_progress = QtWidgets.QProgressBar() self.layout().addWidget(self.total_progress, 2, 1, 1, 2) # adjust spacing self.layout().setColumnStretch(2, 1) self.layout().setRowStretch(0, 1) # initialise as not connected self.connection_changed(False)
def __init__(self, upload_config_widget, image_list, *arg, **kw): super(PhotiniUploader, self).__init__(*arg, **kw) QtWidgets.QApplication.instance().aboutToQuit.connect(self.shutdown) self.logger = logging.getLogger(self.__class__.__name__) self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) self.session = self.session_factory() self.upload_worker = None self.connected = False # user details self.user = {} user_group = QtWidgets.QGroupBox(self.tr('User')) user_group.setLayout(QtWidgets.QVBoxLayout()) self.user_photo = QtWidgets.QLabel() self.user_photo.setAlignment(Qt.AlignHCenter | Qt.AlignTop) user_group.layout().addWidget(self.user_photo) self.user_name = QtWidgets.QLabel() self.user_name.setWordWrap(True) self.user_name.setFixedWidth(80) user_group.layout().addWidget(self.user_name) user_group.layout().addStretch(1) self.layout().addWidget(user_group, 0, 0, 1, 2) # connect / disconnect button self.user_connect = QtWidgets.QPushButton() self.user_connect.setCheckable(True) self.user_connect.clicked.connect(self.connect_user) self.layout().addWidget(self.user_connect, 1, 0, 1, 2) # 'service' specific widget self.layout().addWidget(upload_config_widget, 0, 2, 2, 2) # upload button self.upload_button = StartStopButton(self.tr('Start upload'), self.tr('Stop upload')) self.upload_button.setEnabled(False) self.upload_button.click_start.connect(self.start_upload) self.upload_button.click_stop.connect(self.stop_upload) self.layout().addWidget(self.upload_button, 2, 3) # progress bar self.layout().addWidget(QtWidgets.QLabel(self.tr('Progress')), 2, 0) self.total_progress = QtWidgets.QProgressBar() self.layout().addWidget(self.total_progress, 2, 1, 1, 2) # adjust spacing self.layout().setColumnStretch(2, 1) self.layout().setRowStretch(0, 1)
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 = {} # 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']) 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, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'rotate -90'), 6, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'rotate +90'), 8, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'rotate 180'), 3, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'reflect left-right'), 2, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'reflect top-bottom'), 4, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'reflect tr-bl'), 5, ordered=False) self.widgets['orientation'].add_item( translate('TechnicalTab', 'reflect tl-br'), 7, ordered=False) self.widgets['orientation'].new_value.connect(self.new_orientation) other_group.layout().addRow(translate( 'TechnicalTab', 'Orientation'), self.widgets['orientation']) # camera model self.widgets['camera_model'] = CameraList(extendable=True) self.widgets['camera_model'].setMinimumWidth( width_for_text(self.widgets['camera_model'], 'x' * 30)) self.widgets['camera_model'].new_value.connect(self.new_camera_model) self.widgets['camera_model'].extend_list.connect(self.add_camera_model) other_group.layout().addRow(translate( 'TechnicalTab', 'Camera'), self.widgets['camera_model']) # lens model self.widgets['lens_model'] = LensList(extendable=True) self.widgets['lens_model'].setMinimumWidth( width_for_text(self.widgets['lens_model'], 'x' * 30)) self.widgets['lens_model'].new_value.connect(self.new_lens_model) self.widgets['lens_model'].extend_list.connect(self.add_lens_model) other_group.layout().addRow(translate( 'TechnicalTab', 'Lens model'), self.widgets['lens_model']) # focal length self.widgets['focal_length'] = DoubleSpinBox() self.widgets['focal_length'].setMinimum(0.0) self.widgets['focal_length'].setSuffix(' mm') self.widgets['focal_length'].new_value.connect(self.new_focal_length) other_group.layout().addRow(translate( 'TechnicalTab', 'Focal length'), self.widgets['focal_length']) # 35mm equivalent focal length self.widgets['focal_length_35'] = IntSpinBox() self.widgets['focal_length_35'].setMinimum(0) self.widgets['focal_length_35'].setSuffix(' mm') self.widgets['focal_length_35'].new_value.connect(self.new_focal_length_35) other_group.layout().addRow(translate( 'TechnicalTab', '35mm equiv'), self.widgets['focal_length_35']) # aperture self.widgets['aperture'] = DoubleSpinBox() self.widgets['aperture'].setMinimum(0.0) self.widgets['aperture'].setPrefix('ƒ/') self.widgets['aperture'].new_value.connect(self.new_aperture) other_group.layout().addRow(translate( 'TechnicalTab', 'Aperture'), self.widgets['aperture']) self.layout().addWidget(other_group, stretch=1) # disable until an image is selected self.setEnabled(False)
def __init__(self, image_list, *arg, **kw): super(Technical, self).__init__(*arg, **kw) self.image_list = image_list self.setLayout(QtWidgets.QGridLayout()) 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(self.tr('Date and time')) date_group.setLayout(QtWidgets.QFormLayout()) # taken self.date_widget['taken'] = DateAndTimeWidget() self.date_widget['taken'].new_value.connect(self.new_date_taken) date_group.layout().addRow(self.tr('Taken'), self.date_widget['taken']) # link taken & digitised self.link_widget['taken', 'digitised'] = QtWidgets.QCheckBox( self.tr("Link 'taken' and 'digitised'")) self.link_widget['taken', 'digitised'].clicked.connect(self.new_link_digitised) date_group.layout().addRow('', self.link_widget['taken', 'digitised']) # digitised self.date_widget['digitised'] = DateAndTimeWidget() self.date_widget['digitised'].new_value.connect( self.new_date_digitised) date_group.layout().addRow(self.tr('Digitised'), self.date_widget['digitised']) # link digitised & modified self.link_widget['digitised', 'modified'] = QtWidgets.QCheckBox( self.tr("Link 'digitised' and 'modified'")) self.link_widget['digitised', 'modified'].clicked.connect(self.new_link_modified) date_group.layout().addRow('', self.link_widget['digitised', 'modified']) # modified self.date_widget['modified'] = DateAndTimeWidget() self.date_widget['modified'].new_value.connect(self.new_date_modified) date_group.layout().addRow(self.tr('Modified'), self.date_widget['modified']) # offset self.offset_widget = OffsetWidget() self.offset_widget.apply_offset.connect(self.apply_offset) date_group.layout().addRow(self.tr('Adjust times'), self.offset_widget) self.layout().addWidget(date_group, 0, 0) # other other_group = QtWidgets.QGroupBox(self.tr('Other')) other_group.setLayout(QtWidgets.QFormLayout()) # orientation self.widgets['orientation'] = DropdownEdit() self.widgets['orientation'].add_item(self.tr('normal'), 1) self.widgets['orientation'].add_item(self.tr('rotate -90'), 6) self.widgets['orientation'].add_item(self.tr('rotate +90'), 8) self.widgets['orientation'].add_item(self.tr('rotate 180'), 3) self.widgets['orientation'].add_item(self.tr('reflect left-right'), 2) self.widgets['orientation'].add_item(self.tr('reflect top-bottom'), 4) self.widgets['orientation'].add_item(self.tr('reflect tr-bl'), 5) self.widgets['orientation'].add_item(self.tr('reflect tl-br'), 7) self.widgets['orientation'].new_value.connect(self.new_orientation) other_group.layout().addRow(self.tr('Orientation'), self.widgets['orientation']) # lens model self.widgets['lens_model'] = DropdownEdit() self.widgets['lens_model'].setContextMenuPolicy(Qt.CustomContextMenu) self.widgets['lens_model'].add_item(self.tr('<define new lens>'), '<add lens>') for model in self.lens_data.lenses: self.widgets['lens_model'].add_item(model, model) self.widgets['lens_model'].new_value.connect(self.new_lens_model) self.widgets['lens_model'].customContextMenuRequested.connect( self.remove_lens_model) other_group.layout().addRow(self.tr('Lens model'), self.widgets['lens_model']) # lens specification self.widgets['lens_spec'] = LensSpecWidget() other_group.layout().addRow(self.tr('Lens details'), self.widgets['lens_spec']) # focal length self.widgets['focal_length'] = FloatEdit() self.widgets['focal_length'].validator().setBottom(0.1) self.widgets['focal_length'].editingFinished.connect( self.new_focal_length) other_group.layout().addRow(self.tr('Focal length (mm)'), self.widgets['focal_length']) # 35mm equivalent focal length self.widgets['focal_length_35'] = IntEdit() self.widgets['focal_length_35'].validator().setBottom(1) self.widgets['focal_length_35'].editingFinished.connect( self.new_focal_length_35) other_group.layout().addRow(self.tr('35mm equiv (mm)'), self.widgets['focal_length_35']) # aperture self.widgets['aperture'] = FloatEdit() self.widgets['aperture'].validator().setBottom(0.1) self.widgets['aperture'].editingFinished.connect(self.new_aperture) other_group.layout().addRow(self.tr('Aperture f/'), self.widgets['aperture']) self.layout().addWidget(other_group, 0, 1) self.layout().setColumnStretch(0, 1) self.layout().setColumnStretch(1, 1) # disable until an image is selected self.setEnabled(False)
def __init__(self, image_list, *arg, **kw): super(Technical, 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(self.tr('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( self.tr("Link 'taken' and 'digitised'")) self.link_widget['digitised', 'modified'].setText( self.tr("Link 'digitised' and 'modified'")) # add to layout date_group.layout().addRow(self.tr('Taken'), self.date_widget['taken']) date_group.layout().addRow('', self.link_widget['taken', 'digitised']) date_group.layout().addRow(self.tr('Digitised'), self.date_widget['digitised']) date_group.layout().addRow('', self.link_widget['digitised', 'modified']) date_group.layout().addRow(self.tr('Modified'), self.date_widget['modified']) # offset self.offset_widget = OffsetWidget() self.offset_widget.apply_offset.connect(self.apply_offset) date_group.layout().addRow(self.tr('Adjust times'), self.offset_widget) self.layout().addWidget(date_group) # other other_group = QtWidgets.QGroupBox(self.tr('Other')) other_group.setLayout(QtWidgets.QFormLayout()) other_group.layout().setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) # orientation self.widgets['orientation'] = DropdownEdit() self.widgets['orientation'].add_item(self.tr('normal'), 1) self.widgets['orientation'].add_item(self.tr('rotate -90'), 6) self.widgets['orientation'].add_item(self.tr('rotate +90'), 8) self.widgets['orientation'].add_item(self.tr('rotate 180'), 3) self.widgets['orientation'].add_item(self.tr('reflect left-right'), 2) self.widgets['orientation'].add_item(self.tr('reflect top-bottom'), 4) self.widgets['orientation'].add_item(self.tr('reflect tr-bl'), 5) self.widgets['orientation'].add_item(self.tr('reflect tl-br'), 7) self.widgets['orientation'].new_value.connect(self.new_orientation) other_group.layout().addRow( self.tr('Orientation'), self.widgets['orientation']) # lens model self.widgets['lens_model'] = DropdownEdit() self.widgets['lens_model'].setMinimumWidth( self.widgets['lens_model'].fontMetrics().width('x' * 30)) self.widgets['lens_model'].setContextMenuPolicy(Qt.CustomContextMenu) self.widgets['lens_model'].add_item( self.tr('<define new lens>'), '<add lens>') for model in self.lens_data.lenses: self.widgets['lens_model'].add_item(model, model) self.widgets['lens_model'].new_value.connect(self.new_lens_model) self.widgets['lens_model'].customContextMenuRequested.connect( self.remove_lens_model) other_group.layout().addRow( self.tr('Lens model'), self.widgets['lens_model']) # lens specification self.widgets['lens_spec'] = LensSpecWidget() other_group.layout().addRow( self.tr('Lens details'), self.widgets['lens_spec']) # focal length self.widgets['focal_length'] = NumberEdit() self.widgets['focal_length'].setValidator(DoubleValidator()) self.widgets['focal_length'].validator().setBottom(0.1) self.widgets['focal_length'].new_value.connect(self.new_focal_length) other_group.layout().addRow( self.tr('Focal length (mm)'), self.widgets['focal_length']) # 35mm equivalent focal length self.widgets['focal_length_35'] = NumberEdit() self.widgets['focal_length_35'].setValidator(IntValidator()) self.widgets['focal_length_35'].validator().setBottom(1) self.widgets['focal_length_35'].new_value.connect(self.new_focal_length_35) other_group.layout().addRow( self.tr('35mm equiv (mm)'), self.widgets['focal_length_35']) # aperture self.widgets['aperture'] = NumberEdit() self.widgets['aperture'].setValidator(DoubleValidator()) self.widgets['aperture'].validator().setBottom(0.1) self.widgets['aperture'].new_value.connect(self.new_aperture) other_group.layout().addRow( self.tr('Aperture f/'), self.widgets['aperture']) self.layout().addWidget(other_group, stretch=1) # disable until an image is selected self.setEnabled(False)
def data_form(self): widgets = {} scrollarea = QtWidgets.QScrollArea() scrollarea.setFrameStyle(QtWidgets.QFrame.NoFrame) scrollarea.setWidgetResizable(True) form = QtWidgets.QWidget() form.setLayout(QtWidgets.QFormLayout()) # creator widgets['creator'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('creator'), spell_check=True, multi_string=True) widgets['creator'].setToolTip( translate('OwnerTab', 'Enter the name of the person that created this image.')) form.layout().addRow(translate('OwnerTab', 'Creator'), widgets['creator']) # creator title widgets['creator_title'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('creator_title'), spell_check=True, multi_string=True) widgets['creator_title'].setToolTip( translate( 'OwnerTab', 'Enter the job title of the person listed in the Creator field.' )) form.layout().addRow(translate('OwnerTab', "Creator's Jobtitle"), widgets['creator_title']) # credit line widgets['credit_line'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('credit_line'), spell_check=True) widgets['credit_line'].setToolTip( translate( 'OwnerTab', 'Enter who should be credited when this image is published.')) form.layout().addRow(translate('OwnerTab', 'Credit Line'), widgets['credit_line']) # copyright widgets['copyright'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('copyright'), spell_check=True) widgets['copyright'].setToolTip( translate( 'OwnerTab', 'Enter a notice on the current owner of the' ' copyright for this image, such as "©2008 Jane Doe".')) form.layout().addRow(translate('OwnerTab', 'Copyright Notice'), widgets['copyright']) # usage terms widgets['usageterms'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('usageterms'), spell_check=True) widgets['usageterms'].setToolTip( translate( 'OwnerTab', 'Enter instructions on how this image can legally be used.')) form.layout().addRow(translate('OwnerTab', 'Rights Usage Terms'), widgets['usageterms']) # special instructions widgets['instructions'] = SingleLineEdit( length_check=ImageMetadata.max_bytes('instructions'), spell_check=True) widgets['instructions'].setToolTip( translate( 'OwnerTab', 'Enter information about embargoes, or other' ' restrictions not covered by the Rights Usage Terms field.')) form.layout().addRow(translate('OwnerTab', 'Instructions'), widgets['instructions']) ## contact information contact_group = QtWidgets.QGroupBox() contact_group.setLayout(QtWidgets.QFormLayout()) # email addresses widgets['CiEmailWork'] = SingleLineEdit() widgets['CiEmailWork'].setToolTip( translate( 'OwnerTab', 'Enter the work email address(es) for the person' ' that created this image, such as [email protected].')) contact_group.layout().addRow(translate('OwnerTab', 'Email(s)'), widgets['CiEmailWork']) # URLs widgets['CiUrlWork'] = SingleLineEdit() widgets['CiUrlWork'].setToolTip( translate( 'OwnerTab', 'Enter the work Web URL(s) for the person' ' that created this image, such as http://www.domain.com/.')) contact_group.layout().addRow(translate('OwnerTab', 'Web URL(s)'), widgets['CiUrlWork']) # phone numbers widgets['CiTelWork'] = SingleLineEdit() widgets['CiTelWork'].setToolTip( translate( 'OwnerTab', 'Enter the work phone number(s) for the person' ' that created this image, using the international format,' ' such as +1 (123) 456789.')) contact_group.layout().addRow(translate('OwnerTab', 'Phone(s)'), widgets['CiTelWork']) # address widgets['CiAdrExtadr'] = MultiLineEdit( length_check=ImageMetadata.max_bytes('contact_info'), spell_check=True) widgets['CiAdrExtadr'].setToolTip( translate('OwnerTab', 'Enter address for the person that created this image.')) contact_group.layout().addRow(translate('OwnerTab', 'Address'), widgets['CiAdrExtadr']) # city widgets['CiAdrCity'] = SingleLineEdit(spell_check=True) widgets['CiAdrCity'].setToolTip( translate( 'OwnerTab', 'Enter the city for the address of the person' ' that created this image.')) contact_group.layout().addRow(translate('OwnerTab', 'City'), widgets['CiAdrCity']) # postcode widgets['CiAdrPcode'] = SingleLineEdit() widgets['CiAdrPcode'].setToolTip( translate( 'OwnerTab', 'Enter the postal code for the address of the person' ' that created this image.')) contact_group.layout().addRow(translate('OwnerTab', 'Postal Code'), widgets['CiAdrPcode']) # region widgets['CiAdrRegion'] = SingleLineEdit(spell_check=True) widgets['CiAdrRegion'].setToolTip( translate( 'OwnerTab', 'Enter the state for the address of the person' ' that created this image.')) contact_group.layout().addRow(translate('OwnerTab', 'State/Province'), widgets['CiAdrRegion']) # country widgets['CiAdrCtry'] = SingleLineEdit(spell_check=True) widgets['CiAdrCtry'].setToolTip( translate( 'OwnerTab', 'Enter the country name for the address of the person' ' that created this image.')) contact_group.layout().addRow(translate('OwnerTab', 'Country'), widgets['CiAdrCtry']) form.layout().addRow(translate('OwnerTab', 'Contact Information'), contact_group) scrollarea.setWidget(form) return scrollarea, widgets
def __init__(self, *arg, **kw): super(PicasaUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.widgets = {} ## album details, left hand side album_group = QtWidgets.QGroupBox(self.tr('Collection / Album')) album_group.setLayout(QtWidgets.QHBoxLayout()) album_form_left = QtWidgets.QFormLayout() album_form_left.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_left) # album title / selector self.albums = QtWidgets.QComboBox() self.albums.setEditable(True) self.albums.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.albums.activated.connect(self.switch_album) self.albums.lineEdit().editingFinished.connect(self.new_title) album_form_left.addRow(self.tr('Title'), self.albums) # album description self.widgets['description'] = MultiLineEdit(spell_check=True) self.widgets['description'].editingFinished.connect( self.new_album_details) album_form_left.addRow(self.tr('Description'), self.widgets['description']) # album location self.widgets['location'] = QtWidgets.QLineEdit() self.widgets['location'].editingFinished.connect( self.new_album_details) album_form_left.addRow(self.tr('Place taken'), self.widgets['location']) # album visibility self.widgets['access'] = QtWidgets.QComboBox() self.widgets['access'].addItem(self.tr('Public on the web'), 'public') self.widgets['access'].addItem( self.tr('Limited, anyone with the link'), 'private') self.widgets['access'].addItem(self.tr('Only you'), 'protected') self.widgets['access'].currentIndexChanged.connect(self.new_access) album_form_left.addRow(self.tr('Visibility'), self.widgets['access']) ## album buttons buttons = QtWidgets.QHBoxLayout() buttons.addStretch(stretch=60) album_form_left.addRow(buttons) # new album new_album_button = QtWidgets.QPushButton(self.tr('New album')) new_album_button.clicked.connect(self.new_album) buttons.addWidget(new_album_button, stretch=20) # delete album delete_album_button = QtWidgets.QPushButton(self.tr('Delete album')) delete_album_button.clicked.connect(self.delete_album) buttons.addWidget(delete_album_button, stretch=20) ## album details, right hand side album_form_right = QtWidgets.QFormLayout() album_form_right.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_right) # album date self.widgets['timestamp'] = QtWidgets.QDateEdit() self.widgets['timestamp'].setMinimumDateTime( QtCore.QDateTime.fromTime_t(0)) self.widgets['timestamp'].setCalendarPopup(True) self.widgets['timestamp'].editingFinished.connect( self.new_album_details) album_form_right.addRow(self.tr('Date'), self.widgets['timestamp']) # album thumbnail self.album_thumb = QtWidgets.QLabel() self.album_thumb.setFixedWidth(160) album_form_right.addRow(self.album_thumb) self.layout().addWidget(album_group)
def __init__(self, *arg, **kw): super(FacebookUploadConfig, self).__init__(*arg, **kw) self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.widgets = {} ## upload config config_group = QtWidgets.QGroupBox(self.tr('Options')) config_group.setLayout(QtWidgets.QFormLayout()) self.layout().addWidget(config_group) # suppress feed story self.widgets['no_story'] = QtWidgets.QCheckBox() config_group.layout().addRow(self.tr('Suppress news feed story'), self.widgets['no_story']) label = config_group.layout().labelForField(self.widgets['no_story']) label.setWordWrap(True) label.setFixedWidth(90) # geotagging self.widgets['geo_tag'] = QtWidgets.QCheckBox() config_group.layout().addRow( self.tr('Set "city" from map coordinates'), self.widgets['geo_tag']) self.widgets['geo_tag'].setChecked(True) label = config_group.layout().labelForField(self.widgets['geo_tag']) label.setWordWrap(True) label.setFixedWidth(90) # optimise self.widgets['optimise'] = QtWidgets.QCheckBox() config_group.layout().addRow(self.tr('Optimise image size'), self.widgets['optimise']) label = config_group.layout().labelForField(self.widgets['optimise']) label.setWordWrap(True) label.setFixedWidth(90) if PIL: self.widgets['optimise'].setChecked(True) else: self.widgets['optimise'].setEnabled(False) label.setEnabled(False) ## album details album_group = QtWidgets.QGroupBox(self.tr('Album')) album_group.setLayout(QtWidgets.QHBoxLayout()) # left hand side album_form_left = QtWidgets.QFormLayout() album_form_left.setFieldGrowthPolicy( QtWidgets.QFormLayout.AllNonFixedFieldsGrow) album_group.layout().addLayout(album_form_left) # album title / selector self.widgets['album_choose'] = QtWidgets.QComboBox() self.widgets['album_choose'].activated.connect(self.select_album) album_form_left.addRow(self.tr('Title'), self.widgets['album_choose']) # album description self.widgets['album_description'] = QtWidgets.QPlainTextEdit() self.widgets['album_description'].setReadOnly(True) policy = self.widgets['album_description'].sizePolicy() policy.setVerticalStretch(1) self.widgets['album_description'].setSizePolicy(policy) album_form_left.addRow(self.tr('Description'), self.widgets['album_description']) # album location self.widgets['album_location'] = QtWidgets.QLineEdit() self.widgets['album_location'].setReadOnly(True) album_form_left.addRow(self.tr('Location'), self.widgets['album_location']) # right hand side album_form_right = QtWidgets.QVBoxLayout() album_group.layout().addLayout(album_form_right) # album thumbnail self.widgets['album_thumb'] = QtWidgets.QLabel() self.widgets['album_thumb'].setFixedSize(150, 150) self.widgets['album_thumb'].setAlignment(Qt.AlignHCenter | Qt.AlignTop) album_form_right.addWidget(self.widgets['album_thumb']) album_form_right.addStretch(1) # new album new_album_button = QtWidgets.QPushButton(self.tr('New album')) new_album_button.clicked.connect(self.new_album) album_form_right.addWidget(new_album_button) self.layout().addWidget(album_group, stretch=1)