From bf040a23067efc11a55a74cf1080b250877644b4 Mon Sep 17 00:00:00 2001 From: QuimMoya Date: Mon, 26 Aug 2024 14:21:13 +0200 Subject: [PATCH 1/4] Bug fix, strange behaviour when moving substations and then dividing lines --- .idea/workspace.xml | 1057 ++++++++--------- .../Substation/substation_graphic_item.py | 3 + 2 files changed, 515 insertions(+), 545 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8b243f156..73168cc9e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -28,12 +28,9 @@ - + - - + + - { - "keyToString": { - "ASKED_ADD_EXTERNAL_FILES": "true", - "Git.Branch.Popup.ShowAllRemotes": "true", - "MATLAB_INTERPRETER": "/usr/local/MATLAB/R2018a/bin/matlab", - "Python tests.Nosetests for test_power_flow.test_zip.executor": "Debug", - "Python tests.Nosetests for test_topology_processor.test_topology_rts.executor": "Debug", - "Python tests.Nosetests for tests.test_ac_opf.executor": "Run", - "Python tests.Nosetests for tests.test_ac_opf.test_pegase89.executor": "Debug", - "Python tests.Nosetests for tests.test_hydro.executor": "Run", - "Python tests.Nosetests for tests.test_latin_hypercube.test_lhs.executor": "Run", - "Python tests.Nosetests for tests.test_opf_time_series.test_opf_ts.executor": "Run", - "Python tests.Nosetests for tests.test_topology_processor.executor": "Run", - "Python tests.Nosetests for tests.test_topology_processor.test_topology_rts.executor": "Run", - "Python tests.Nosetests in admittance_matrix_test.py.executor": "Run", - "Python tests.Nosetests in deep_copy_test.py.executor": "Run", - "Python tests.Nosetests in test_topology_processor.py.executor": "Run", - "Python tests.Nosetests in tests.executor": "Run", - "Python tests.pytest for src.tests.test_cgmes_ieeee.executor": "Run", - "Python tests.pytest for src.tests.test_cgmes_ieeee.test_ieee_grids.executor": "Debug", - "Python tests.pytest for src.tests.test_cgmes_to_gridcal_ac_transformers.test_ac_transformers3w.executor": "Debug", - "Python tests.pytest for src.tests.test_load_all_grids.test_all_grids.executor": "Run", - "Python tests.pytest for src.tests.test_load_save_load.test_load_save_load.executor": "Run", - "Python tests.pytest for src.tests.test_power_flow.executor": "Run", - "Python tests.pytest for src.tests.test_power_flow.test_controllable_shunt.executor": "Run", - "Python tests.pytest for src.tests.test_tutorials.test_define_grid_from_scratch_with_profiles.executor": "Debug", - "Python tests.pytest for test_cgmes_ieeee.test_ieee_grids.executor": "Run", - "Python tests.pytest for test_demo_5_node.test_demo_5_node.executor": "Run", - "Python tests.pytest for test_derivatives.test_bus_derivatives.executor": "Run", - "Python tests.pytest for test_nodal_capacity.test_linear_vs_nonlinear_ncap.executor": "Run", - "Python tests.pytest for test_power_flow.test_fubm.executor": "Run", - "Python tests.pytest for test_power_flow.test_power_flow_control_with_pst.executor": "Debug", - "Python tests.pytest for test_power_flow.test_power_flow_control_with_pst_pt.executor": "Run", - "Python tests.pytest for test_power_flow.test_qf_control_with_ltc.executor": "Run", - "Python tests.pytest for test_power_flow.test_qt_control_with_ltc.executor": "Debug", - "Python tests.pytest for test_power_flow.test_voltage_control_with_ltc.executor": "Run", - "Python tests.pytest for test_power_flow.test_voltage_local_control_with_generation.executor": "Debug", - "Python tests.pytest for test_power_flow.test_voltage_remote_control_with_generation.executor": "Debug", - "Python tests.pytest for test_sparse2.test_mat_mat_mult.executor": "Run", - "Python tests.pytest for test_topology_processor.test_topology_4_nodes_A.executor": "Debug", - "Python tests.pytest for test_topology_processor.test_topology_4_nodes_B.executor": "Debug", - "Python tests.pytest for test_transformer_controls.test_v_control_true.executor": "Debug", - "Python tests.pytest in test_cgmes_ieeee.py.executor": "Run", - "Python tests.pytest in test_deep_copy.py.executor": "Run", - "Python tests.pytest in test_load_save_load.py.executor": "Debug", - "Python tests.pytest in test_power_flow.py.executor": "Run", - "Python tests.pytest in test_profiles.py.executor": "Run", - "Python tests.pytest in test_topology_processor.py.executor": "Run", - "Python tests.pytest in test_transformer_controls.py.executor": "Run", - "Python tests.pytest in tests.executor": "Run", - "Python.AnalysisDialogue.executor": "Run", - "Python.ExecuteGridCal.executor": "Run", - "Python.GridCalMain.executor": "Run", - "Python.cgmes_rdfs_graph.executor": "Run", - "Python.download_stats.executor": "Run", - "Python.fubm_example.executor": "Run", - "Python.generate_ssl_key.executor": "Run", - "Python.make.executor": "Run", - "Python.new_circuit_objects.executor": "Run", - "Python.pymoo_example.executor": "Debug", - "Python.raw_imp_exp_test.executor": "Run", - "Python.run.executor": "Run", - "Python.update_gui_file.executor": "Run", - "Python.upload_to_pypi.executor": "Run", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "git-widget-placeholder": "199__finalize__cgmes__import", - "last_opened_file_path": "/home/santi/Documentos/Git/GitHub/GridCal/src/GridCalEngine/Simulations/PowerFlow/NumericalMethods", - "node.js.detected.package.eslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "run.code.analysis.last.selected.profile": "aDefault", - "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable", - "two.files.diff.last.used.file": "C:/WorkProjects/PycharmProjects/GridCal/src/trunk/cgmes_py_generator/cgmes_v2_4_15/cgmes_enums.py", - "vue.rearranger.settings.migration": "true" + +}]]> @@ -1470,7 +1475,9 @@ - + + + 1656059954202 @@ -1815,7 +1822,7 @@ - @@ -1862,7 +1869,6 @@ - @@ -1887,7 +1893,8 @@ - @@ -2255,16 +2262,6 @@ 108 - - + - + + - + @@ -2489,8 +2413,8 @@ - + @@ -2501,8 +2425,8 @@ - + @@ -2511,14 +2435,14 @@ - - - + + + - + @@ -2547,8 +2471,8 @@ - + @@ -2588,8 +2512,8 @@ - + @@ -2607,8 +2531,8 @@ - + @@ -2891,7 +2815,7 @@ - + diff --git a/src/GridCal/Gui/Main/GridCalMain.py b/src/GridCal/Gui/Main/GridCalMain.py index da34e1425..9a37d2077 100644 --- a/src/GridCal/Gui/Main/GridCalMain.py +++ b/src/GridCal/Gui/Main/GridCalMain.py @@ -103,6 +103,9 @@ def load_all_config(self) -> None: self.load_server_config() self.add_plugins() + # apply the theme selected by the settings + self.change_theme_mode() + def closeEvent(self, event: QtGui.QCloseEvent) -> None: """ Close event diff --git a/src/GridCal/Gui/Main/SubClasses/io.py b/src/GridCal/Gui/Main/SubClasses/io.py index 2f839a1ea..991795ac9 100644 --- a/src/GridCal/Gui/Main/SubClasses/io.py +++ b/src/GridCal/Gui/Main/SubClasses/io.py @@ -251,7 +251,9 @@ def open_file(self): else: warning_msg('There is a file being processed now.') - def open_file_threaded(self, post_function=None, allow_diff_file_format: bool = False, title: str = 'Open file'): + def open_file_threaded(self, post_function=None, + allow_diff_file_format: bool = False, + title: str = 'Open file'): """ Open file from a Qt thread to remain responsive :param post_function: Any function to run after @@ -422,7 +424,7 @@ def post_open_file(self) -> None: self.collect_memory() self.setup_time_sliders() self.get_circuit_snapshot_datetime() - + self.change_theme_mode() def select_csv_file(self, caption='Open CSV file'): """ @@ -466,60 +468,60 @@ def post_add_circuit(self): if self.open_file_thread_object.valid: - if not new_circuit.valid_for_simulation(): - # load the circuit right away - self.stuff_running_now.append('file_open') - self.post_open_file() - else: - # add the circuit - logger = self.circuit.add_circuit(new_circuit) + # if not new_circuit.valid_for_simulation(): + # # load the circuit right away + # self.stuff_running_now.append('file_open') + # self.post_open_file() + # else: + # add the circuit + logger = self.circuit.add_circuit(new_circuit) - if len(logger) > 0: - dlg = LogsDialogue('File merge logger', logger) - dlg.exec_() + if len(logger) > 0: + dlg = LogsDialogue('File merge logger', logger) + dlg.exec_() - dlg2 = CustomQuestionDialogue(title="Grid differential", - question="How do you want to represent the loaded grid?", - answer1="Create new diagram", - answer2="Add to current diagram") - dlg2.exec_() + dlg2 = CustomQuestionDialogue(title="Grid differential", + question="How do you want to represent the loaded grid?", + answer1="Create new diagram", + answer2="Add to current diagram") + dlg2.exec_() - if dlg2.accepted_answer == 1: - # Create a blank diagram and add to it - diagram_widget = self.create_blank_schematic_diagram(name=new_circuit.name) + if dlg2.accepted_answer == 1: + # Create a blank diagram and add to it + diagram_widget = self.create_blank_schematic_diagram(name=new_circuit.name) - elif dlg2.accepted_answer == 2: - diagram_widget = self.get_selected_diagram_widget() + elif dlg2.accepted_answer == 2: + diagram_widget = self.get_selected_diagram_widget() - else: - return - - if diagram_widget is not None: - injections_by_bus = new_circuit.get_injection_devices_grouped_by_bus() - injections_by_fluid_node = new_circuit.get_injection_devices_grouped_by_fluid_node() - injections_by_cn = new_circuit.get_injection_devices_grouped_by_cn() - diagram_widget.add_elements_to_schematic(buses=new_circuit.buses, - connectivity_nodes=new_circuit.connectivity_nodes, - busbars=new_circuit.bus_bars, - lines=new_circuit.lines, - dc_lines=new_circuit.dc_lines, - transformers2w=new_circuit.transformers2w, - transformers3w=new_circuit.transformers3w, - hvdc_lines=new_circuit.hvdc_lines, - vsc_devices=new_circuit.vsc_devices, - upfc_devices=new_circuit.upfc_devices, - switches=new_circuit.switch_devices, - fluid_nodes=new_circuit.fluid_nodes, - fluid_paths=new_circuit.fluid_paths, - injections_by_bus=injections_by_bus, - injections_by_fluid_node=injections_by_fluid_node, - injections_by_cn=injections_by_cn, - explode_factor=1.0, - prog_func=None, - text_func=None) - diagram_widget.set_selected_buses(buses=new_circuit.buses) - else: - info_msg("No diagram was selected...", title="Add to current diagram") + else: + return + + if diagram_widget is not None: + injections_by_bus = new_circuit.get_injection_devices_grouped_by_bus() + injections_by_fluid_node = new_circuit.get_injection_devices_grouped_by_fluid_node() + injections_by_cn = new_circuit.get_injection_devices_grouped_by_cn() + diagram_widget.add_elements_to_schematic(buses=new_circuit.buses, + connectivity_nodes=new_circuit.connectivity_nodes, + busbars=new_circuit.bus_bars, + lines=new_circuit.lines, + dc_lines=new_circuit.dc_lines, + transformers2w=new_circuit.transformers2w, + transformers3w=new_circuit.transformers3w, + hvdc_lines=new_circuit.hvdc_lines, + vsc_devices=new_circuit.vsc_devices, + upfc_devices=new_circuit.upfc_devices, + switches=new_circuit.switch_devices, + fluid_nodes=new_circuit.fluid_nodes, + fluid_paths=new_circuit.fluid_paths, + injections_by_bus=injections_by_bus, + injections_by_fluid_node=injections_by_fluid_node, + injections_by_cn=injections_by_cn, + explode_factor=1.0, + prog_func=None, + text_func=None) + diagram_widget.set_selected_buses(buses=new_circuit.buses) + else: + info_msg("No diagram was selected...", title="Add to current diagram") def export_circuit_differential(self): """ @@ -903,7 +905,8 @@ def export_simulation_data(self): for elm_type in elms_in_category: name = f"{category}_{elm_type}@{c}" df = calc_input.get_structure(elm_type).astype(str) - df.to_excel(excel_writer=writer, sheet_name=name[:31]) # excel supports 31 chars per sheet name + df.to_excel(excel_writer=writer, + sheet_name=name[:31]) # excel supports 31 chars per sheet name def load_results_driver(self): """ @@ -1029,4 +1032,4 @@ def save_custom_catalogue(self): filename += ".xlsx" if filename != "": - save_catalogue(fname=filename, grid=self.circuit) \ No newline at end of file + save_catalogue(fname=filename, grid=self.circuit) From 569b3231a14a8377e9ff8b31b253c310dfe77de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Pe=C3=B1ate=20Vera?= Date: Sun, 1 Sep 2024 17:44:37 +0100 Subject: [PATCH 3/4] Fixed qdarktheme bug in macos --- .idea/workspace.xml | 1420 +++++++---------- .../_os_appearance/_accent/__init__.py | 2 +- 2 files changed, 609 insertions(+), 813 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2e26c26e6..9ae191d2d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -28,10 +28,9 @@