def __init__(self, items, tooltip): QTreeWidgetItem.__init__(self, items) self.__intColumn = 0 self.__tooltip = tooltip self.__fileModified = False # Memorize the screen width global screenWidth screenSize = GlobalData().application.desktop().screenGeometry() screenWidth = screenSize.width() return
def __init__(self, items, tooltip): items.insert(1, '') QTreeWidgetItem.__init__(self, items) self.__intColumn = 0 self.__tooltip = tooltip self.__fileModified = False self.setIcon(1, getIcon('findtooltip.png')) # Memorize the screen width global screenWidth screenSize = GlobalData().application.desktop().screenGeometry() screenWidth = screenSize.width()
def __guessMaximized(self): """True if the window is maximized""" # Ugly but I don't see any better way. # It is impossible to catch the case when the main window is maximized. # Especially when networked XServer is used (like xming) # So, make a wild guess instead and do not save the status if # maximized. availGeom = GlobalData().application.desktop().availableGeometry() if self.width() + abs(self.settings['xdelta']) > availGeom.width() or \ self.height() + abs(self.settings['ydelta']) > availGeom.height(): return True return False
def restoreWindowPosition(self): """Makes sure that the window frame delta is proper""" screenSize = GlobalData().application.desktop().screenGeometry() if screenSize.width() != self.settings['screenwidth'] or \ screenSize.height() != self.settings['screenheight']: # The screen resolution has been changed, save the new values self.settings['screenwidth'] = screenSize.width() self.settings['screenheight'] = screenSize.height() self.settings['xdelta'] = self.settings['xpos'] - self.x() self.settings['ydelta'] = self.settings['ypos'] - self.y() self.settings['rendererxpos'] = self.x() self.settings['rendererypos'] = self.y() else: # Screen resolution is the same as before if self.settings['rendererxpos'] != self.x() or \ self.settings['rendererypos'] != self.y(): # The saved delta is incorrect, update it self.settings['xdelta'] = self.settings['rendererxpos'] - self.x() + \ self.settings['xdelta'] self.settings['ydelta'] = self.settings['rendererypos'] - self.y() + \ self.settings['ydelta'] self.settings['rendererxpos'] = self.x() self.settings['rendererypos'] = self.y() self.__initialisation = False
def __init__(self, settings, em): QMainWindow.__init__(self, None) self.settings = settings self.em = em self.__widgets = QStackedWidget(self) self.__widgets.setContentsMargins(1, 1, 1, 1) self.__noRenderLabel = QLabel( '\nNo rendering available for the current tab') self.__noRenderLabel.setFrameShape(QFrame.StyledPanel) self.__noRenderLabel.setAlignment(Qt.AlignHCenter) self.__noRenderLabel.setAutoFillBackground(True) font = self.__noRenderLabel.font() font.setPointSize(font.pointSize() + 4) self.__noRenderLabel.setFont(font) palette = self.__noRenderLabel.palette() palette.setColor(QPalette.Background, GlobalData().skin['nolexerPaper']) self.__noRenderLabel.setPalette(palette) self.__widgets.addWidget(self.__noRenderLabel) self.setCentralWidget(self.__widgets) self.__ideClosing = False self.__initialisation = True # The size restore is done twice to avoid huge flickering # This one is approximate, the one in restoreWindowPosition() # is precise screenSize = GlobalData().application.desktop().screenGeometry() if screenSize.width() != settings['screenwidth'] or \ screenSize.height() != settings['screenheight']: # The screen resolution has been changed, use the default pos defXPos, defYpos, \ defWidth, defHeight = settings.getDefaultRendererWindowGeometry() self.resize(defWidth, defHeight) self.move(defXPos, defYpos) else: # No changes in the screen resolution self.resize(settings['rendererwidth'], settings['rendererheight']) self.move(settings['rendererxpos'] + settings['xdelta'], settings['rendererypos'] + settings['ydelta'])