-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start work on Prefs Dialog, add Max View Distance setting
- Loading branch information
1 parent
05ee264
commit 3f7e66c
Showing
6 changed files
with
151 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>preferencesDialog</class> | ||
<widget class="QDialog" name="preferencesDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>893</width> | ||
<height>510</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Preferences</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0"> | ||
<item> | ||
<widget class="QSplitter" name="splitter"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<widget class="QListWidget" name="categoryList"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="baseSize"> | ||
<size> | ||
<width>200</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
</widget> | ||
<widget class="QStackedWidget" name="frameStack"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | ||
<horstretch>1</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="frameShape"> | ||
<enum>QFrame::StyledPanel</enum> | ||
</property> | ||
<property name="frameShadow"> | ||
<enum>QFrame::Raised</enum> | ||
</property> | ||
</widget> | ||
</widget> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="okButton"> | ||
<property name="text"> | ||
<string>Close</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
prefsdialog | ||
""" | ||
from __future__ import absolute_import, division, print_function | ||
import logging | ||
from PySide import QtCore | ||
|
||
from PySide import QtGui | ||
|
||
from mcedit2.ui.dialogs.preferences import Ui_preferencesDialog | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
from .camera import CameraPrefs | ||
|
||
class PrefsDialog(QtGui.QDialog, Ui_preferencesDialog): | ||
def __init__(self, parent): | ||
super(PrefsDialog, self).__init__(parent) | ||
self.setupUi(self) | ||
self.okButton.clicked.connect(self.accept) | ||
|
||
self.frames = [ | ||
CameraPrefs() | ||
] | ||
|
||
for i, frame in enumerate(self.frames): | ||
item = QtGui.QListWidgetItem(frame.labelText) | ||
item.setData(QtCore.Qt.UserRole, i) | ||
self.categoryList.addItem(item) | ||
|
||
self.categoryList.itemClicked.connect(self.itemWasClicked) | ||
|
||
self.frameStack.addWidget(self.frames[0]) | ||
|
||
def itemWasClicked(self, item): | ||
idx = item.data(QtCore.Qt.UserRole) | ||
|
||
self.frameStack.removeWidget(self.frameStack.widget(0)) | ||
self.frameStack.addWidget(self.frames[idx]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
camera | ||
""" | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
import logging | ||
from PySide import QtGui | ||
|
||
from mcedit2.widgets.layout import Column | ||
from mcedit2.worldview.camera import MaxViewDistanceSetting | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
class CameraPrefs(QtGui.QWidget): | ||
def __init__(self): | ||
super(CameraPrefs, self).__init__() | ||
self.labelText = self.tr("Camera View") | ||
|
||
layout = QtGui.QFormLayout() | ||
|
||
maxViewDistanceInput = QtGui.QSpinBox() | ||
maxViewDistanceInput.setMinimum(0) | ||
maxViewDistanceInput.valueChanged.connect(MaxViewDistanceSetting.setValue) | ||
MaxViewDistanceSetting.connectAndCall(maxViewDistanceInput.setValue) | ||
|
||
layout.addRow(self.tr("Max View Distance"), maxViewDistanceInput) | ||
|
||
self.setLayout(Column(layout, None)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters