Changeset 7969b9c in sasview for src


Ignore:
Timestamp:
Nov 9, 2017 6:43:07 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
fbfc488
Parents:
4992ff2
git-author:
Piotr Rozyczko <rozyczko@…> (10/31/17 08:00:59)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 06:43:07)
Message:

More functionality conversion

Location:
src/sas/qtgui
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r4992ff2 r7969b9c  
    182182        Opens the Qt "Open File..." dialog 
    183183        """ 
    184         print("A") 
    185184        path_str = self.chooseFiles() 
    186185        if not path_str: 
     
    193192        Opens the Qt "Open Folder..." dialog 
    194193        """ 
    195         folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", None, 
     194        folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", 
    196195              QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 
    197196        if folder is None: 
     
    398397            if outer_item.isCheckable() and \ 
    399398                   outer_item.checkState() == QtCore.Qt.Checked: 
     399                self.model.beginResetModel() 
    400400                theories_copied += 1 
    401401                new_item = self.recursivelyCloneItem(outer_item) 
     
    405405                new_item.setText(new_name) 
    406406                self.model.appendRow(new_item) 
    407             self.model.reset() 
     407                self.model.endResetModel() 
     408            #self.model.reset() 
    408409 
    409410        freeze_msg = "" 
     
    577578 
    578579        # Add the plot to the workspace 
    579         self.parent.workspace().addWindow(new_plot) 
     580        self.parent.workspace().addSubWindow(new_plot) 
    580581 
    581582        # Show the plot 
     
    626627        # But only with Qt built-in dialog (non-platform native) 
    627628        paths = QtWidgets.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
    628                 wlist, None, QtWidgets.QFileDialog.DontUseNativeDialog) 
     629                wlist, None, QtWidgets.QFileDialog.DontUseNativeDialog)[0] 
     630        # [0] is new in Qt5 as getOpenFileNames() returns now a tuple! 
    629631        if paths is None: 
    630632            return 
     
    686688                    self.mutex.lock() 
    687689                    self.updateModel(new_data, p_file) 
    688                     self.model.reset() 
    689                     QtGui.qApp.processEvents() 
     690                    #self.model.reset() 
     691                    QtWidgets.QApplication.processEvents() 
    690692                    self.mutex.unlock() 
    691693 
     
    907909        # Move the slider all the way up, if present 
    908910        vertical_scroll_bar = self.txt_widget.verticalScrollBar() 
    909         vertical_scroll_bar.triggerAction(QtGui.QScrollBar.SliderToMinimum) 
     911        vertical_scroll_bar.triggerAction(QtWidgets.QScrollBar.SliderToMinimum) 
    910912 
    911913    def saveDataAs(self): 
     
    995997 
    996998        # Reset the model so the view gets updated. 
    997         self.model.reset() 
     999        #self.model.reset() 
    9981000        self.communicator.progressBarUpdateSignal.emit(-1) 
    9991001 
     
    10051007        self.manager.add_data(data_list=output_data) 
    10061008 
    1007     def loadErrback(self, reason): 
     1009    def loadFailed(self, reason): 
    10081010        print("File Load Failed with:\n", reason) 
    10091011        pass 
     
    10471049 
    10481050        # New row in the model 
     1051        self.model.beginResetModel() 
    10491052        self.model.appendRow(checkbox_item) 
     1053        self.model.endResetModel() 
    10501054 
    10511055    def updateModelFromPerspective(self, model_item): 
     
    10621066 
    10631067        # Reset the view 
    1064         self.model.reset() 
     1068        ##self.model.reset() 
    10651069        # Pass acting as a debugger anchor 
    10661070        pass 
     
    10981102 
    10991103if __name__ == "__main__": 
    1100     app = QtGui.QApplication([]) 
     1104    app = QtWidgets.QApplication([]) 
    11011105    dlg = DataExplorerWindow() 
    11021106    dlg.show() 
  • src/sas/qtgui/MainWindow/GuiManager.py

    r4992ff2 r7969b9c  
    7777 
    7878        # Invoke the initial perspective 
    79         self.perspectiveChanged("Fitting") 
     79        #self.perspectiveChanged("Fitting") 
    8080        self.addWidgets() 
    8181 
     
    9191        # Set up the status bar 
    9292        self.statusBarSetup() 
    93  
    9493        # Show the Welcome panel 
    9594        self.welcomePanel = WelcomePanel() 
     
    117116 
    118117        self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace) 
    119         self.dockedFilesWidget.setFloating(True) 
     118        self.dockedFilesWidget.setFloating(False) 
    120119        self.dockedFilesWidget.setWidget(self.filesWidget) 
    121120 
    122121        # Disable maximize/minimize and close buttons 
    123122        self.dockedFilesWidget.setFeatures(QDockWidget.NoDockWidgetFeatures) 
    124         self.dockedFilesWidget.setFeatures(Qt.LeftDockWidgetArea) 
    125  
    126         self._workspace.workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) 
     123 
     124        #self._workspace.workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) 
     125        self._workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) 
    127126 
    128127        # Add the console window as another docked widget 
     
    132131        self.listWidget = QTextBrowser() 
    133132        self.logDockWidget.setWidget(self.listWidget) 
    134         self._workspace.workspace.addDockWidget(Qt.BottomDockWidgetAre, self.logDockWidget)  
     133        self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget) 
    135134 
    136135        # Add other, minor widgets 
     
    199198 
    200199        # Resize to the workspace height 
    201         workspace_height = self._workspace.workspace.sizeHint().height() 
    202         perspective_size = self._current_perspective.sizeHint() 
    203         if workspace_height < perspective_size.height(): 
    204             perspective_width = perspective_size.width() 
    205             self._current_perspective.resize(perspective_width, workspace_height-10) 
     200        #workspace_height = self._workspace.workspace.sizeHint().height() 
     201        #perspective_size = self._current_perspective.sizeHint() 
     202        #if workspace_height < perspective_size.height(): 
     203        #    perspective_width = perspective_size.width() 
     204        #    self._current_perspective.resize(perspective_width, workspace_height-10) 
     205 
    206206        self._current_perspective.show() 
    207207 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    r4992ff2 r7969b9c  
    4848            self.initStyleOption(options,index) 
    4949 
    50             style = QtGui.QApplication.style() if options.widget is None else options.widget.style() 
     50            style = QtWidgets.QApplication.style() if options.widget is None else options.widget.style() 
    5151 
    5252            # Prepare document for inserting into cell 
     
    178178            self.initStyleOption(options,index) 
    179179 
    180             style = QtGui.QApplication.style() if options.widget is None else options.widget.style() 
     180            style = QtWidgets.QApplication.style() if options.widget is None else options.widget.style() 
    181181 
    182182            # Prepare document for inserting into cell 
     
    256256            self.initStyleOption(options,index) 
    257257 
    258             style = QtGui.QApplication.style() if options.widget is None else options.widget.style() 
     258            style = QtWidgets.QApplication.style() if options.widget is None else options.widget.style() 
    259259 
    260260            # Prepare document for inserting into cell 
  • src/sas/qtgui/Plotting/LinearFit.py

    r4992ff2 r7969b9c  
    1919 
    2020class LinearFit(QtWidgets.QDialog, Ui_LinearFitUI): 
     21    updatePlot = QtCore.pyqtSignal(tuple) 
    2122    def __init__(self, parent=None, 
    2223                 data=None, 
     
    178179        self.txtChi2.setText(formatNumber(self.Chivalue)) 
    179180 
    180         #self.parent.updatePlot.emit((tempx, tempy)) 
    181         self.parent.emit(QtCore.SIGNAL('updatePlot'), (tempx, tempy)) 
     181        self.updatePlot.emit((tempx, tempy)) 
    182182 
    183183    def origData(self): 
  • src/sas/qtgui/Plotting/Plotter.py

    r4992ff2 r7969b9c  
    2121    1D Plot widget for use with a QDialog 
    2222    """ 
    23     updatePlot = QtCore.pyqtSignal(tuple) 
    2423    def __init__(self, parent=None, manager=None, quickplot=False): 
    2524        super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) 
     
    4140        self.fit_result.symbol = 13 
    4241        self.fit_result.name = "Fit" 
    43  
    44         # Add a slot for receiving update signal from LinearFit 
    45         # NEW style signals 
    46         self.updatePlot.connect(self.onFitDisplay) 
    47         # OLD style signals 
    48         # QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
    4942 
    5043    @property 
     
    368361                    xlabel=self.xLogLabel, 
    369362                    ylabel=self.yLogLabel) 
     363        fit_dialog.updatePlot.connect(self.onFitDisplay) 
    370364        if fit_dialog.exec_() == QtWidgets.QDialog.Accepted: 
    371365            return 
  • src/sas/qtgui/Plotting/Plotter2D.py

    r4992ff2 r7969b9c  
    243243        self.slicer_widget.close_signal.connect(slicer_closed) 
    244244        # Add the plot to the workspace 
    245         self.manager.parent.workspace().addWindow(self.slicer_widget) 
     245        self.manager.parent.workspace().addSubWindow(self.slicer_widget) 
    246246 
    247247        self.slicer_widget.show() 
     
    344344        self.boxwidget = BoxSum(self, model=self.box_sum_model) 
    345345        # Add the plot to the workspace 
    346         self.manager.parent.workspace().addWindow(self.boxwidget) 
     346        self.manager.parent.workspace().addSubWindow(self.boxwidget) 
    347347        self.boxwidget.show() 
    348348 
  • src/sas/qtgui/Plotting/PlotterBase.py

    r4992ff2 r7969b9c  
    317317        Copy MPL widget area to buffer 
    318318        """ 
    319         bmp = QtGui.QApplication.clipboard() 
     319        bmp = QtWidgets.QApplication.clipboard() 
    320320        pixmap = QtGui.QPixmap.grabWidget(self.canvas) 
    321321        bmp.setPixmap(pixmap) 
     
    374374        # Move the slider all the way up, if present 
    375375        vertical_scroll_bar = self.txt_widget.verticalScrollBar() 
    376         vertical_scroll_bar.triggerAction(QtGui.QScrollBar.SliderToMinimum) 
     376        vertical_scroll_bar.triggerAction(QtWidgets.QScrollBar.SliderToMinimum) 
    377377 
    378378    def onSavePoints(self, plot_data): 
  • src/sas/qtgui/Plotting/rangeSlider.py

    r4992ff2 r7969b9c  
    8989 
    9090        painter = QtGui.QPainter(self) 
    91         style = QtGui.QApplication.style()  
     91        style = QtWidgets.QApplication.style() 
    9292 
    9393        for i, value in enumerate([self._low, self._high]): 
     
    173173        event.accept() 
    174174         
    175         style = QtGui.QApplication.style() 
     175        style = QtWidgets.QApplication.style() 
    176176        button = event.button() 
    177177         
     
    264264            self.setHighValue( new_pos ) 
    265265 
    266         if self.hasTracking(): 
    267             self.emit(QtCore.SIGNAL('sliderMoved(int)'), new_pos) 
    268  
    269266             
    270267    def __pick(self, pt): 
     
    278275        opt = QtWidgets.QStyleOptionSlider() 
    279276        self.initStyleOption(opt) 
    280         style = QtGui.QApplication.style() 
     277        style = QtWidgets.QApplication.style() 
    281278         
    282279        gr = style.subControlRect(style.CC_Slider, opt, style.SC_SliderGroove, self) 
Note: See TracChangeset for help on using the changeset viewer.