コード例 #1
0
class CurveDisplayWidget(QtGui.QSplitter):
    delete_done = QtCore.pyqtSignal()
    def __init__(self, parent=None):
        super(CurveDisplayWidget, self).__init__(parent)
        self.left_panel = CurveDisplayLeftPanel()
        self.addWidget(self.left_panel)
        self.display_params = ParamsDisplayWidget()
        self.display_params.curve_modified.connect(self.left_panel.alter_curve_widget.curve_modified)
        self.left_panel.alter_curve_widget.curve_modified.connect(self.display_params.refresh)
        self.addWidget(self.display_params)
        self.left_panel.alter_curve_widget.curve_saved.connect(self.refresh_params)
        
        self.left_panel.delete_done.connect(self.delete_done)
        self.displayed_curve_id = None
        self._displayed_curve = None
        
    @property
    def displayed_curve(self):
        if self._displayed_curve:
            return self._displayed_curve
        else:
            return None
             #if self.displayed_curve_id:
             #   return models.CurveDB.objects.get(id=self.displayed_curve_id)
    
    def refresh(self):
        self.left_panel.refresh()
        self.refresh_params()
    
    def refresh_params(self):
        self.display_params.refresh()
        #print self.displayed_curve.params
        #if self.displayed_curve:
        #    self.display_params.display_curve(self.displayed_curve)
    
    def save(self):
        curve = self.displayed_curve
        self.save_curve(curve)
        
    def save_curve(self, curve):
        self.left_panel.save_curve(curve)
    
    def display_curve(self, curve):
        if self.left_panel.alter_curve_widget.has_unsaved_modification():
            if QtGui.QMessageBox.question(self,
                                       'unsaved modifications',
                                       'the current curve (id ' + \
                                       str(self._displayed_curve.id) + \
                                       ') has unsaved modifications, ' + \
                                       'are you sure you want to discard them ?',
                                        QtGui.QMessageBox.Save,
                                        QtGui.QMessageBox.Discard)==QtGui.QMessageBox.Save:
                self.save()
                self.left_panel.alter_curve_widget.curve_saved.emit()
        self._displayed_curve = curve
        self.displayed_curve_id = curve.id
        self.left_panel.display_curve(curve)
        if curve:
            self.display_params.display_curve(curve)
コード例 #2
0
ファイル: __init__.py プロジェクト: ghQQ/pyinstruments
class CurveDisplayWidget(QtGui.QSplitter):
    delete_done = QtCore.pyqtSignal()

    def __init__(self, parent=None):
        super(CurveDisplayWidget, self).__init__(parent)
        self.left_panel = CurveDisplayLeftPanel()
        self.addWidget(self.left_panel)
        self.display_params = ParamsDisplayWidget()
        self.display_params.curve_modified.connect(
            self.left_panel.alter_curve_widget.curve_modified)
        self.left_panel.alter_curve_widget.curve_modified.connect(
            self.display_params.refresh)
        self.addWidget(self.display_params)
        self.left_panel.alter_curve_widget.curve_saved.connect(
            self.refresh_params)

        self.left_panel.delete_done.connect(self.delete_done)
        self.displayed_curve_id = None
        self._displayed_curve = None

    @property
    def displayed_curve(self):
        if self._displayed_curve:
            return self._displayed_curve
        else:
            return None
            if self.displayed_curve_id:
                return models.CurveDB.objects.get(id=self.displayed_curve_id)

    def refresh(self):
        self.left_panel.refresh()
        self.refresh_params()

    def refresh_params(self):
        self.display_params.refresh()
        #print self.displayed_curve.params
        #if self.displayed_curve:
        #    self.display_params.display_curve(self.displayed_curve)

    def save(self):
        curve = self.displayed_curve
        self.save_curve(curve)

    def save_curve(self, curve):
        self.left_panel.save_curve(curve)

    def display_curve(self, curve):
        self._display_curve = curve
        self.displayed_curve_id = curve.id
        self.left_panel.display_curve(curve)
        if curve:
            self.display_params.display_curve(curve)
コード例 #3
0
ファイル: __init__.py プロジェクト: vsteinmetz/pyinstruments
class CurveDisplayWidget(QtGui.QSplitter):
    delete_done = QtCore.pyqtSignal()
    def __init__(self, parent=None):
        super(CurveDisplayWidget, self).__init__(parent)
        self.left_panel = CurveDisplayLeftPanel()
        self.addWidget(self.left_panel)
        self.display_params = ParamsDisplayWidget()
        self.display_params.curve_modified.connect(self.left_panel.alter_curve_widget.curve_modified)
        self.left_panel.alter_curve_widget.curve_modified.connect(self.display_params.refresh)
        self.addWidget(self.display_params)
        self.left_panel.alter_curve_widget.curve_saved.connect(self.refresh_params)
        
        self.left_panel.delete_done.connect(self.delete_done)
        self.displayed_curve_id = None
        self._displayed_curve = None
        
    @property
    def displayed_curve(self):
        if self._displayed_curve:
            return self._displayed_curve
        else:
            return None
            if self.displayed_curve_id:
                return models.CurveDB.objects.get(id=self.displayed_curve_id)
    
    def refresh(self):
        self.left_panel.refresh()
        self.refresh_params()
    
    def refresh_params(self):
        self.display_params.refresh()
        #print self.displayed_curve.params
        #if self.displayed_curve:
        #    self.display_params.display_curve(self.displayed_curve)
    
    def save(self):
        curve = self.displayed_curve
        self.save_curve(curve)
        
    def save_curve(self, curve):
        self.left_panel.save_curve(curve)
    
    def display_curve(self, curve):
        self._display_curve = curve
        self.displayed_curve_id = curve.id
        self.left_panel.display_curve(curve)
        if curve:
            self.display_params.display_curve(curve)
コード例 #4
0
ファイル: __init__.py プロジェクト: ghQQ/pyinstruments
    def __init__(self, parent=None):
        super(CurveDisplayWidget, self).__init__(parent)
        self.left_panel = CurveDisplayLeftPanel()
        self.addWidget(self.left_panel)
        self.display_params = ParamsDisplayWidget()
        self.display_params.curve_modified.connect(
            self.left_panel.alter_curve_widget.curve_modified)
        self.left_panel.alter_curve_widget.curve_modified.connect(
            self.display_params.refresh)
        self.addWidget(self.display_params)
        self.left_panel.alter_curve_widget.curve_saved.connect(
            self.refresh_params)

        self.left_panel.delete_done.connect(self.delete_done)
        self.displayed_curve_id = None
        self._displayed_curve = None
コード例 #5
0
 def __init__(self, parent=None):
     super(CurveDisplayWidget, self).__init__(parent)
     self.left_panel = CurveDisplayLeftPanel()
     self.addWidget(self.left_panel)
     self.display_params = ParamsDisplayWidget()
     self.display_params.curve_modified.connect(self.left_panel.alter_curve_widget.curve_modified)
     self.left_panel.alter_curve_widget.curve_modified.connect(self.display_params.refresh)
     self.addWidget(self.display_params)
     self.left_panel.alter_curve_widget.curve_saved.connect(self.refresh_params)
     
     self.left_panel.delete_done.connect(self.delete_done)
     self.displayed_curve_id = None
     self._displayed_curve = None