Пример #1
0
 def __init__(self, *arg, **kw):
     super(LensSpecWidget, self).__init__(*arg, **kw)
     self.setLayout(QtWidgets.QGridLayout())
     self.layout().setContentsMargins(6, 0, 6, 0)
     self.layout().setVerticalSpacing(0)
     for text, col in (self.tr('min'), 1), (self.tr('max'), 2):
         label = QtWidgets.QLabel(text)
         label.setMinimumWidth(50)
         label.setAlignment(Qt.AlignHCenter)
         self.layout().addWidget(label, 0, col)
     self.layout().addWidget(QtWidgets.QLabel(self.tr('Focal length')), 1,
                             0)
     self.layout().addWidget(QtWidgets.QLabel(self.tr('Max aperture')), 2,
                             0)
     self.multiple = QtWidgets.QLabel(multiple_values())
     self.layout().addWidget(self.multiple, 1, 1, 2, 2)
     self.multiple.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
     self.multiple.hide()
     self.values = {
         'min_fl': QtWidgets.QLabel(),
         'max_fl': QtWidgets.QLabel(),
         'min_fl_fn': QtWidgets.QLabel(),
         'max_fl_fn': QtWidgets.QLabel(),
     }
     for key in self.values:
         self.values[key].setAlignment(Qt.AlignHCenter)
     self.layout().addWidget(self.values['min_fl'], 1, 1)
     self.layout().addWidget(self.values['max_fl'], 1, 2)
     self.layout().addWidget(self.values['min_fl_fn'], 2, 1)
     self.layout().addWidget(self.values['max_fl_fn'], 2, 2)
Пример #2
0
 def __init__(self, *arg, **kw):
     super(LensSpecWidget, self).__init__(*arg, **kw)
     self.setContentsMargins(0, 0, 0, 0)
     self.setVerticalSpacing(0)
     for text, col in (self.tr('min'), 1), (self.tr('max'), 2):
         label = QtWidgets.QLabel(text)
         label.setMinimumWidth(50)
         label.setAlignment(Qt.AlignHCenter)
         self.addWidget(label, 0, col)
     self.addWidget(QtWidgets.QLabel(self.tr('Focal length')), 1, 0)
     self.addWidget(QtWidgets.QLabel(self.tr('Max aperture')), 2, 0)
     self.multiple = QtWidgets.QLabel(multiple_values())
     self.addWidget(self.multiple, 1, 1, 2, 2)
     self.multiple.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
     self.multiple.hide()
     self.values = {
         'min_fl'    : QtWidgets.QLabel(),
         'max_fl'    : QtWidgets.QLabel(),
         'min_fl_fn' : QtWidgets.QLabel(),
         'max_fl_fn' : QtWidgets.QLabel(),
         }
     for key in self.values:
         self.values[key].setAlignment(Qt.AlignHCenter)
     self.addWidget(self.values['min_fl'], 1, 1)
     self.addWidget(self.values['max_fl'], 1, 2)
     self.addWidget(self.values['min_fl_fn'], 2, 1)
     self.addWidget(self.values['max_fl_fn'], 2, 2)
Пример #3
0
 def __init__(self, image_list, parent=None):
     super(PhotiniMap, self).__init__(parent)
     self.logger = logging.getLogger(self.__class__.__name__)
     self.app = QtWidgets.QApplication.instance()
     self.config_store = self.app.config_store
     self.image_list = image_list
     self.multiple_values = multiple_values()
     self.script_dir = pkg_resources.resource_filename(
         'photini', 'data/' + self.__class__.__name__.lower() + '/')
     self.drag_icon = QtGui.QPixmap(
         os.path.join(self.script_dir, 'grey_marker.png'))
     self.location = {}
     self.search_string = None
     self.map_loaded = False
     self.marker_images = {}
     layout = QtWidgets.QGridLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setRowStretch(6, 1)
     layout.setColumnStretch(1, 1)
     self.setLayout(layout)
     # map
     self.map = WebView()
     self.map.setPage(WebPage(parent=self.map))
     self.map.setAcceptDrops(False)
     self.map.page().setLinkDelegationPolicy(
         QtWebKitWidgets.QWebPage.DelegateAllLinks)
     self.map.page().linkClicked.connect(self.link_clicked)
     self.map.page().loadFinished.connect(self.load_finished)
     self.map.page().mainFrame().javaScriptWindowObjectCleared.connect(
         self.java_script_window_object_cleared)
     self.map.drop_text.connect(self.drop_text)
     self.layout().addWidget(self.map, 0, 1, 8, 1)
     # search
     self.layout().addWidget(
         QtWidgets.QLabel(translate('PhotiniMap', 'Search:')), 0, 0)
     self.edit_box = QtWidgets.QComboBox()
     self.edit_box.setMinimumWidth(200)
     self.edit_box.setEditable(True)
     self.edit_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.edit_box.lineEdit().setPlaceholderText(
         translate('PhotiniMap', '<new search>'))
     self.edit_box.lineEdit().returnPressed.connect(self.search)
     self.edit_box.activated.connect(self.goto_search_result)
     self.clear_search()
     self.edit_box.setEnabled(False)
     self.layout().addWidget(self.edit_box, 1, 0)
     # latitude & longitude
     self.layout().addWidget(
         QtWidgets.QLabel(translate('PhotiniMap', 'Latitude, longitude:')), 2, 0)
     self.coords = QtWidgets.QLineEdit()
     self.coords.editingFinished.connect(self.new_coords)
     self.coords.setEnabled(False)
     self.layout().addWidget(self.coords, 3, 0)
     # load map button
     self.load_map = QtWidgets.QPushButton(translate('PhotiniMap', '\nLoad map\n'))
     self.load_map.clicked.connect(self.initialise)
     self.layout().addWidget(self.load_map, 7, 0)
     # other init
     self.image_list.image_list_changed.connect(self.image_list_changed)
Пример #4
0
 def __init__(self, *arg, **kw):
     super(DropdownEdit, self).__init__(*arg, **kw)
     self.addItem(self.tr('<clear>'), None)
     self.addItem('', None)
     self.setItemData(1, 0, Qt.UserRole - 1)
     self.addItem(multiple_values(), None)
     self.setItemData(2, 0, Qt.UserRole - 1)
     self.currentIndexChanged.connect(self.current_index_changed)
Пример #5
0
 def __init__(self, *arg, **kw):
     self.default_value = 0
     self.multiple = multiple_values()
     super(IntSpinBox, self).__init__(*arg, **kw)
     self.setSingleStep(1)
     lim = (2**31) - 1
     self.setRange(-lim, lim)
     self.setButtonSymbols(self.NoButtons)
Пример #6
0
 def __init__(self, spell_check=False, *arg, **kw):
     super(MultiLineEdit, self).__init__(*arg, **kw)
     self.multiple_values = multiple_values()
     self.setTabChangesFocus(True)
     self._is_multiple = False
     if spell_check:
         self.spell_check = SpellingHighlighter(self.document())
     else:
         self.spell_check = None
Пример #7
0
 def __init__(self, *arg, **kw):
     self.default_value = 0
     self.multiple = multiple_values()
     super(DoubleSpinBox, self).__init__(*arg, **kw)
     self.init_augment()
     self.setSingleStep(0.1)
     self.setDecimals(4)
     lim = (2 ** 31) - 1
     self.setRange(-lim, lim)
     self.setButtonSymbols(self.NoButtons)
Пример #8
0
 def __init__(self, *arg, **kw):
     super(DateTimeEdit, self).__init__(*arg, **kw)
     self.precision = 1
     self.multiple = multiple_values()
     # get size at full precision
     self.set_value(QtCore.QDateTime.currentDateTime())
     self.set_precision(7)
     self.minimum_size = super(DateTimeEdit, self).sizeHint()
     # clear display
     self.set_value(None)
Пример #9
0
 def __init__(self, *arg, **kw):
     super(DateTimeEdit, self).__init__(*arg, **kw)
     self.precision = -1
     self.multiple = multiple_values()
     self.is_multiple = False
     # get size at full precision
     self.set_value(QtCore.QDateTime.currentDateTime())
     self.set_precision(7)
     self.minimum_size = super(DateTimeEdit, self).sizeHint()
     # clear display
     self.set_value(None)
Пример #10
0
 def __init__(self, extendable=False, **kw):
     super(DropdownEdit, self).__init__(**kw)
     if extendable:
         self.setContextMenuPolicy(Qt.CustomContextMenu)
         self.customContextMenuRequested.connect(self.remove_from_list)
         self.addItem(
             translate('TechnicalTab', '<new>'), self.extend_list.emit)
     self.addItem('', None)
     self.first_value_idx = self.count()
     self.addItem(multiple_values(), '<multiple>')
     self.setItemData(
         self.count() - 1, self.itemData(self.count() - 1), Qt.UserRole - 1)
     self.currentIndexChanged.connect(self.current_index_changed)
Пример #11
0
 def __init__(self, *arg, **kw):
     self.default_value = QtCore.QDateTime(QtCore.QDate.currentDate())
     self.multiple = multiple_values()
     # rename some methods for compatibility with AugmentSpinBox
     self.cleanText = self.text
     self.minimum = self.minimumDateTime
     self.setValue = self.setDateTime
     self.textFromValue = self.textFromDateTime
     self.value = self.dateTime
     super(DateTimeEdit, self).__init__(*arg, **kw)
     self.setCalendarPopup(True)
     self.setCalendarWidget(CalendarWidget())
     self.precision = 1
     self.set_precision(7)
Пример #12
0
 def __init__(self, *arg, **kw):
     super(RatingWidget, self).__init__(*arg, **kw)
     self.multiple_values = multiple_values()
     self.setLayout(QtWidgets.QHBoxLayout())
     self.layout().setContentsMargins(0, 0, 0, 0)
     # slider
     self.slider = Slider(Qt.Horizontal)
     self.slider.setFixedWidth(200)
     self.slider.setRange(-2, 5)
     self.slider.setPageStep(1)
     self.slider.valueChanged.connect(self.set_display)
     self.layout().addWidget(self.slider)
     # display
     self.display = QtWidgets.QLineEdit()
     self.display.setFrame(False)
     self.display.setReadOnly(True)
     self.layout().addWidget(self.display)
     # adopt child methods/signals
     self.is_multiple = self.slider.is_multiple
     self.editing_finished = self.slider.editing_finished
Пример #13
0
 def __init__(self, *arg, **kw):
     super(RatingWidget, self).__init__(*arg, **kw)
     self.multiple_values = multiple_values()
     self.setLayout(QtWidgets.QHBoxLayout())
     self.layout().setContentsMargins(0, 0, 0, 0)
     # slider
     self.slider = Slider(Qt.Horizontal)
     self.slider.setFixedWidth(width_for_text(self.slider, 'x' * 25))
     self.slider.setRange(-2, 5)
     self.slider.setPageStep(1)
     self.slider.valueChanged.connect(self.set_display)
     self.layout().addWidget(self.slider)
     # display
     self.display = QtWidgets.QLineEdit()
     self.display.setStyleSheet("* {background-color:rgba(0,0,0,0);}")
     self.display.setFrame(False)
     self.display.setReadOnly(True)
     self.display.setContextMenuPolicy(Qt.NoContextMenu)
     self.display.setFocusPolicy(Qt.NoFocus)
     self.layout().addWidget(self.display)
     # adopt child methods/signals
     self.is_multiple = self.slider.is_multiple
     self.editing_finished = self.slider.editing_finished
Пример #14
0
 def __init__(self, *arg, **kw):
     super(LineEdit, self).__init__(*arg, **kw)
     self.multiple_values = multiple_values()
     self._is_multiple = False
     self.get_value = self.text
Пример #15
0
 def __init__(self, *arg, **kw):
     super(NumberEdit, self).__init__(*arg, **kw)
     self.multiple = multiple_values()
     self.textEdited.connect(self.text_edited)
     self.editingFinished.connect(self.editing_finished)
Пример #16
0
 def __init__(self, image_list, parent=None):
     super(PhotiniMap, self).__init__(parent)
     self.logger = logging.getLogger(self.__class__.__name__)
     self.app = QtWidgets.QApplication.instance()
     self.config_store = self.app.config_store
     self.image_list = image_list
     self.multiple_values = multiple_values()
     self.script_dir = pkg_resources.resource_filename(
         'photini', 'data/' + self.__class__.__name__.lower() + '/')
     self.drag_icon = QtGui.QPixmap(
         os.path.join(self.script_dir, 'grey_marker.png'))
     self.location = {}
     self.search_string = None
     self.map_loaded = False
     self.marker_images = {}
     layout = QtWidgets.QGridLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setRowStretch(6, 1)
     layout.setColumnStretch(1, 1)
     self.setLayout(layout)
     # map
     self.map = WebView()
     self.map.setPage(WebPage(parent=self.map))
     self.map.setAcceptDrops(False)
     self.map.page().setLinkDelegationPolicy(
         QtWebKitWidgets.QWebPage.DelegateAllLinks)
     self.map.page().linkClicked.connect(self.link_clicked)
     self.map.page().loadFinished.connect(self.load_finished)
     self.map.page().mainFrame().javaScriptWindowObjectCleared.connect(
         self.java_script_window_object_cleared)
     self.map.drop_text.connect(self.drop_text)
     self.layout().addWidget(self.map, 0, 1, 8, 1)
     # search
     self.layout().addWidget(
         QtWidgets.QLabel(translate('PhotiniMap', 'Search:')), 0, 0)
     self.edit_box = QtWidgets.QComboBox()
     self.edit_box.setMinimumWidth(200)
     self.edit_box.setEditable(True)
     self.edit_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.edit_box.lineEdit().setPlaceholderText(
         translate('PhotiniMap', '<new search>'))
     self.edit_box.lineEdit().returnPressed.connect(self.search)
     self.edit_box.activated.connect(self.goto_search_result)
     self.clear_search()
     self.edit_box.setEnabled(False)
     self.layout().addWidget(self.edit_box, 1, 0)
     # latitude & longitude
     self.layout().addWidget(
         QtWidgets.QLabel(translate('PhotiniMap', 'Latitude, longitude:')),
         2, 0)
     self.coords = QtWidgets.QLineEdit()
     self.coords.editingFinished.connect(self.new_coords)
     self.coords.setEnabled(False)
     self.layout().addWidget(self.coords, 3, 0)
     # load map button
     self.load_map = QtWidgets.QPushButton(
         translate('PhotiniMap', '\nLoad map\n'))
     self.load_map.clicked.connect(self.initialise)
     self.layout().addWidget(self.load_map, 7, 0)
     # other init
     self.image_list.image_list_changed.connect(self.image_list_changed)