feature/port-to-py3 #11
3
PyLoT.py
3
PyLoT.py
@ -3692,8 +3692,9 @@ class MainWindow(QMainWindow):
|
|||||||
# QMainWindow.closeEvent(self, event)
|
# QMainWindow.closeEvent(self, event)
|
||||||
|
|
||||||
def setParameter(self, show=True):
|
def setParameter(self, show=True):
|
||||||
|
show = True
|
||||||
if not self.paraBox:
|
if not self.paraBox:
|
||||||
self.paraBox = PylotParaBox(self._inputs, parent=self)
|
self.paraBox = PylotParaBox(self._inputs, parent=self, windowflag=Qt.Window)
|
||||||
self.paraBox.accepted.connect(self._setDirty)
|
self.paraBox.accepted.connect(self._setDirty)
|
||||||
self.paraBox.accepted.connect(self.filterOptionsFromParameter)
|
self.paraBox.accepted.connect(self.filterOptionsFromParameter)
|
||||||
if show:
|
if show:
|
||||||
|
@ -123,11 +123,11 @@ def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
class ProgressBarWidget(QtGui.QWidget):
|
class ProgressBarWidget(QtWidgets.QWidget):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(ProgressBarWidget, self).__init__(parent)
|
super(ProgressBarWidget, self).__init__(parent)
|
||||||
self.hlayout = QtGui.QHBoxLayout()
|
self.hlayout = QtWidgets.QHBoxLayout()
|
||||||
self.pb = QtGui.QProgressBar()
|
self.pb = QtWidgets.QProgressBar()
|
||||||
self.pb.setRange(0, 0)
|
self.pb.setRange(0, 0)
|
||||||
self.label = QLabel()
|
self.label = QLabel()
|
||||||
self.hlayout.addWidget(self.pb)
|
self.hlayout.addWidget(self.pb)
|
||||||
@ -164,8 +164,8 @@ class AddMetadataWidget(QWidget):
|
|||||||
|
|
||||||
def center(self):
|
def center(self):
|
||||||
fm = self.frameGeometry()
|
fm = self.frameGeometry()
|
||||||
screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos())
|
screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())
|
||||||
centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center()
|
centerPoint = QtWidgets.QApplication.desktop().screenGeometry(screen).center()
|
||||||
fm.moveCenter(centerPoint)
|
fm.moveCenter(centerPoint)
|
||||||
self.move(fm.topLeft())
|
self.move(fm.topLeft())
|
||||||
|
|
||||||
@ -178,10 +178,10 @@ class AddMetadataWidget(QWidget):
|
|||||||
|
|
||||||
def init_lineedit(self):
|
def init_lineedit(self):
|
||||||
self.selection_layout = QVBoxLayout()
|
self.selection_layout = QVBoxLayout()
|
||||||
self.lineedit_title = QtGui.QLabel("Choose metadata file to add:")
|
self.lineedit_title = QtWidgets.QLabel("Choose metadata file to add:")
|
||||||
self.selection_layout.insertWidget(0, self.lineedit_title)
|
self.selection_layout.insertWidget(0, self.lineedit_title)
|
||||||
self.lineedit_layout = QHBoxLayout()
|
self.lineedit_layout = QHBoxLayout()
|
||||||
self.selection_box = QtGui.QLineEdit()
|
self.selection_box = QtWidgets.QLineEdit()
|
||||||
self.browse_button = self.init_button("Browse", explanation="Browse the file explorer")
|
self.browse_button = self.init_button("Browse", explanation="Browse the file explorer")
|
||||||
self.lineedit_layout.addWidget(self.selection_box)
|
self.lineedit_layout.addWidget(self.selection_box)
|
||||||
self.lineedit_layout.addWidget(self.browse_button)
|
self.lineedit_layout.addWidget(self.browse_button)
|
||||||
@ -222,12 +222,12 @@ class AddMetadataWidget(QWidget):
|
|||||||
self.init_list_widget()
|
self.init_list_widget()
|
||||||
|
|
||||||
def init_list_title(self):
|
def init_list_title(self):
|
||||||
self.list_title = QtGui.QLabel("Current metadata files:")
|
self.list_title = QtWidgets.QLabel("Current metadata files:")
|
||||||
self.list_layout.insertWidget(0, self.list_title)
|
self.list_layout.insertWidget(0, self.list_title)
|
||||||
|
|
||||||
def init_list_widget(self):
|
def init_list_widget(self):
|
||||||
self.list_view = QtGui.QListView()
|
self.list_view = QtWidgets.QListView()
|
||||||
self.list_view.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.list_model = QtGui.QStandardItemModel(self.list_view)
|
self.list_model = QtGui.QStandardItemModel(self.list_view)
|
||||||
self.list_view.setModel(self.list_model)
|
self.list_view.setModel(self.list_model)
|
||||||
self.list_layout.insertWidget(1, self.list_view, 1)
|
self.list_layout.insertWidget(1, self.list_view, 1)
|
||||||
@ -3926,8 +3926,8 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
|
|
||||||
def center(self):
|
def center(self):
|
||||||
fm = self.frameGeometry()
|
fm = self.frameGeometry()
|
||||||
screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos())
|
screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())
|
||||||
centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center()
|
centerPoint = QtWidgets.QApplication.desktop().screenGeometry(screen).center()
|
||||||
fm.moveCenter(centerPoint)
|
fm.moveCenter(centerPoint)
|
||||||
self.move(fm.topLeft())
|
self.move(fm.topLeft())
|
||||||
|
|
||||||
@ -4230,13 +4230,13 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
self.setValue(box, value)
|
self.setValue(box, value)
|
||||||
|
|
||||||
def setValue(self, box, value):
|
def setValue(self, box, value):
|
||||||
if type(box) == QtGui.QLineEdit:
|
if type(box) == QtWidgets.QLineEdit:
|
||||||
box.setText(str(value))
|
box.setText(str(value))
|
||||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox:
|
||||||
if not value:
|
if not value:
|
||||||
value = 0.
|
value = 0.
|
||||||
box.setValue(value)
|
box.setValue(value)
|
||||||
elif type(box) == QtGui.QCheckBox:
|
elif type(box) == QtWidgets.QCheckBox:
|
||||||
if value == 'True':
|
if value == 'True':
|
||||||
value = True
|
value = True
|
||||||
if value == 'False' or value is None:
|
if value == 'False' or value is None:
|
||||||
@ -4247,11 +4247,11 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
self.setValue(b, value[index])
|
self.setValue(b, value[index])
|
||||||
|
|
||||||
def getValue(self, box):
|
def getValue(self, box):
|
||||||
if type(box) == QtGui.QLineEdit:
|
if type(box) == QtWidgets.QLineEdit:
|
||||||
value = str(box.text())
|
value = str(box.text())
|
||||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox:
|
||||||
value = box.value()
|
value = box.value()
|
||||||
elif type(box) == QtGui.QCheckBox:
|
elif type(box) == QtWidgets.QCheckBox:
|
||||||
value = box.isChecked()
|
value = box.isChecked()
|
||||||
elif type(box) == list:
|
elif type(box) == list:
|
||||||
value = []
|
value = []
|
||||||
@ -4261,7 +4261,7 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def openFile(self):
|
def openFile(self):
|
||||||
fd = QtGui.QFileDialog()
|
fd = QtWidgets.QFileDialog()
|
||||||
fname = fd.getOpenFileName(self, 'Browse for settings file.',
|
fname = fd.getOpenFileName(self, 'Browse for settings file.',
|
||||||
filter='PyLoT input file (*.in)')
|
filter='PyLoT input file (*.in)')
|
||||||
if fname[0]:
|
if fname[0]:
|
||||||
@ -4273,7 +4273,7 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def saveFile(self):
|
def saveFile(self):
|
||||||
fd = QtGui.QFileDialog()
|
fd = QtWidgets.QFileDialog()
|
||||||
fname = fd.getSaveFileName(self, 'Browse for settings file.',
|
fname = fd.getSaveFileName(self, 'Browse for settings file.',
|
||||||
filter='PyLoT input file (*.in)')[0]
|
filter='PyLoT input file (*.in)')[0]
|
||||||
if fname:
|
if fname:
|
||||||
@ -4300,17 +4300,17 @@ class PylotParaBox(QtWidgets.QWidget):
|
|||||||
if hasattr(self, '_exclusive_dialog'):
|
if hasattr(self, '_exclusive_dialog'):
|
||||||
self._exclusive_dialog.close()
|
self._exclusive_dialog.close()
|
||||||
self._exclusive_widgets = []
|
self._exclusive_widgets = []
|
||||||
QtGui.QWidget.show(self)
|
QtWidgets.QWidget.show(self)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.rejected.emit('reject')
|
self.rejected.emit('reject')
|
||||||
QtGui.QWidget.close(self)
|
QtWidgets.QWidget.close(self)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.accepted.emit('accept')
|
self.accepted.emit('accept')
|
||||||
|
|
||||||
def _warn(self, message):
|
def _warn(self, message):
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user