diff --git a/Balance_Binary.ipynb b/Balance_Binary.ipynb index 7359f472dc557dc785cda30070d345f94243ad41..f5b6b87cf0e043d78f95b6b9629dc60ca50cc40e 100644 --- a/Balance_Binary.ipynb +++ b/Balance_Binary.ipynb @@ -176,50 +176,7 @@ } } }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "4368c6e2350c4b0c92d6cf8f7d734a7b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1606140b05984266b85bef715826cc19", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5bd5724182034d35b60cd23fa0a4bc9b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "bilanz_1 = no_bi.binary_node('bilanz_1') # Umgebungs\n", "step = no_ba.step_single('step')\n", @@ -278,7 +235,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "96c8c956f265470da69a1253e650b386", + "model_id": "056f50bccc764cb9abda14b18b6f1d74", "version_major": 2, "version_minor": 0 }, @@ -318,7 +275,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "35ea6dda14f247d5b73577a34d87eab4", + "model_id": "df4f302df2794b3592111ef8250b63d6", "version_major": 2, "version_minor": 0 }, @@ -358,7 +315,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "90ce2d0e300749099caa10a06a4563e6", + "model_id": "387ddd748f7c439eb5f9853ae7c70353", "version_major": 2, "version_minor": 0 }, @@ -368,48 +325,11 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "749407c2429a4eae8e8d4f623bb02505", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" } ], "source": [ "step.Show_GUI()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6de5555e-b239-41f5-82e6-8691f8eb946a", - "metadata": { - "extensions": { - "jupyter_dashboards": { - "activeView": "grid_default", - "views": { - "grid_default": { - "col": null, - "height": 2, - "hidden": true, - "row": null, - "width": 2 - } - } - } - } - }, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/__pycache__/nowo1_base.cpython-39.pyc b/__pycache__/nowo1_base.cpython-39.pyc index bb87322a8938399ac0d954e6213a26f2a2d9a223..eeef5132ff07b6a929bd53a415e0143125b55eeb 100644 Binary files a/__pycache__/nowo1_base.cpython-39.pyc and b/__pycache__/nowo1_base.cpython-39.pyc differ diff --git a/__pycache__/nowo1_gui_base.cpython-39.pyc b/__pycache__/nowo1_gui_base.cpython-39.pyc index 15a7176630f60e529166bdb2ec6ae66a5a2f08b1..1088c166920acf7b5d726b3edefe9c737fce658f 100644 Binary files a/__pycache__/nowo1_gui_base.cpython-39.pyc and b/__pycache__/nowo1_gui_base.cpython-39.pyc differ diff --git a/__pycache__/nowo1_log_base.cpython-39.pyc b/__pycache__/nowo1_log_base.cpython-39.pyc index 954395163caf1a7416f6657917e8e4bcbc8746ff..20cba6d895db2abb591d5599e79db1f36f28b5b6 100644 Binary files a/__pycache__/nowo1_log_base.cpython-39.pyc and b/__pycache__/nowo1_log_base.cpython-39.pyc differ diff --git a/__pycache__/nowo1_sim_binary.cpython-39.pyc b/__pycache__/nowo1_sim_binary.cpython-39.pyc index bcc80afd87a78bb2f2485fba89fdead4adb99d0c..5f903a80489ffdb5700c973dfbaea2ae6f760f78 100644 Binary files a/__pycache__/nowo1_sim_binary.cpython-39.pyc and b/__pycache__/nowo1_sim_binary.cpython-39.pyc differ diff --git a/nowo1_base.py b/nowo1_base.py index 2d07f83837baa1dc218417f716ac35fbb23f7dd4..00b6cd8d69536fae5abede37f8c97c21f6cfacf5 100644 --- a/nowo1_base.py +++ b/nowo1_base.py @@ -360,10 +360,32 @@ class gate_dataframe(gate_base): self._success_flag = False +class gui_api(): + def __init__(self): + self._GUI_visible = True + self._GUI_itemlist : dict = dict() + self.GUI_Item = None + self._GUI_is_visible = False + self.info = widgets.Output() + + + def Show_GUI(self): + if not self.GUI_Item: + self.GUI_Item = self._create_gui() + self._GUI_is_visible = True + display(self.GUI_Item) + + + def _create_gui(self): + for widget in self._GUI_itemlist.values(): + setattr(widget, 'parent', self) + return None + #***************************************************************** -class step_base(): +class step_base(gui_api): def __init__(self, name : str, GUI : bool = False): + super().__init__() self.name = name self.step_nr: int = 0 self.total_steps: int = 0 @@ -371,41 +393,35 @@ class step_base(): self.sim_funcs : dict = {}# Ersetzt self.work_objs und self.work_funcs self._loggerlist : set = set() - self._GUI_visible = GUI - self._GUI_itemlist : dict = dict() - self.GUI_Item = self._create_gui() - self._GUI_is_visible = False + # self._GUI_visible = GUI + # self._GUI_itemlist : dict = dict() + # self.GUI_Item = self._create_gui() + # self._GUI_is_visible = False - self.info = widgets.Output() + # self.info = widgets.Output() def on_start_clicked(self, args): parent = args.parent parent.reset() - #with self.info:print('on click') - - # for obj in parent.work_objs: - # if obj._GUI_is_visible: - # obj.Init_Over_GUI() parent.work() - def Show_GUI(self): - for obj in self.work_objs: - if obj._GUI_visible: - obj.Show_GUI() - if self.GUI_Item: - self._GUI_is_visible = True - display(self.GUI_Item, self.info) - #with self.info: - # print('Na dann wollen wir mal') - + # def Show_GUI(self, show = True): + # for obj in self.work_objs: + # if obj._GUI_visible: + # obj.Show_GUI() + # super().Show_GUI() + # if self.GUI_Item: + # self._GUI_is_visible = True + # display(self.GUI_Item) + - def _create_gui(self): - for widget in self._GUI_itemlist.values(): - setattr(widget, 'parent', self) - return None + # def _create_gui(self): + # for widget in self._GUI_itemlist.values(): + # setattr(widget, 'parent', self) + # return None def reset(self): @@ -632,50 +648,24 @@ class step_timer(step_base): #***************************************************************** -class work_base(): +class work_base(gui_api): def __init__(self, name: str, GUI : bool = False, **kwargs): - + super().__init__() self.name = name self._ctrl_ok : bool = False - - self._GUI_visible = GUI - self._GUI_itemlist : dict = dict() - self.GUI_Item = None - self._GUI_is_visible = False - self.info = widgets.Output() - #display(self.info) def Init(self): pass - def ready_for_start(self, timer: step_timer): pass + def ready_for_start(self, stepper: step_base): pass def ready_for_end(self):pass - def _create_gui(self): - for widget in self._GUI_itemlist.values(): - setattr(self, 'parent', widget) - return None - - - def Show_GUI(self): - if not self.GUI_Item: - self.GUI_Item = self._create_gui() - self._GUI_is_visible = True - display(self.GUI_Item) - class gui_base(work_base): def __init__(self, name: str, GUI : bool = False, **kwargs): super().__init__(name, GUI, **kwargs) - - - def ready_for_start(self, stepper: step_base):pass - - def ready_for_end(self):pass - - def Init(self): super().Init() - + def Init_by_dataframe(self, dataframe): pass diff --git a/nowo1_log_base.py b/nowo1_log_base.py index 6112f2922c884460e1cee33dc7de90764b84535f..8a93a7138eab21bbd132970b05fabdf760e5c9f4 100644 --- a/nowo1_log_base.py +++ b/nowo1_log_base.py @@ -3,7 +3,7 @@ import nowo1_base as nowo import datetime as dt import pandas as pd import numpy as np -import nowo1_gui_base +import pyperclip class logger(nowo.port_base): def __init__(self, name: str, GUI : bool = False, **kwargs): @@ -60,6 +60,9 @@ class log_sheet(nowo.port_base): value = self.buffer_data[key_name] self.sheet_data.at[row_name, col_name] = value #self.sheet_data.to_clipboard() + csv_str = self.sheet_data.to_csv() + pyperclip.copy(csv_str) + #copyDF(self.sheet_data) if self.Gui_For_Data: #with self.info: print(self.Gui_For_Data.name, 'ready_2') self.Gui_For_Data.ready_for_end() diff --git a/requirements.txt b/requirements.txt index 7f7d90788757083c86986cb62bed723f8c688901..947c3237362b98cec7fb6b74d3231de8899eb5f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ voila voila-gridstack ipysheet -pandas \ No newline at end of file +pandas +pyperclip \ No newline at end of file