コード例 #1
0
ファイル: flickr.py プロジェクト: jim-easterbrook/Photini
 def new_set(self):
     dialog = QtWidgets.QDialog(parent=self)
     dialog.setWindowTitle(self.tr('Create new Flickr album'))
     dialog.setLayout(QtWidgets.QFormLayout())
     title = SingleLineEdit(spell_check=True)
     dialog.layout().addRow(self.tr('Title'), title)
     description = MultiLineEdit(spell_check=True)
     dialog.layout().addRow(self.tr('Description'), description)
     dialog.layout().addRow(QtWidgets.QLabel(
         self.tr('Album will be created when photos are uploaded')))
     button_box = QtWidgets.QDialogButtonBox(
         QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
     button_box.accepted.connect(dialog.accept)
     button_box.rejected.connect(dialog.reject)
     dialog.layout().addRow(button_box)
     if dialog.exec_() != QtWidgets.QDialog.Accepted:
         return
     title = title.toPlainText()
     if not title:
         return
     description = description.toPlainText()
     widget = self.upload_config.add_set(title, description, index=0)
     widget.setChecked(True)
     self.photosets.insert(0, {
         'id'          : None,
         'title'       : title,
         'description' : description,
         'widget'      : widget,
         })
コード例 #2
0
 def new_set(self):
     dialog = QtWidgets.QDialog(parent=self)
     dialog.setWindowTitle(translate('FlickrTab',
                                     'Create new Flickr album'))
     dialog.setLayout(QtWidgets.QFormLayout())
     title = SingleLineEdit(spell_check=True)
     dialog.layout().addRow(translate('FlickrTab', 'Title'), title)
     description = MultiLineEdit(spell_check=True)
     dialog.layout().addRow(translate('FlickrTab', 'Description'),
                            description)
     dialog.layout().addRow(
         QtWidgets.QLabel(
             translate('FlickrTab',
                       'Album will be created when photos are uploaded')))
     button_box = QtWidgets.QDialogButtonBox(
         QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
     button_box.accepted.connect(dialog.accept)
     button_box.rejected.connect(dialog.reject)
     dialog.layout().addRow(button_box)
     if dialog.exec_() != QtWidgets.QDialog.Accepted:
         return
     title = title.toPlainText()
     if not title:
         return
     description = description.toPlainText()
     widget = self.upload_config.add_set(title, description, None, index=0)
     widget.setChecked(True)
コード例 #3
0
ファイル: facebook.py プロジェクト: Python3pkg/Photini
 def new_album(self):
     dialog = QtWidgets.QDialog(parent=self)
     dialog.setWindowTitle(self.tr('Create new Facebook album'))
     dialog.setLayout(QtWidgets.QFormLayout())
     name = SingleLineEdit(spell_check=True)
     dialog.layout().addRow(self.tr('Title'), name)
     message = MultiLineEdit(spell_check=True)
     dialog.layout().addRow(self.tr('Description'), message)
     location = SingleLineEdit(spell_check=True)
     dialog.layout().addRow(self.tr('Location'), location)
     privacy = QtWidgets.QComboBox()
     for display_name, value in (
         (self.tr('Only me'), '{value: "SELF"}'),
         (self.tr('All friends'), '{value: "ALL_FRIENDS"}'),
         (self.tr('Friends of friends'), '{value: "FRIENDS_OF_FRIENDS"}'),
         (self.tr('Friends + networks'), '{value: "NETWORKS_FRIENDS"}'),
         (self.tr('Everyone'), '{value: "EVERYONE"}'),
     ):
         privacy.addItem(display_name, value)
     dialog.layout().addRow(self.tr('Privacy'), privacy)
     button_box = QtWidgets.QDialogButtonBox(
         QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
     button_box.accepted.connect(dialog.accept)
     button_box.rejected.connect(dialog.reject)
     dialog.layout().addRow(button_box)
     if dialog.exec_() != QtWidgets.QDialog.Accepted:
         return
     if not self.authorise('write'):
         self.refresh(force=True)
         return
     name = name.toPlainText().strip()
     if not name:
         return
     data = {'name': name}
     message = message.toPlainText().strip()
     if message:
         data['message'] = message
     location = location.toPlainText().strip()
     if location:
         data['location'] = location
     data['privacy'] = privacy.itemData(privacy.currentIndex())
     try:
         album = self.session.post('https://graph.facebook.com/me/albums',
                                   data=data)
     except Exception as ex:
         self.logger.error(str(ex))
         self.refresh(force=True)
         return
     self.load_user_data(album_id=album['id'])
コード例 #4
0
ファイル: descriptive.py プロジェクト: orensbruli/Photini
 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)
     self.form.addRow(translate('DescriptiveTab', 'Keywords'),
                      self.widgets['keywords'])
     self.image_list.image_list_changed.connect(self.image_list_changed)
     # rating
     self.widgets['rating'] = RatingWidget()
     self.widgets['rating'].editing_finished.connect(self.new_rating)
     self.form.addRow(translate('DescriptiveTab', 'Rating'),
                      self.widgets['rating'])
     # copyright
     self.widgets['copyright'] = LineEditWithAuto()
     self.widgets['copyright'].editingFinished.connect(self.new_copyright)
     self.widgets['copyright'].autoComplete.connect(self.auto_copyright)
     self.form.addRow(translate('DescriptiveTab', 'Copyright'),
                      self.widgets['copyright'])
     # creator
     self.widgets['creator'] = LineEditWithAuto()
     self.widgets['creator'].editingFinished.connect(self.new_creator)
     self.widgets['creator'].autoComplete.connect(self.auto_creator)
     self.form.addRow(translate('DescriptiveTab', 'Creator / Artist'),
                      self.widgets['creator'])
     # disable until an image is selected
     self.setEnabled(False)
コード例 #5
0
ファイル: ownership.py プロジェクト: jim-easterbrook/Photini
 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
コード例 #6
0
 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(QtWidgets.QVBoxLayout())
     self.layout().addLayout(self.form)
     self.layout().addStretch(1)
     # construct widgets
     self.widgets = {}
     # title
     self.widgets['title'] = SingleLineEdit(
         spell_check=True, length_check=ImageMetadata.max_bytes('title'))
     self.widgets['title'].setToolTip(
         translate(
             'DescriptiveTab',
             'Enter a short verbal and human readable name'
             ' for the image, this may be the file name.'))
     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,
         length_check=ImageMetadata.max_bytes('description'))
     self.widgets['description'].setToolTip(
         translate(
             'DescriptiveTab', 'Enter a "caption" describing the who, what,'
             ' and why of what is happening in this image,\nthis might include'
             ' names of people, and/or their role in the action that is taking'
             ' place within the image.'))
     self.widgets['description'].editingFinished.connect(
         self.new_description)
     self.form.addRow(translate('DescriptiveTab', 'Description / Caption'),
                      self.widgets['description'])
     # keywords
     self.widgets['keywords'] = KeywordsEditor(
         spell_check=True,
         length_check=ImageMetadata.max_bytes('keywords'),
         multi_string=True)
     self.widgets['keywords'].setToolTip(
         translate(
             'DescriptiveTab',
             'Enter any number of keywords, terms or phrases'
             ' used to express the subject matter in the image.'
             '\nSeparate them with ";" characters.'))
     self.widgets['keywords'].editingFinished.connect(self.new_keywords)
     self.form.addRow(translate('DescriptiveTab', 'Keywords'),
                      self.widgets['keywords'])
     self.image_list.image_list_changed.connect(self.image_list_changed)
     # rating
     self.widgets['rating'] = RatingWidget()
     self.widgets['rating'].editing_finished.connect(self.new_rating)
     self.form.addRow(translate('DescriptiveTab', 'Rating'),
                      self.widgets['rating'])
     # copyright
     self.widgets['copyright'] = LineEditWithAuto(
         length_check=ImageMetadata.max_bytes('copyright'))
     self.widgets['copyright'].setToolTip(
         translate(
             'OwnerTab', 'Enter a notice on the current owner of the'
             ' copyright for this image, such as "©2008 Jane Doe".'))
     self.widgets['copyright'].editingFinished.connect(self.new_copyright)
     self.widgets['copyright'].autoComplete.connect(self.auto_copyright)
     self.form.addRow(translate('DescriptiveTab', 'Copyright'),
                      self.widgets['copyright'])
     # creator
     self.widgets['creator'] = LineEditWithAuto(
         length_check=ImageMetadata.max_bytes('creator'), multi_string=True)
     self.widgets['creator'].setToolTip(
         translate('OwnerTab',
                   'Enter the name of the person that created this image.'))
     self.widgets['creator'].editingFinished.connect(self.new_creator)
     self.widgets['creator'].autoComplete.connect(self.auto_creator)
     self.form.addRow(translate('DescriptiveTab', 'Creator / Artist'),
                      self.widgets['creator'])
     # disable until an image is selected
     self.setEnabled(False)
コード例 #7
0
 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'].setEnabled(False)
     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'].setEnabled(False)
     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'].setEnabled(False)
     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'].setEnabled(False)
     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)