Browse Source

updated readme

put in a simple switch to avoid calling the open file UI too while it's running
master
Christian Voigt 1 year ago
parent
commit
2bdd399c8f
  1. 2
      README.md
  2. 33
      world_regions_widget/layout_region_label_collection.py

2
README.md

@ -8,6 +8,8 @@ scratch! @@ -8,6 +8,8 @@ scratch!
### Current state
Well, we have a barebone framework for the World-Regions-Widget
You can do very basic editing on existing world maps, like swapping regions with stored ones.
It's making some use of threading, I'm not an expert though. The UI won't freeze up, that's the main thing. Can't get
it to crash either, which is a good sign ^^
#### Core Functions
Loading of 7dtd RAW map files (dtm.raw, any RAW 16bit grayscale that's stored in order) (CTRL+O)

33
world_regions_widget/layout_region_label_collection.py

@ -42,7 +42,7 @@ class WorkerUpdateLabelCollection(QThread): @@ -42,7 +42,7 @@ class WorkerUpdateLabelCollection(QThread):
for x in range(0, self.regions_per_row):
self.region_label_helper.region_label_set_raw_data_array.emit(
create_region_string_from_grid_index(x=x + self.offset, y=y + self.offset),
self.blockshaped_map_data[y][x].copy()
self.blockshaped_map_data[y][x]
)
self.progress.emit(100)
@ -186,23 +186,24 @@ class RegionLabelCollection(QGridLayout): @@ -186,23 +186,24 @@ class RegionLabelCollection(QGridLayout):
self.itemAt(i).widget().remove_label_pixmap()
def update_label_collection_with_raw_map_data(self, raw_map_data, length):
self.clear_viewer_grid()
if self.load_collection_thread is None:
self.clear_viewer_grid()
raw_map_data = np.flipud(np.reshape(raw_map_data, (length, length)))
self.blockshaped_map_data = rearrange(raw_map_data, '(x dx) (y dy) -> x y dx dy', dx=512, dy=512)
raw_map_data = np.flipud(np.reshape(raw_map_data, (length, length)))
self.blockshaped_map_data = rearrange(raw_map_data, '(x dx) (y dy) -> x y dx dy', dx=512, dy=512)
self.load_collection_thread = QThread()
self.update_label_worker = WorkerUpdateLabelCollection(
self.blockshaped_map_data, self.region_label_helper
)
self.update_label_worker.moveToThread(self.load_collection_thread)
self.load_collection_thread.started.connect(self.update_label_worker.run)
self.update_label_worker.finished.connect(self.load_collection_thread.quit)
self.update_label_worker.finished.connect(self.update_label_worker.deleteLater)
self.load_collection_thread.finished.connect(self.load_collection_thread.deleteLater)
self.update_label_worker.progress.connect(self.update_label_collection_with_raw_map_data_progress)
self.load_collection_thread.finished.connect(self.update_label_collection_with_raw_map_data_done)
self.load_collection_thread.start()
self.load_collection_thread = QThread()
self.update_label_worker = WorkerUpdateLabelCollection(
self.blockshaped_map_data.copy(), self.region_label_helper
)
self.update_label_worker.moveToThread(self.load_collection_thread)
self.load_collection_thread.started.connect(self.update_label_worker.run)
self.update_label_worker.finished.connect(self.load_collection_thread.quit)
self.update_label_worker.finished.connect(self.update_label_worker.deleteLater)
self.load_collection_thread.finished.connect(self.load_collection_thread.deleteLater)
self.update_label_worker.progress.connect(self.update_label_collection_with_raw_map_data_progress)
self.load_collection_thread.finished.connect(self.update_label_collection_with_raw_map_data_done)
self.load_collection_thread.start()
def update_label_collection_with_raw_map_data_progress(self, percentage):
self.progress_bar_helper.progress_bar_percentage_signal.emit(percentage)

Loading…
Cancel
Save