PyQt4.QtGui.QApplication.desktop.primaryScreen

Here are the examples of the python api PyQt4.QtGui.QApplication.desktop.primaryScreen taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: sIBL_GUI Source File: images_previewer.py
    def __init__(self, parent, paths=None, *args, **kwargs):
        """
        Initializes the class.

        :param parent: Object parent.
        :type parent: QObject
        :param paths: Images paths.
        :type paths: tuple or list
        :param \*args: Arguments.
        :type \*args: \*
        :param \*\*kwargs: Keywords arguments.
        :type \*\*kwargs: \*\*
        """

        LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__))

        super(ImagesPreviewer, self).__init__(parent, *args, **kwargs)

        # --- Setting class attributes. ---
        self.__container = parent
        self.__paths = None
        self.paths = paths

        self.__ui_resources_directory = "resources"
        self.__ui_resources_directory = os.path.join(os.path.dirname(__file__), self.__ui_resources_directory)
        self.__ui_previous_image = "Previous.png"
        self.__ui_next_image = "Next.png"
        self.__ui_zoom_out_image = "Zoom_Out.png"
        self.__ui_zoom_in_image = "Zoom_In.png"

        # Ensure the ui object is destroyed on close to avoid memory leaks.
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.__graphics_scene_background_color = QColor(32, 32, 32)
        self.__minimum_zoom_factor = 0.05
        self.__maximum_zoom_factor = 25
        self.__display_graphics_item_margin = 32
        self.__graphics_sceneWidth = QApplication.desktop().screenGeometry(
            QApplication.desktop().primaryScreen()).width() * (1 / self.__minimum_zoom_factor * 1.75)
        self.__graphics_sceneHeight = QApplication.desktop().screenGeometry(
            QApplication.desktop().primaryScreen()).height() * (1 / self.__minimum_zoom_factor * 1.75)
        self.__wheel_zoom_factor = 350.0
        self.__key_zoom_factor = 1.20

        self.__graphics_view = None
        self.__graphics_scene = None
        self.__display_graphics_item = None

        ImagesPreviewer.__initialize_ui(self)

        self.load_image()

Example 2

Project: sIBL_GUI Source File: images_previewer.py
    def fit_window(self):
        """
        Fits the View window.

        :return: Method success.
        :rtype: bool
        """

        if not self.__display_graphics_item:
            return False

        desktop_width = QApplication.desktop().screenGeometry(QApplication.desktop().primaryScreen()).width()
        desktop_height = QApplication.desktop().screenGeometry(QApplication.desktop().primaryScreen()).height()
        width = min(desktop_width * 0.80, self.__display_graphics_item.width)
        height = min(desktop_height * 0.80, self.__display_graphics_item.height)
        self.resize(width, height)

        foundations.ui.common.center_widget_on_screen(self)

        return True