示例#1
0
    def __init__(self, dimension, geometryCache, resourceLoader, shareGLWidget, *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, geometryCache, resourceLoader, shareGLWidget)

        self.viewControls = ViewControls(view)

        viewDistanceInput = QtGui.QSpinBox(minimum=2, maximum=64, singleStep=2)
        viewDistanceInput.setValue(self.worldView.viewDistance)
        viewDistanceInput.valueChanged.connect(view.setViewDistance)

        perspectiveInput = QtGui.QCheckBox("Perspective")
        perspectiveInput.toggle()
        perspectiveInput.toggled.connect(view.setPerspective)

        showButton = QtGui.QPushButton("Show...")
        showButton.setMenu(view.layerToggleGroup.menu)

        self.setLayout(Column(Row(None,
                                  showButton,
                                  perspectiveInput,
                                  QtGui.QLabel("View Distance:"),
                                  viewDistanceInput,
                                  self.viewControls.getShowHideButton(), margin=0),
                              view, margin=0))
示例#2
0
    def __init__(self, dimension, textureAtlas, geometryCache, shareGLWidget,
                 *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, textureAtlas,
                                                geometryCache, shareGLWidget)

        auxControlWidget = QtGui.QWidget()

        StickyMouselookSetting.connectAndCall(view.setStickyMouselook)

        stickyCheckbox = QtGui.QCheckBox(self.tr("Sticky Mouselook"))
        stickyCheckbox.setChecked(StickyMouselookSetting.value())
        stickyCheckbox.toggled.connect(StickyMouselookSetting.setValue)

        auxControlWidget.setLayout(Column(stickyCheckbox))

        self.viewControls = ViewControls(view, auxControlWidget)

        ViewDistanceSetting.connectAndCall(view.setViewDistance)

        viewDistanceInput = QtGui.QSpinBox(minimum=2, maximum=64, singleStep=2)
        viewDistanceInput.setValue(self.worldView.viewDistance)
        viewDistanceInput.valueChanged.connect(ViewDistanceSetting.setValue)

        MaxViewDistanceSetting.connectAndCall(viewDistanceInput.setMaximum)

        PerspectiveSetting.connectAndCall(view.setPerspective)

        perspectiveInput = QtGui.QCheckBox(self.tr("Perspective"))
        perspectiveInput.setChecked(view.perspective)
        perspectiveInput.toggled.connect(PerspectiveSetting.setValue)

        showButton = QtGui.QPushButton(self.tr("Show..."))
        showButton.setMenu(view.layerToggleGroup.menu)

        workplaneCheckbox = QtGui.QCheckBox(self.tr("Work Plane"))
        workplaneSpinSlider = SpinSlider()
        workplaneSpinSlider.setValue(64)
        workplaneSpinSlider.setMinimum(dimension.bounds.miny)
        workplaneSpinSlider.setMaximum(dimension.bounds.maxy)

        workplaneCheckbox.toggled.connect(view.toggleWorkplane)

        workplaneSpinSlider.valueChanged.connect(view.setWorkplaneLevel)

        self.setLayout(
            Column(Row(None,
                       workplaneCheckbox,
                       workplaneSpinSlider,
                       showButton,
                       perspectiveInput,
                       QtGui.QLabel(self.tr("View Distance:")),
                       viewDistanceInput,
                       self.viewControls.getShowHideButton(),
                       margin=0),
                   view,
                   margin=0))
示例#3
0
文件: camera.py 项目: mcedit/mcedit2
class CameraWorldViewFrame(QtGui.QWidget):
    def __init__(self, dimension, textureAtlas, geometryCache, shareGLWidget, *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, textureAtlas, geometryCache, shareGLWidget)

        auxControlWidget = QtGui.QWidget()
        
        StickyMouselookSetting.connectAndCall(view.setStickyMouselook)
        
        stickyCheckbox = QtGui.QCheckBox(self.tr("Sticky Mouselook"))
        stickyCheckbox.setChecked(StickyMouselookSetting.value())
        stickyCheckbox.toggled.connect(StickyMouselookSetting.setValue)

        auxControlWidget.setLayout(Column(stickyCheckbox))

        self.viewControls = ViewControls(view, auxControlWidget)

        ViewDistanceSetting.connectAndCall(view.setViewDistance)

        viewDistanceInput = QtGui.QSpinBox(minimum=2, maximum=64, singleStep=2)
        viewDistanceInput.setValue(self.worldView.viewDistance)
        viewDistanceInput.valueChanged.connect(ViewDistanceSetting.setValue)
        
        MaxViewDistanceSetting.connectAndCall(viewDistanceInput.setMaximum)
        
        PerspectiveSetting.connectAndCall(view.setPerspective)

        perspectiveInput = QtGui.QCheckBox(self.tr("Perspective"))
        perspectiveInput.setChecked(view.perspective)
        perspectiveInput.toggled.connect(PerspectiveSetting.setValue)

        showButton = QtGui.QPushButton(self.tr("Show..."))
        showButton.setMenu(view.layerToggleGroup.menu)

        workplaneCheckbox = QtGui.QCheckBox(self.tr("Work Plane"))
        workplaneSpinSlider = SpinSlider()
        workplaneSpinSlider.setValue(64)
        workplaneSpinSlider.setMinimum(dimension.bounds.miny)
        workplaneSpinSlider.setMaximum(dimension.bounds.maxy)

        workplaneCheckbox.toggled.connect(view.toggleWorkplane)

        workplaneSpinSlider.valueChanged.connect(view.setWorkplaneLevel)

        self.setLayout(Column(Row(None,
                                  workplaneCheckbox,
                                  workplaneSpinSlider,
                                  showButton,
                                  perspectiveInput,
                                  QtGui.QLabel(self.tr("View Distance:")),
                                  viewDistanceInput,
                                  self.viewControls.getShowHideButton(), margin=0),
                              view, margin=0))
示例#4
0
def CutawayWorldViewFrame(dimension, textureAtlas, geometryCache,
                          sharedGLWidget):
    viewFrame = QtGui.QWidget()
    view = CutawayWorldView(dimension, textureAtlas, geometryCache,
                            sharedGLWidget)

    grid = WorldViewRulerGrid(view)

    x = QtGui.QPushButton("x")
    y = QtGui.QPushButton("y")
    z = QtGui.QPushButton("z")
    buttons = dict(zip('xyz', (x, y, z)))

    def to(d):
        def _clicked():
            view.axis = d
            for b in buttons.values():
                b.setChecked(b is buttons[d])

        return _clicked

    x.clicked.connect(to('x'))
    y.clicked.connect(to('y'))
    z.clicked.connect(to('z'))

    depthLabel = QtGui.QLabel("?")

    def updateDepthLabel():
        center = view.centerPoint
        text = "%s = %d" % (view.axis.upper(), center[view.dim])
        depthLabel.setText(text)

    view.viewportMoved.connect(updateDepthLabel)
    view.__updateDepthLabel = updateDepthLabel

    viewFrame.viewControls = ViewControls(view)

    buttonBar = Row(None, depthLabel, x, y, z, RecenterButton(view),
                    viewFrame.viewControls.getShowHideButton())

    viewFrame.setLayout(Column(buttonBar, (grid, 1)))
    viewFrame.worldView = view

    return viewFrame