Esempio n. 1
0
    def __init__(self, parent=None, flags=QtCore.Qt.WindowFlags(0), **kwargs):
        # title = self.tr('Worldmap Panel')
        super().__init__('World Map Panel', parent, flags, **kwargs)
        # self.setObjectName('worldmapPanel') # @TODO: check

        scene = QtWidgets.QGraphicsScene(self)
        scene.setSceneRect(-180, -90, 360, 180)
        self.graphicsview = QtWidgets.QGraphicsView(scene)
        self.graphicsview.scale(2., -2.)

        self.worldmapitem = None
        self.setWorldmapItem()

        self.actions = self._setupActions()
        self.actionZoomIn, self.actionZoomOut = self.actions.actions()

        toolbar = qtsupport.actionGroupToToolbar(self.actions,
                                                 self.tr('Zoom toolbar'))
        toolbar.setOrientation(QtCore.Qt.Vertical)

        mainlayout = QtWidgets.QHBoxLayout()
        mainlayout.addWidget(self.graphicsview)
        mainlayout.addWidget(toolbar)

        mainwidget = QtWidgets.QWidget()
        mainwidget.setLayout(mainlayout)
        self.setWidget(mainwidget)

        self.bigbox = None
        self.box = None
        self.fitItem = self.worldmapitem

        self.graphicsview.installEventFilter(self)
Esempio n. 2
0
def init(app):
    from gsdview import qtsupport
    from .core import AppZoomTool

    tool = AppZoomTool(app)

    app.imagemenu.addSeparator()
    app.imagemenu.addActions(tool.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(tool.actions,
                                             app.tr('Zoom toolbar'))
    app.addToolBar(toolbar)

    # @COMPATIBILITY: pyside 1.2.2
    #                 without the call to toolbar.parent() the tolbar is not
    #                 actually added
    assert toolbar.parent()

    # @TODO: move to tool (??)
    tool.actions.setEnabled(False)

    # @TODO: move to tool (??)
    app.mdiarea.subWindowActivated.connect(
        lambda w: tool.actions.setEnabled(bool(w)))
    app.subWindowClosed.connect(
        lambda: tool.actions.setEnabled(bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = tool
Esempio n. 3
0
    def __init__(self, parent=None, flags=QtCore.Qt.WindowFlags(0), **kwargs):
        #title = self.tr('Worldmap Panel')
        super(WorldmapPanel, self).__init__('World Map Panel', parent, flags,
                                            **kwargs)
        #self.setObjectName('worldmapPanel') # @TODO: check

        scene = QtWidgets.QGraphicsScene(self)
        scene.setSceneRect(-180, -90, 360, 180)
        self.graphicsview = QtWidgets.QGraphicsView(scene)
        self.graphicsview.scale(2., -2.)

        self.worldmapitem = None
        self.setWorldmapItem()

        self.actions = self._setupActions()
        self.actionZoomIn, self.actionZoomOut = self.actions.actions()

        toolbar = qtsupport.actionGroupToToolbar(self.actions,
                                                  self.tr('Zoom toolbar'))
        toolbar.setOrientation(QtCore.Qt.Vertical)

        mainlayout = QtWidgets.QHBoxLayout()
        mainlayout.addWidget(self.graphicsview)
        mainlayout.addWidget(toolbar)

        mainwidget = QtWidgets.QWidget()
        mainwidget.setLayout(mainlayout)
        self.setWidget(mainwidget)

        self.bigbox = None
        self.box = None
        self.fitItem = self.worldmapitem

        self.graphicsview.installEventFilter(self)
Esempio n. 4
0
def init(app):
    from gsdview import qtsupport
    from .core import GSDToolsController

    controller = GSDToolsController(app)

    app.toolsmenu.addSeparator()
    app.toolsmenu.addActions(controller.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(controller.actions,
                                             app.tr('GSDTools toolbar'))
    app.addToolBar(toolbar)

    # @COMPATIBILITY: pyside 1.2.2
    #                 without the call to toolbar.parent() the tolbar is not
    #                 actually added
    assert toolbar.parent()

    # @TODO: move to tool (??)
    #~ app.mdiarea.subWindowActivated.connect(
    #~ lambda w: controller.actions.setEnabled(bool(w)))
    #~ app.subWindowClosed.connect(lambda: controller.actions.setEnabled(
    #~ bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = controller
Esempio n. 5
0
def init(app):
    from gsdview import qtsupport
    from .core import AppZoomTool

    tool = AppZoomTool(app)

    app.imagemenu.addSeparator()
    app.imagemenu.addActions(tool.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(tool.actions,
                                             app.tr('Zoom toolbar'))
    app.addToolBar(toolbar)

    # @COMPATIBILITY: pyside 1.2.2
    #                 without the call to toolbar.parent() the tolbar is not
    #                 actually added
    assert toolbar.parent()

    # @TODO: move to tool (??)
    tool.actions.setEnabled(False)

    # @TODO: move to tool (??)
    app.mdiarea.subWindowActivated.connect(
        lambda w: tool.actions.setEnabled(bool(w)))
    app.subWindowClosed.connect(lambda: tool.actions.setEnabled(
        bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = tool
Esempio n. 6
0
    def _addToolBarFromActions(self, actions, name):
        toolbar = qtsupport.actionGroupToToolbar(actions, name)
        self.addToolBar(toolbar)

        # @COMPATIBILITY: pyside 1.2.2
        #                 without the call to toolbar.parent() the toolbar is
        #                 not actually added
        assert toolbar.parent()

        return toolbar
Esempio n. 7
0
def init(app):
    from gsdview import qtsupport
    from .core import GSDToolsController

    controller = GSDToolsController(app)

    app.toolsmenu.addSeparator()
    app.toolsmenu.addActions(controller.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(controller.actions,
                                             app.tr('GSDTools toolbar'))
    app.addToolBar(toolbar)

    # @TODO: move to tool (??)
    # app.mdiarea.subWindowActivated.connect(
    #     lambda w: controller.actions.setEnabled(bool(w)))
    # app.subWindowClosed.connect(lambda: controller.actions.setEnabled(
    #     bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = controller
Esempio n. 8
0
def init(app):
    from gsdview import qtsupport
    from .core import AppZoomTool

    tool = AppZoomTool(app)

    app.imagemenu.addSeparator()
    app.imagemenu.addActions(tool.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(tool.actions,
                                             app.tr('Zoom toolbar'))
    app.addToolBar(toolbar)

    # @TODO: move to tool (??)
    tool.actions.setEnabled(False)

    # @TODO: move to tool (??)
    app.mdiarea.subWindowActivated.connect(
        lambda w: tool.actions.setEnabled(bool(w)))
    app.subWindowClosed.connect(
        lambda: tool.actions.setEnabled(bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = tool
Esempio n. 9
0
def init(app):
    from gsdview import qtsupport
    from .core import GSDToolsController

    controller = GSDToolsController(app)

    app.toolsmenu.addSeparator()
    app.toolsmenu.addActions(controller.actions.actions())
    toolbar = qtsupport.actionGroupToToolbar(controller.actions, app.tr("GSDTools toolbar"))
    app.addToolBar(toolbar)

    # @COMPATIBILITY: pyside 1.2.2
    #                 without the call to toolbar.parent() the tolbar is not
    #                 actually added
    assert toolbar.parent()

    # @TODO: move to tool (??)
    # ~ app.mdiarea.subWindowActivated.connect(
    # ~ lambda w: controller.actions.setEnabled(bool(w)))
    # ~ app.subWindowClosed.connect(lambda: controller.actions.setEnabled(
    # ~ bool(app.mdiarea.activeSubWindow())))

    global _instance
    _instance = controller
Esempio n. 10
0
    def _addToolBarFromActions(self, actions, name):
        toolbar = qtsupport.actionGroupToToolbar(actions, name)
        self.addToolBar(toolbar)

        return toolbar