Browse Source

added toolbar to switch windows/edit modes

master
Christian Voigt 1 year ago
parent
commit
d6d59bc936
  1. 54
      main.py

54
main.py

@ -7,7 +7,7 @@ from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import (
QMainWindow, QApplication, QWidget,
QHBoxLayout, QVBoxLayout,
QProgressBar
QProgressBar, QToolBar, QLabel, QPushButton
)
# from formatter import Formatter
@ -65,13 +65,25 @@ class ChraniMapTools(QMainWindow, ChraniCursors):
self.mouse_cursor_helper.center_label_signal.connect(self.center_label_slot)
def init_ui(self):
toolbar = QToolBar()
label = QPushButton("world viewer")
toolbar.addWidget(label)
label = QPushButton("noise generator")
toolbar.addWidget(label)
application_focus_switcher = toolbar
application_frame = QWidget()
application_frame_layout = QVBoxLayout()
application_frame_layout.setContentsMargins(0, 0, 0, 0)
window = QWidget()
window_layout = QHBoxLayout()
window_layout.setContentsMargins(0, 0, 0, 0)
action_pane_width = 256
self.progress_bar_helper.set_maximum_size(QSize(action_pane_width, 12))
self.statusBar().addPermanentWidget(self.progress_bar_helper.progress_bar)
# map viewer
map_viewer_window = QWidget()
map_viewer_window_layout = QHBoxLayout()
map_viewer_window_layout.setContentsMargins(0, 0, 0, 0)
region_view_width = 512
region_view = QWidget()
@ -82,30 +94,30 @@ class ChraniMapTools(QMainWindow, ChraniCursors):
region_view.setLayout(region_view_layout)
region_view.setMinimumSize(QSize(region_view_width, region_view_width))
action_pane_width = 256
self.progress_bar_helper.set_maximum_size(QSize(action_pane_width, 12))
self.statusBar().addPermanentWidget(self.progress_bar_helper.progress_bar)
noise_map_widget = NoiseMapWidget(
progress_bar_helper=self.progress_bar_helper,
mouse_cursor_helper=self.mouse_cursor_helper,
width=action_pane_width
)
world_regions_widget = WorldRegionsWidget(
progress_bar_helper=self.progress_bar_helper,
mouse_cursor_helper=self.mouse_cursor_helper
)
region_view_layout.addWidget(
world_regions_widget
)
region_view_layout.addWidget(world_regions_widget)
map_viewer_window_layout.addWidget(region_view)
map_viewer_window.setLayout(map_viewer_window_layout)
window_layout.addWidget(region_view)
window_layout.addWidget(noise_map_widget)
# noise_generator
noise_generator_window = QWidget()
noise_generator_window_layout = QHBoxLayout()
noise_generator_window_layout.setContentsMargins(0, 0, 0, 0)
window.setLayout(window_layout)
noise_map_widget = NoiseMapWidget(
progress_bar_helper=self.progress_bar_helper,
mouse_cursor_helper=self.mouse_cursor_helper,
width=action_pane_width
)
noise_generator_window_layout.addWidget(noise_map_widget)
noise_generator_window.setLayout(noise_generator_window_layout)
application_frame_layout.addWidget(window)
# init view
application_frame_layout.addWidget(application_focus_switcher)
application_frame_layout.addWidget(map_viewer_window)
application_frame.setLayout(application_frame_layout)
self.setCentralWidget(application_frame)

Loading…
Cancel
Save