Ignore:
Timestamp:
05/22/13 19:07:18 (11 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Save widget geometry only if the widget was explicitly shown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/OWBaseWidget.py

    r11517 r11539  
    202202        self.asyncCalls = [] 
    203203        self.asyncBlock = False 
     204        self.__wasShown = False 
    204205        self.__progressBarValue = -1 
    205206 
     
    361362        QDialog.hideEvent(self, ev) 
    362363 
    363     # override the default show function. 
    364     # after show() we must call processEvents because show puts some LayoutRequests in queue 
    365     # and we must process them immediately otherwise the width(), height(), ... of elements in the widget will be wrong 
    366 #    def show(self): 
    367 #        QDialog.show(self) 
    368 #        qApp.processEvents() 
    369  
    370     # set widget state to shown 
    371     def showEvent(self, ev):     
     364    def showEvent(self, ev): 
    372365        QDialog.showEvent(self, ev) 
    373366        if self.savePosition: 
    374367            self.widgetShown = 1 
    375              
     368 
     369        self.__wasShown = True 
    376370        self.restoreWidgetPosition() 
    377          
     371 
    378372    def closeEvent(self, ev): 
    379         if self.savePosition: 
     373        if self.savePosition and self.__wasShown: 
     374            # self.geometry() is 'invalid' (not yet resized/layout) until the 
     375            # widget is made explicitly visible. 
    380376            self.savedWidgetGeometry = str(self.saveGeometry()) 
    381377        QDialog.closeEvent(self, ev) 
    382          
     378 
    383379    def wheelEvent(self, event): 
    384380        """ Silently accept the wheel event. This is to ensure combo boxes 
Note: See TracChangeset for help on using the changeset viewer.