From b5e32e248d41c96cd86531268eb0fcb66c79ff77 Mon Sep 17 00:00:00 2001 From: Paulocracy <36934614+Paulocracy@users.noreply.github.com> Date: Tue, 25 Jun 2024 12:10:17 +0200 Subject: [PATCH] Preparations for Python 3.10 --- cnapy/appdata.py | 4 ++-- cnapy/gui_elements/annotation_widget.py | 2 +- cnapy/gui_elements/central_widget.py | 2 +- cnapy/gui_elements/configuration_cplex.py | 2 +- cnapy/gui_elements/map_view.py | 2 +- environment.yml | 11 ++++++----- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cnapy/appdata.py b/cnapy/appdata.py index fe5bcd6b..f622d71b 100644 --- a/cnapy/appdata.py +++ b/cnapy/appdata.py @@ -188,13 +188,13 @@ def compute_color_heat(self, value: Tuple[float, float], low, high): if high == 0.0: h = 255 else: - h = mean * 255 / high + h = round(mean * 255 / high) return QColor.fromRgbF(255-h, 255, 255 - h) else: if low == 0.0: h = 255 else: - h = mean * 255 / low + h = round(mean * 255 / low) return QColor.fromRgbF(255, 255 - h, 255 - h) def low_and_high(self) -> Tuple[int, int]: diff --git a/cnapy/gui_elements/annotation_widget.py b/cnapy/gui_elements/annotation_widget.py index 62fe5c30..a78ec05e 100644 --- a/cnapy/gui_elements/annotation_widget.py +++ b/cnapy/gui_elements/annotation_widget.py @@ -41,7 +41,7 @@ def __init__(self, parent): self.delete_anno = QPushButton("-") self.delete_anno.clicked.connect(self.delete_anno_row) lh3.addWidget(self.delete_anno) - self.open_annotation = QPushButton("Open (first)\nin browser") + self.open_annotation = QPushButton("Open chosen\nin browser") self.open_annotation.clicked.connect(self.open_in_browser) lh3.addWidget(self.open_annotation) lh2.addItem(lh3) diff --git a/cnapy/gui_elements/central_widget.py b/cnapy/gui_elements/central_widget.py index 4d2cb2c0..3854497c 100644 --- a/cnapy/gui_elements/central_widget.py +++ b/cnapy/gui_elements/central_widget.py @@ -170,7 +170,7 @@ def fit_mapview(self): def show_bottom_of_console(self): (_, r) = self.splitter2.getRange(1) - self.splitter2.moveSplitter(r*0.5, 1) + self.splitter2.moveSplitter(r//2, 1) vSB = self.console.children()[2].verticalScrollBar() max_scroll = vSB.maximum() diff --git a/cnapy/gui_elements/configuration_cplex.py b/cnapy/gui_elements/configuration_cplex.py index e39f5e5a..90a1f2a7 100644 --- a/cnapy/gui_elements/configuration_cplex.py +++ b/cnapy/gui_elements/configuration_cplex.py @@ -161,7 +161,7 @@ def run_python_connection_script(self): self.get_and_set_environmental_variable() def get_and_set_environmental_variable(self): - base_path = self.cplex_directory.text() + "cplex/python/3.8/" + base_path = self.cplex_directory.text() + "cplex/python/3.10/" folders_list = [ base_path+folder for folder in os.listdir(base_path) if os.path.isdir(base_path+folder) diff --git a/cnapy/gui_elements/map_view.py b/cnapy/gui_elements/map_view.py index 66dd5b2b..f0ab6b9d 100644 --- a/cnapy/gui_elements/map_view.py +++ b/cnapy/gui_elements/map_view.py @@ -426,7 +426,7 @@ def __init__(self, parent: MapView, r_id: str, name): self.item.setTextMargins(1, -13, 0, -10) # l t r b font = self.item.font() point_size = font.pointSize() - font.setPointSize(point_size+13) + font.setPointSizeF(point_size+13.0) self.item.setFont(font) self.item.setAttribute(Qt.WA_TranslucentBackground) diff --git a/environment.yml b/environment.yml index 373fcb1f..3a0e6131 100644 --- a/environment.yml +++ b/environment.yml @@ -11,20 +11,21 @@ dependencies: - autopep8=2.0 - pydantic=1.10 - matplotlib-base=3.6 - - pip=22 - - python=3.8 + - pip=23 + - python=3.10 - qtpy=2.3 - pyqtwebengine=5.15 - appdirs=1.4 - - cobra>=0.26.3 + - cobra>=0.29 - qtconsole=5.4 - requests=2.28 - psutil=5.9 - efmtool_link=0.0.4 - optlang_enumerator>=0.0.9 - - straindesign>=1.9 + - straindesign>=1.11 - nest-asyncio - gurobi - cplex - numpy=1.23 - - openpyxl + - scipy=1.12 # Starting from 1.13, we get StrainDesign errors :-/ + - openpyxl \ No newline at end of file