Skip to content

Commit

Permalink
Delayed plot initialization for Edge support
Browse files Browse the repository at this point in the history
  • Loading branch information
cutright committed Mar 8, 2021
1 parent a8e02c9 commit 9450604
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
28 changes: 14 additions & 14 deletions iqdma/_version.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# _version.py
"""Package initialization for IQDM-Analytics."""
# Copyright (c) 2021 Dan Cutright
# This file is part of IQDM-Analytics, released under a MIT license.
# See the file LICENSE included with this distribution, also
# available at https://github.com/IQDM/IQDM-Analytics

__author__ = "Dan Cutright"
__email__ = "[email protected]"
__version__ = "0.1.1"
__release__ = "0.1.1"
__version_info__ = (0, 1, 1)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# _version.py
"""Package initialization for IQDM-Analytics."""
# Copyright (c) 2021 Dan Cutright
# This file is part of IQDM-Analytics, released under a MIT license.
# See the file LICENSE included with this distribution, also
# available at https://github.com/IQDM/IQDM-Analytics

__author__ = "Dan Cutright"
__email__ = "[email protected]"
__version__ = "0.1.2"
__release__ = "0.1.2"
__version_info__ = (0, 1, 2)
57 changes: 31 additions & 26 deletions iqdma/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, *args, **kwds):
self.control_chart_data = None
self.options = Options()
self.set_to_hist = False
self.is_plot_initialized = False

self.panel = wx.Panel(self, wx.ID_ANY)
self.plot = PlotControlChart(self.panel, self.options)
Expand Down Expand Up @@ -178,6 +179,19 @@ def __add_layout_objects(self):
self.list_ctrl_table = wx.ListCtrl(self.panel, wx.ID_ANY, style=style)
self.data_table = DataTable(self.list_ctrl_table)

self.sizer = {}

static_box_sizers = {
"main": ("Charts", wx.VERTICAL),
"file": ("File Selection", wx.HORIZONTAL),
"criteria": ("Pass-Rate Criteria", wx.VERTICAL),
}
for key, box in static_box_sizers.items():
self.sizer[key] = wx.StaticBoxSizer(
wx.StaticBox(self.panel, wx.ID_ANY, box[0]), box[1]
)
self.sizer["y"] = wx.BoxSizer(wx.HORIZONTAL)

def __do_bind(self):
self.Bind(
wx.EVT_BUTTON, self.on_browse, id=self.button["browse"].GetId()
Expand Down Expand Up @@ -216,41 +230,27 @@ def __set_tooltips(self):
)

def __do_layout(self):
sizer = {}
wrapper = wx.BoxSizer(wx.VERTICAL)

static_box_sizers = {
"main": ("Charts", wx.VERTICAL),
"file": ("File Selection", wx.HORIZONTAL),
"criteria": ("Pass-Rate Criteria", wx.VERTICAL),
}
for key, box in static_box_sizers.items():
sizer[key] = wx.StaticBoxSizer(
wx.StaticBox(self.panel, wx.ID_ANY, box[0]), box[1]
)
sizer["y"] = wx.BoxSizer(wx.HORIZONTAL)

# File objects
sizer["file"].Add(self.text_ctrl["file"], 1, wx.EXPAND | wx.ALL, 5)
sizer["file"].Add(self.button["browse"], 0, wx.ALL, 5)
self.sizer["file"].Add(self.text_ctrl["file"], 1, wx.EXPAND | wx.ALL, 5)
self.sizer["file"].Add(self.button["browse"], 0, wx.ALL, 5)

# Analysis Criteria Objects
sizer["criteria"].Add(self.list_ctrl_table, 0, wx.EXPAND | wx.ALL, 10)
self.sizer["criteria"].Add(self.list_ctrl_table, 0, wx.EXPAND | wx.ALL, 10)

sizer["y"].Add(self.check_box["hippa"], 1, wx.EXPAND | wx.LEFT, 5)
self.sizer["y"].Add(self.check_box["hippa"], 1, wx.EXPAND | wx.LEFT, 5)
label_bins = wx.StaticText(self.panel, wx.ID_ANY, "Hist. Bins:")
sizer["y"].Add(label_bins, 0, wx.EXPAND, 0)
sizer["y"].Add(self.spin_ctrl['bins'], 0, wx.EXPAND | wx.RIGHT, 10)
self.sizer["y"].Add(label_bins, 0, wx.EXPAND, 0)
self.sizer["y"].Add(self.spin_ctrl['bins'], 0, wx.EXPAND | wx.RIGHT, 10)
label = wx.StaticText(self.panel, wx.ID_ANY, "Charting Variable:")
sizer["y"].Add(label, 0, wx.EXPAND, 0)
sizer["y"].Add(self.combo_box["y"], 0, 0, 0)
sizer["main"].Add(sizer["y"], 0, wx.EXPAND, 0)
self.plot.init_layout()
sizer["main"].Add(self.plot.layout, 1, wx.EXPAND | wx.ALL, 5)
self.sizer["y"].Add(label, 0, wx.EXPAND, 0)
self.sizer["y"].Add(self.combo_box["y"], 0, 0, 0)
self.sizer["main"].Add(self.sizer["y"], 0, wx.EXPAND, 0)

wrapper.Add(sizer["file"], 0, wx.ALL | wx.EXPAND, 10)
wrapper.Add(sizer["criteria"], 0, wx.ALL | wx.EXPAND, 10)
wrapper.Add(sizer["main"], 1, wx.EXPAND | wx.ALL, 10)
wrapper.Add(self.sizer["file"], 0, wx.ALL | wx.EXPAND, 10)
wrapper.Add(self.sizer["criteria"], 0, wx.ALL | wx.EXPAND, 10)
wrapper.Add(self.sizer["main"], 1, wx.EXPAND | wx.ALL, 10)

self.panel.SetSizer(wrapper)
self.SetMinSize(self.options.MIN_RESOLUTION_MAIN)
Expand Down Expand Up @@ -357,6 +357,11 @@ def on_browse(self, *evt):
# Data Processing and Visualization
################################################################
def import_csv(self):
if not self.is_plot_initialized:
self.plot.init_layout()
self.sizer["main"].Add(self.plot.layout, 1, wx.EXPAND | wx.ALL, 5)
self.panel.Layout()
self.is_plot_initialized = True
self.plot.clear_plot()
self.importer = ReportImporter(self.text_ctrl["file"].GetValue())
options = self.importer.charting_options
Expand Down

0 comments on commit 9450604

Please sign in to comment.