Skip to content

Commit

Permalink
Merge pull request #19 from zdomke/dev_file_io
Browse files Browse the repository at this point in the history
Archive Viewer file import and export
  • Loading branch information
YektaY authored Aug 2, 2024
2 parents 18a92c9 + 3f00fff commit f269047
Show file tree
Hide file tree
Showing 12 changed files with 781 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Config & Save files
*.txt
*.xml
*.pyav

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
12 changes: 9 additions & 3 deletions archive_viewer/archive_viewer.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from functools import partial
from qtpy.QtCore import Slot
from qtpy.QtWidgets import QAbstractButton, QApplication
from qtpy.QtWidgets import (QAbstractButton, QApplication)
from pydm import Display
from config import logger
from mixins import (TracesTableMixin, AxisTableMixin)
from mixins import (TracesTableMixin, AxisTableMixin, FileIOMixin)
from styles import CenterCheckStyle


class ArchiveViewer(Display, TracesTableMixin, AxisTableMixin):
class ArchiveViewer(Display, TracesTableMixin, AxisTableMixin, FileIOMixin):
def __init__(self, parent=None, args=None, macros=None, ui_filename=__file__.replace(".py", ".ui")) -> None:
super(ArchiveViewer, self).__init__(parent=parent, args=args,
macros=macros, ui_filename=ui_filename)
Expand All @@ -17,6 +17,7 @@ def __init__(self, parent=None, args=None, macros=None, ui_filename=__file__.rep

self.axis_table_init()
self.traces_table_init()
self.file_io_init()

self.curve_delegates_init()
self.axis_delegates_init()
Expand All @@ -35,6 +36,11 @@ def __init__(self, parent=None, args=None, macros=None, ui_filename=__file__.rep
app = QApplication.instance()
app.setStyle(CenterCheckStyle())

def file_menu_items(self) -> dict:
"""Add export & import functionality to File menu; override Display.file_menu_items"""
return {"save": (self.export_save_file, "Ctrl+S"),
"load": (self.import_save_file, "Ctrl+L")}

@Slot(QAbstractButton)
def set_plot_timerange(self, button: QAbstractButton) -> None:
"""Slot to be called when a timespan setting button is pressed.
Expand Down
5 changes: 4 additions & 1 deletion archive_viewer/archive_viewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">timespan_btns</string>
</attribute>
Expand Down Expand Up @@ -111,7 +114,7 @@
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">timespan_btns</string>
Expand Down
Loading

0 comments on commit f269047

Please sign in to comment.