1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
|
# -*- coding: utf-8; -*-
"""
Copyright (c) 2019 Rolf Hempel, rolf6419@gmx.de
This file is part of the PlanetarySystemStacker tool (PSS).
https://github.com/Rolf-Hempel/PlanetarySystemStacker
PSS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PSS. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtGui import QIntValidator
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel
from configuration import ConfigurationParameters
from parameter_configuration import Ui_ConfigurationDialog
class ConfigurationEditor(QtWidgets.QFrame, Ui_ConfigurationDialog):
"""
Update the parameters used by PlanetarySystemStacker which are stored in the configuration
object. The interaction with the user is through the ConfigurationDialog class.
"""
def __init__(self, parent_gui, parent=None):
QtWidgets.QFrame.__init__(self, parent)
self.setupUi(self)
self.setFrameShape(QtWidgets.QFrame.Panel)
self.setFrameShadow(QtWidgets.QFrame.Sunken)
self.setObjectName("configuration_editor")
self.setFixedSize(900, 600)
self.parent_gui = parent_gui
self.configuration = parent_gui.configuration
# On return set the following variable to the activity to which the workflow has to go back
# due to parameter changes. If it is None, nothing has to be repeated.
self.configuration.go_back_to_activity = None
self.configuration.configuration_changed = False
# Create a ConfigurationParameters object and set it to the current parameters.
self.config_copy = ConfigurationParameters()
self.config_copy.copy_from_config_object(self.configuration)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
# Connect local methods with GUI change events.
self.fgw_slider_value.valueChanged['int'].connect(self.fgw_changed)
self.fdb_comboBox.addItem('Auto detect color')
self.fdb_comboBox.addItem('Grayscale')
self.fdb_comboBox.addItem('RGB')
self.fdb_comboBox.addItem('BGR')
self.fdb_comboBox.addItem('Force Bayer RGGB')
self.fdb_comboBox.addItem('Force Bayer GRBG')
self.fdb_comboBox.addItem('Force Bayer GBRG')
self.fdb_comboBox.addItem('Force Bayer BGGR')
self.fdb_comboBox.activated[str].connect(self.fdb_changed)
self.fdbm_comboBox.addItem('Bilinear')
self.fdbm_comboBox.addItem('Variable Number of Gradients')
self.fdbm_comboBox.addItem('Edge Aware')
self.fdbm_comboBox.activated[str].connect(self.fdbm_changed)
self.fn_checkBox.stateChanged.connect(self.fn_changed)
self.fnt_slider_value.valueChanged['int'].connect(self.fnt_changed)
self.afm_comboBox.addItem('Surface')
self.afm_comboBox.addItem('Planet')
self.afm_comboBox.activated[str].connect(self.afm_changed)
self.afa_checkBox.stateChanged.connect(self.afa_changed)
self.afrsf_slider_value.valueChanged['int'].connect(self.afrsf_changed)
self.afsw_slider_value.valueChanged['int'].connect(self.afsw_changed)
self.afafp_slider_value.valueChanged['int'].connect(self.afafp_changed)
self.efs_checkBox.stateChanged.connect(self.efs_changed)
self.fco_checkBox.stateChanged.connect(self.fco_changed)
self.gpwptf_checkBox.stateChanged.connect(self.gpwptf_changed)
self.gpspwr_checkBox.stateChanged.connect(self.gpspwr_changed)
self.gppl_spinBox.valueChanged['int'].connect(self.gppl_changed)
self.gpbl_combobox.addItem('auto')
self.gpbl_combobox.addItem('0')
self.gpbl_combobox.addItem('1')
self.gpbl_combobox.addItem('2')
self.gpbl_combobox.addItem('3')
self.gpbl_combobox.addItem('4')
self.gpbl_combobox.activated[str].connect(self.gpbl_changed)
self.mr_checkBox.stateChanged.connect(self.mr_changed)
self.mr_lineEdit.setValidator(QIntValidator(1, 2147483647))
self.mr_lineEdit.textChanged.connect(self.mr_text_changed)
self.gpif_comboBox.addItem('png')
self.gpif_comboBox.addItem('tiff')
self.gpif_comboBox.addItem('fits')
self.gpif_comboBox.activated[str].connect(self.gpif_changed)
self.aphbw_slider_value.valueChanged['int'].connect(self.aphbw_changed)
self.apsw_slider_value.valueChanged['int'].connect(self.apsw_changed)
self.apst_slider_value.valueChanged['int'].connect(self.apst_changed)
self.apbt_slider_value.valueChanged['int'].connect(self.apbt_changed)
self.apfp_comboBox.addItem('Percent of frames to be stacked')
self.apfp_comboBox.addItem('Number of frames to be stacked')
self.apfp_comboBox.activated[str].connect(self.apfp_state_changed)
self.apfp_spinBox.valueChanged['int'].connect(self.apfp_value_changed)
self.spp_checkBox.stateChanged.connect(self.spp_changed)
self.ipfn_checkBox.stateChanged.connect(self.ipfn_changed)
self.nfs_checkBox.stateChanged.connect(self.nfs_changed)
self.pfs_checkBox.stateChanged.connect(self.pfs_changed)
self.apbs_checkBox.stateChanged.connect(self.apbs_changed)
self.nap_checkBox.stateChanged.connect(self.nap_changed)
self.sfdfs_comboBox.addItem('Off')
self.sfdfs_comboBox.addItem('1.5x')
self.sfdfs_comboBox.addItem('2x')
self.sfdfs_comboBox.addItem('3x')
self.sfdfs_comboBox.activated[str].connect(self.sfdfs_changed)
self.restore_standard_values.clicked.connect(self.restore_standard_parameters)
self.initialize_widgets_and_local_parameters()
def initialize_widgets_and_local_parameters(self):
"""
Initialize GUI widgets with current configuration parameter values.
:return: -
"""
self.fgw_slider_value.setValue(int((self.config_copy.frames_gauss_width + 1) / 2))
self.fgw_label_display.setText(str(self.config_copy.frames_gauss_width))
index = self.fdb_comboBox.findText(self.config_copy.frames_debayering_default,
QtCore.Qt.MatchFixedString)
if index >= 0:
self.fdb_comboBox.setCurrentIndex(index)
index = self.fdbm_comboBox.findText(self.config_copy.frames_debayering_method,
QtCore.Qt.MatchFixedString)
if index >= 0:
self.fdbm_comboBox.setCurrentIndex(index)
index = self.afm_comboBox.findText(self.config_copy.align_frames_mode,
QtCore.Qt.MatchFixedString)
if index >= 0:
self.afm_comboBox.setCurrentIndex(index)
self.afm_activate_deactivate_widgets()
self.afa_checkBox.setChecked(self.config_copy.align_frames_automation)
self.afrsf_slider_value.setValue(
int(100. / self.config_copy.align_frames_rectangle_scale_factor))
self.afrsf_label_display.setText(
str(int(100. / self.config_copy.align_frames_rectangle_scale_factor)))
self.afsw_slider_value.setValue(self.config_copy.align_frames_search_width)
self.afsw_label_display.setText(str(self.config_copy.align_frames_search_width))
self.afafp_slider_value.setValue(self.config_copy.align_frames_average_frame_percent)
self.afafp_label_display.setText(str(self.config_copy.align_frames_average_frame_percent))
self.efs_checkBox.setChecked(self.config_copy.frames_add_selection_dialog)
self.fco_checkBox.setChecked(self.config_copy.align_frames_fast_changing_object)
self.gpwptf_checkBox.setChecked(self.config_copy.global_parameters_write_protocol_to_file)
self.gpspwr_checkBox.setChecked(
self.config_copy.global_parameters_store_protocol_with_result)
self.gppl_spinBox.setValue(self.config_copy.global_parameters_protocol_level)
if self.config_copy.global_parameters_buffering_level != -1:
self.gpbl_combobox.setCurrentIndex(self.config_copy.global_parameters_buffering_level+1)
else:
self.gpbl_combobox.setCurrentIndex(0)
self.mr_lineEdit.setText(str(self.config_copy.global_parameters_maximum_memory_amount))
self.mr_checkBox.setChecked(self.config_copy.global_parameters_maximum_memory_active)
self.make_mr_label_visible(self.config_copy.global_parameters_maximum_memory_active)
self.mr_label.setStyleSheet('color: red')
if not self.config_copy.global_parameters_maximum_memory_active:
self.mr_lineEdit.setEnabled(False)
index = self.gpif_comboBox.findText(self.config_copy.global_parameters_image_format,
QtCore.Qt.MatchFixedString)
if index >= 0:
self.gpif_comboBox.setCurrentIndex(index)
self.ipfn_checkBox.setChecked(self.config_copy.global_parameters_parameters_in_filename)
self.nfs_checkBox.setChecked(self.config_copy.global_parameters_stack_number_frames)
self.pfs_checkBox.setChecked(self.config_copy.global_parameters_stack_percent_frames)
self.apbs_checkBox.setChecked(self.config_copy.global_parameters_ap_box_size)
self.nap_checkBox.setChecked(self.config_copy.global_parameters_ap_number)
self.aphbw_slider_value.setValue(self.config_copy.alignment_points_half_box_width * 2)
self.aphbw_label_display.setText(str(self.config_copy.alignment_points_half_box_width * 2))
self.apsw_slider_value.setValue(self.config_copy.alignment_points_search_width)
self.apsw_label_display.setText(str(self.config_copy.alignment_points_search_width))
self.apst_slider_value.setValue(round(self.config_copy.alignment_points_structure_threshold * 100))
self.apst_label_display.setText(str(self.config_copy.alignment_points_structure_threshold))
self.apbt_slider_value.setValue(self.config_copy.alignment_points_brightness_threshold)
self.apbt_label_display.setText(str(self.config_copy.alignment_points_brightness_threshold))
if self.config_copy.alignment_points_frame_percent != -1:
self.apfp_comboBox.setCurrentIndex(0)
self.apfp_spinBox.setMaximum(100)
self.apfp_spinBox.setValue(self.config_copy.alignment_points_frame_percent)
else:
self.apfp_comboBox.setCurrentIndex(1)
self.apfp_spinBox.setMaximum(1000000)
self.apfp_spinBox.setValue(self.config_copy.alignment_points_frame_number)
self.spp_checkBox.setChecked(self.config_copy.global_parameters_include_postprocessing)
self.fn_checkBox.setChecked(self.config_copy.frames_normalization)
self.fn_activate_deactivate_widgets()
self.fnt_slider_value.setValue(self.config_copy.frames_normalization_threshold)
self.fnt_label_display.setText(str(self.config_copy.frames_normalization_threshold))
self.ipfn_activate_deactivate_widgets()
index = self.sfdfs_comboBox.findText(self.config_copy.stack_frames_drizzle_factor_string,
QtCore.Qt.MatchFixedString)
if index >= 0:
self.sfdfs_comboBox.setCurrentIndex(index)
def fgw_changed(self, value):
"""
When the widget changes its value, update the corresponding entry in the configuration copy.
Please note that for some parameters the representations differ.
The methods following this one do the same for all other configuration parameters.
:param value: New value sent by widget
:return: -
"""
self.config_copy.frames_gauss_width = 2 * value - 1
self.fgw_label_display.setText(str(self.config_copy.frames_gauss_width))
def fdb_changed(self, value):
self.config_copy.frames_debayering_default = value
def fdbm_changed(self, value):
self.config_copy.frames_debayering_method = value
def afm_changed(self, value):
self.config_copy.align_frames_mode = value
self.afm_activate_deactivate_widgets()
def afm_activate_deactivate_widgets(self):
"""
Special case: Depending on the "frame stabilization mode" selected, some other parameters
do not make sense, so they are greyed out (for case 'Planet').
:return:-
"""
if self.config_copy.align_frames_mode == 'Planet':
self.afa_checkBox.setEnabled(False)
self.afrsf_label_display.setEnabled(False)
self.afrsf_slider_value.setEnabled(False)
self.afrsf_label_parameter.setEnabled(False)
self.afsw_label_parameter.setEnabled(False)
self.afsw_slider_value.setEnabled(False)
self.afsw_label_display.setEnabled(False)
else:
self.afa_checkBox.setEnabled(True)
self.afrsf_label_display.setEnabled(True)
self.afrsf_slider_value.setEnabled(True)
self.afrsf_label_parameter.setEnabled(True)
self.afsw_label_parameter.setEnabled(True)
self.afsw_slider_value.setEnabled(True)
self.afsw_label_display.setEnabled(True)
def fn_activate_deactivate_widgets(self):
if self.config_copy.frames_normalization:
self.fnt_label_display.setEnabled(True)
self.fnt_slider_value.setEnabled(True)
self.fnt_label_parameter.setEnabled(True)
else:
self.fnt_label_display.setEnabled(False)
self.fnt_slider_value.setEnabled(False)
self.fnt_label_parameter.setEnabled(False)
def ipfn_activate_deactivate_widgets(self):
if self.config_copy.global_parameters_parameters_in_filename:
self.nfs_checkBox.setEnabled(True)
self.pfs_checkBox.setEnabled(True)
self.apbs_checkBox.setEnabled(True)
self.nap_checkBox.setEnabled(True)
else:
self.nfs_checkBox.setEnabled(False)
self.pfs_checkBox.setEnabled(False)
self.apbs_checkBox.setEnabled(False)
self.nap_checkBox.setEnabled(False)
def afa_changed(self, state):
self.config_copy.align_frames_automation = (state == QtCore.Qt.Checked)
def afrsf_changed(self, value):
self.config_copy.align_frames_rectangle_scale_factor = 100. / value
def afsw_changed(self, value):
self.config_copy.align_frames_search_width = value
def afafp_changed(self, value):
self.config_copy.align_frames_average_frame_percent = value
def efs_changed(self, state):
self.config_copy.frames_add_selection_dialog = (state == QtCore.Qt.Checked)
def fco_changed(self, state):
self.config_copy.align_frames_fast_changing_object = (state == QtCore.Qt.Checked)
def gpwptf_changed(self, state):
self.config_copy.global_parameters_write_protocol_to_file = (state == QtCore.Qt.Checked)
def gpspwr_changed(self, state):
self.config_copy.global_parameters_store_protocol_with_result = (state == QtCore.Qt.Checked)
def gppl_changed(self, value):
self.config_copy.global_parameters_protocol_level = value
def gpbl_changed(self, value):
if value == "auto":
self.config_copy.global_parameters_buffering_level = -1
else:
self.config_copy.global_parameters_buffering_level = int(value)
def mr_activate(self, state):
if state:
self.config_copy.global_parameters_maximum_memory_active = True
# With a fixed memory limit buffering is set to 'auto'
self.gpbl_combobox.setCurrentText('auto')
self.gpbl_combobox.setEnabled(False)
self.mr_lineEdit.setEnabled(True)
else:
self.config_copy.global_parameters_maximum_memory_active = False
self.config_copy.global_parameters_buffering_level = -1
self.gpbl_combobox.setEnabled(True)
self.mr_lineEdit.setEnabled(False)
def make_mr_label_visible(self, state):
if state:
text = "PlanetarySystemStacker takes no responsibility for enough memory being " \
"available.\r\n" + "Setting the memory limit too high may cause degraded OS " \
"performance and/or process crashes."
else:
text = ""
self.mr_label.setText(text)
def mr_changed(self, state):
max_memory_active = (state == QtCore.Qt.Checked)
self.mr_activate(max_memory_active)
self.make_mr_label_visible(max_memory_active)
def mr_text_changed(self, state):
try:
value = int(state)
if value > 0:
self.config_copy.global_parameters_maximum_memory_amount = value
else:
self.mr_lineEdit.setText(
str(self.config_copy.global_parameters_maximum_memory_amount))
raise ValueError
except ValueError:
return
def gpif_changed(self, value):
self.config_copy.global_parameters_image_format = value
def aphbw_changed(self, value):
self.config_copy.alignment_points_half_box_width = int(value / 2)
def apsw_changed(self, value):
self.config_copy.alignment_points_search_width = value
def apst_changed(self, value):
self.config_copy.alignment_points_structure_threshold = value / 100.
self.apst_label_display.setText(str(self.config_copy.alignment_points_structure_threshold))
def apbt_changed(self, value):
self.config_copy.alignment_points_brightness_threshold = value
def apfp_state_changed(self, value):
self.apfp_spinBox.blockSignals(True)
if value == 'Percent of frames to be stacked':
self.apfp_spinBox.setMaximum(100)
if self.config_copy.alignment_points_frame_percent > 0:
self.apfp_spinBox.setValue(self.config_copy.alignment_points_frame_percent)
else:
self.apfp_spinBox.setValue(0)
self.apfp_spinBox.clear()
else:
self.apfp_spinBox.setMaximum(1000000)
if self.config_copy.alignment_points_frame_number > 0:
self.apfp_spinBox.setValue(self.config_copy.alignment_points_frame_number)
else:
self.apfp_spinBox.setValue(0)
self.apfp_spinBox.clear()
self.apfp_spinBox.blockSignals(False)
def apfp_value_changed(self, value):
if self.apfp_comboBox.currentIndex() == 0:
self.config_copy.alignment_points_frame_percent = value
else:
self.config_copy.alignment_points_frame_number = value
def spp_changed(self, state):
self.config_copy.global_parameters_include_postprocessing = (state == QtCore.Qt.Checked)
def fn_changed(self, state):
self.config_copy.frames_normalization = (state == QtCore.Qt.Checked)
self.fn_activate_deactivate_widgets()
def fnt_changed(self, value):
self.config_copy.frames_normalization_threshold = value
self.fnt_label_display.setText(str(self.config_copy.frames_normalization_threshold))
def ipfn_changed(self, state):
self.config_copy.global_parameters_parameters_in_filename = (state == QtCore.Qt.Checked)
self.ipfn_activate_deactivate_widgets()
def nfs_changed(self, state):
self.config_copy.global_parameters_stack_number_frames = (state == QtCore.Qt.Checked)
def pfs_changed(self, state):
self.config_copy.global_parameters_stack_percent_frames = (state == QtCore.Qt.Checked)
def apbs_changed(self, state):
self.config_copy.global_parameters_ap_box_size = (state == QtCore.Qt.Checked)
def nap_changed(self, state):
self.config_copy.global_parameters_ap_number = (state == QtCore.Qt.Checked)
def sfdfs_changed(self, value):
self.config_copy.stack_frames_drizzle_factor_string = value
def restore_standard_parameters(self):
"""
Reset configuration parameters and GUI widget settings to standard values. Mark
configuration as changed. This may be too pessimistic, if standard values were not changed
before.
:return:
"""
self.config_copy.set_defaults()
self.initialize_widgets_and_local_parameters()
def accept(self):
"""
If the OK button is clicked and the configuration has been changed, check if values have
been changed and assign the new values to configuration parameters.
:return: -
"""
go_back_to_activities = []
if self.config_copy.alignment_points_frame_percent != \
self.configuration.alignment_points_frame_percent or \
self.config_copy.alignment_points_frame_number != \
self.configuration.alignment_points_frame_number:
# Additional to the state of the comboBox check if a valid number has been entered.
if self.apfp_comboBox.currentIndex() == 0 and \
self.config_copy.alignment_points_frame_percent > 0:
self.configuration.alignment_points_frame_percent = \
self.config_copy.alignment_points_frame_percent
self.configuration.alignment_points_frame_number = -1
self.configuration.configuration_changed = True
go_back_to_activities.append('Select stack size')
elif self.apfp_comboBox.currentIndex() == 1 and \
self.config_copy.alignment_points_frame_number > 0:
self.configuration.alignment_points_frame_percent = -1
self.configuration.alignment_points_frame_number = \
self.config_copy.alignment_points_frame_number
self.configuration.configuration_changed = True
go_back_to_activities.append('Select stack size')
if self.config_copy.alignment_points_brightness_threshold != \
self.configuration.alignment_points_brightness_threshold:
self.configuration.alignment_points_brightness_threshold = \
self.config_copy.alignment_points_brightness_threshold
self.configuration.configuration_changed = True
go_back_to_activities.append('Set alignment points')
if self.config_copy.alignment_points_structure_threshold != \
self.configuration.alignment_points_structure_threshold:
self.configuration.alignment_points_structure_threshold = \
self.config_copy.alignment_points_structure_threshold
self.configuration.configuration_changed = True
go_back_to_activities.append('Set alignment points')
if self.config_copy.alignment_points_search_width != \
self.configuration.alignment_points_search_width:
self.configuration.alignment_points_search_width = \
self.config_copy.alignment_points_search_width
self.configuration.configuration_changed = True
go_back_to_activities.append('Set alignment points')
if self.config_copy.alignment_points_half_box_width != \
self.configuration.alignment_points_half_box_width:
self.configuration.alignment_points_half_box_width = \
self.config_copy.alignment_points_half_box_width
self.configuration.configuration_changed = True
go_back_to_activities.append('Set alignment points')
if self.config_copy.align_frames_average_frame_percent != \
self.configuration.align_frames_average_frame_percent:
self.configuration.align_frames_average_frame_percent = \
self.config_copy.align_frames_average_frame_percent
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.align_frames_search_width != \
self.configuration.align_frames_search_width:
self.configuration.align_frames_search_width = \
self.config_copy.align_frames_search_width
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.align_frames_rectangle_scale_factor != \
self.configuration.align_frames_rectangle_scale_factor:
self.configuration.align_frames_rectangle_scale_factor = \
self.config_copy.align_frames_rectangle_scale_factor
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.align_frames_automation != self.configuration.align_frames_automation:
self.configuration.align_frames_automation = self.config_copy.align_frames_automation
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.align_frames_mode != self.configuration.align_frames_mode:
self.configuration.align_frames_mode = self.config_copy.align_frames_mode
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.frames_gauss_width != self.configuration.frames_gauss_width:
self.configuration.frames_gauss_width = self.config_copy.frames_gauss_width
self.configuration.configuration_changed = True
go_back_to_activities.append('Read frames')
if self.config_copy.frames_debayering_default != self.configuration.frames_debayering_default:
self.configuration.frames_debayering_default = self.config_copy.frames_debayering_default
self.configuration.configuration_changed = True
go_back_to_activities.append('Read frames')
if self.config_copy.frames_debayering_method != self.configuration.frames_debayering_method:
self.configuration.frames_debayering_method = self.config_copy.frames_debayering_method
self.configuration.configuration_changed = True
go_back_to_activities.append('Read frames')
if self.config_copy.frames_normalization != self.configuration.frames_normalization:
self.configuration.frames_normalization = self.config_copy.frames_normalization
self.configuration.configuration_changed = True
go_back_to_activities.append('Compute frame qualities')
if self.config_copy.frames_normalization_threshold != \
self.configuration.frames_normalization_threshold:
self.configuration.frames_normalization_threshold = \
self.config_copy.frames_normalization_threshold
self.configuration.configuration_changed = True
go_back_to_activities.append('Compute frame qualities')
if self.config_copy.frames_add_selection_dialog != \
self.configuration.frames_add_selection_dialog:
self.configuration.frames_add_selection_dialog = \
self.config_copy.frames_add_selection_dialog
self.configuration.configuration_changed = True
if self.config_copy.align_frames_fast_changing_object != \
self.configuration.align_frames_fast_changing_object:
self.configuration.align_frames_fast_changing_object = \
self.config_copy.align_frames_fast_changing_object
self.configuration.configuration_changed = True
go_back_to_activities.append('Align frames')
if self.config_copy.global_parameters_store_protocol_with_result != \
self.configuration.global_parameters_store_protocol_with_result:
self.configuration.global_parameters_store_protocol_with_result = \
self.config_copy.global_parameters_store_protocol_with_result
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_write_protocol_to_file != \
self.configuration.global_parameters_write_protocol_to_file:
self.configuration.global_parameters_write_protocol_to_file = \
self.config_copy.global_parameters_write_protocol_to_file
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_protocol_level != \
self.configuration.global_parameters_protocol_level:
self.configuration.global_parameters_protocol_level = \
self.config_copy.global_parameters_protocol_level
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_buffering_level != \
self.configuration.global_parameters_buffering_level:
self.configuration.global_parameters_buffering_level = \
self.config_copy.global_parameters_buffering_level
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_maximum_memory_active != \
self.configuration.global_parameters_maximum_memory_active:
self.configuration.global_parameters_maximum_memory_active = \
self.config_copy.global_parameters_maximum_memory_active
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_maximum_memory_amount != \
self.configuration.global_parameters_maximum_memory_amount:
self.configuration.global_parameters_maximum_memory_amount = \
self.config_copy.global_parameters_maximum_memory_amount
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_include_postprocessing != \
self.configuration.global_parameters_include_postprocessing:
self.configuration.global_parameters_include_postprocessing = \
self.config_copy.global_parameters_include_postprocessing
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_image_format != \
self.configuration.global_parameters_image_format:
self.configuration.global_parameters_image_format = \
self.config_copy.global_parameters_image_format
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_parameters_in_filename != \
self.configuration.global_parameters_parameters_in_filename:
self.configuration.global_parameters_parameters_in_filename = \
self.config_copy.global_parameters_parameters_in_filename
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_stack_number_frames != \
self.configuration.global_parameters_stack_number_frames:
self.configuration.global_parameters_stack_number_frames = \
self.config_copy.global_parameters_stack_number_frames
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_stack_percent_frames != \
self.configuration.global_parameters_stack_percent_frames:
self.configuration.global_parameters_stack_percent_frames = \
self.config_copy.global_parameters_stack_percent_frames
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_ap_box_size != \
self.configuration.global_parameters_ap_box_size:
self.configuration.global_parameters_ap_box_size = \
self.config_copy.global_parameters_ap_box_size
self.configuration.configuration_changed = True
if self.config_copy.global_parameters_ap_number != \
self.configuration.global_parameters_ap_number:
self.configuration.global_parameters_ap_number = \
self.config_copy.global_parameters_ap_number
self.configuration.configuration_changed = True
if self.config_copy.stack_frames_drizzle_factor_string != self.configuration.stack_frames_drizzle_factor_string:
self.configuration.stack_frames_drizzle_factor_string = self.config_copy.stack_frames_drizzle_factor_string
self.configuration.configuration_changed = True
go_back_to_activities.append('Stack frames')
# Set dependent parameters.
self.configuration.set_derived_parameters()
# If the change of parameters require going back in the workflow, find the latest phase
# which is safe to go back to.
if go_back_to_activities:
self.parent_gui.signal_set_go_back_activity.emit(go_back_to_activities)
self.close()
def reject(self):
"""
The Cancel button is pressed, discard the changes and close the GUI window.
:return: -
"""
self.configuration.configuration_changed = False
self.configuration.go_back_to_activity = None
self.close()
def closeEvent(self, event):
# Write ".ini" file if it does not exist yet or parameters have changed.
if not self.configuration.config_file_exists or self.configuration.configuration_changed:
self.configuration.write_config()
self.parent_gui.display_widget(None, display=False)
self.close()
|