'Exports data for view save/restore'

def export_state(self):

    state = self.windowState()
    maximized = bool((state & Qt.WindowMaximized))
    ret = {u'maximized': maximized}
    if maximized:
        rect = self._unmaximized_rect
        try:
            (ret[u'x'], ret[u'y'], ret[u'width'], ret[u'height']) = rect
        except:
            pass
    else:
        ret[u'width'] = self.width()
        ret[u'height'] = self.height()
        ret[u'x'] = self.x()
        ret[u'y'] = self.y()
    return ret
