Ejemplo n.º 1
0
 def examine_normality(self):
     cc = output.get_cc()
     (self.var_labels, self.var_notes, self.var_types,
      self.val_dics) = lib.get_var_dets(cc[mg.CURRENT_VDTS_PATH])
     dlg = normal.DlgNormality(self, self.var_labels, self.var_notes,
                               self.var_types, self.val_dics)
     dlg.ShowModal()
Ejemplo n.º 2
0
 def on_btn_run(self, event):
     ## get settings
     cc = output.get_cc()
     run_ok = self.test_config_ok()
     if run_ok:
         ## set vals and data_label
         try:
             self.var_a, unused = self.get_var_a()
         except Exception as e:
             wx.MessageBox(
                 f'Unable to process first variable. Orig error: {e}')
             return
         self.var_label_a = lib.GuiLib.get_item_label(
             item_labels=self.var_labels, item_val=self.var_a)
         if self.paired:
             self.var_b, unused = self.get_var_b()
             self.var_label_b = lib.GuiLib.get_item_label(
                 item_labels=self.var_labels, item_val=self.var_b)
         else:
             self.var_b = None
             self.var_label_b = ''
         ## css_idx is supplied at the time
         get_script_args={
             'css_fpath': cc[mg.CURRENT_CSS_PATH],
             'report_fpath': cc[mg.CURRENT_REPORT_PATH], }
         config_ui.ConfigUI.on_btn_run(self,
             event, get_script_args, new_has_dojo=True)
Ejemplo n.º 3
0
 def on_type_btn(self, _event):
     cc = output.get_cc()
     updated = set()  ## will get populated with a True to indicate update
     (self.var_labels, self.var_notes, self.var_types,
      self.val_dics) = lib.get_var_dets(cc[mg.CURRENT_VDTS_PATH])
     dlg = config_output.DlgListVars(self.var_labels, self.var_notes,
                                     self.var_types, self.val_dics, updated)
     dlg.ShowModal()
Ejemplo n.º 4
0
 def on_btn_run(self, event):
     """
     Generate script to special location (INT_SCRIPT_PATH), run script
     putting output in special location (INT_REPORT_PATH) and into report
     file, and finally, display html output.
     """
     cc = output.get_cc()
     run_ok = self.test_config_ok()
     if run_ok:
         ## css_idx is supplied at the time
         get_script_args = {
             'css_fpath': cc[mg.CURRENT_CSS_PATH],
             'report_fpath': cc[mg.CURRENT_REPORT_PATH],
             'details': mg.DEFAULT_DETAILS}
         config_ui.ConfigUI.on_btn_run(self, event, get_script_args)
Ejemplo n.º 5
0
    def on_btn_export(self, _evt):
        """
        Make CSV and, if possible, a spreadsheet as well (must not have too many
        columns).

        Follows format of original data source where possible.

        Start with original list of columns and column names. If including
        labels, with insert additional fields as required.
        """
        debug = False
        self.progbar.SetValue(0)
        wx.BeginBusyCursor()
        inc_lbls = self.chk_inc_lbls.IsChecked()
        orig_col_names = getdata.fldsdic_to_fldnames_lst(fldsdic=self.dd.flds)
        cc = output.get_cc()
        (_var_labels, _var_notes,
         _var_types, val_dics) = lib.get_var_dets(cc[mg.CURRENT_VDTS_PATH])
        cols_dets = self.get_cols_dets(
            orig_col_names, val_dics=val_dics, inc_lbls=inc_lbls)
        n_used_lbls = len(
            [col_dets for col_dets in cols_dets if col_dets.valdic])
        n_cols = len(cols_dets) + n_used_lbls
        do_spreadsheet = (n_cols <= 256)
        if not do_spreadsheet:
            wx.MessageBox(f'Too many columns ({n_cols}) for an '
                'xlsx spreadsheet. Only making the csv')
        try:
            self.write_out(
                cols_dets, inc_lbls=inc_lbls, do_spreadsheet=do_spreadsheet)
        except my_exceptions.ExportCancel:
            wx.MessageBox('Export Cancelled')
        except Exception as e:
            msg = (f'Problem exporting output. Orig error: {b.ue(e)}')
            if debug: print(msg)
            wx.MessageBox(msg)
            self.progbar.SetValue(0)
            lib.GuiLib.safe_end_cursor()
            self.align_btns_to_exporting(exporting=False)
            self.export_status[mg.CANCEL_EXPORT] = False
            return
        self.progbar.SetValue(mg.EXPORT_DATA_GAUGE_STEPS)
        lib.GuiLib.safe_end_cursor()
        self.align_btns_to_exporting(exporting=False)
        wx.MessageBox(_('Your data has been exported to your desktop'))
        self.progbar.SetValue(0)
Ejemplo n.º 6
0
 def __init__(self, title):
     cc = output.get_cc()
     wx.Dialog.__init__(self, parent=None, id=-1, title=title,
         pos=(mg.HORIZ_OFFSET,0),
         style=wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER|wx.CLOSE_BOX
         |wx.SYSTEM_MENU|wx.CAPTION|wx.CLIP_CHILDREN)
     config_ui.ConfigUI.__init__(self, autoupdate=True)
     self.title = title
     self.SetFont(mg.GEN_FONT)
     self.output_modules = [
         (None, 'my_globals as mg'),
         ('stats', 'core_stats'),
         (None, 'getdata'),
         (None, 'output'),
         (None, 'stats_output'),
     ]
     self.Bind(wx.EVT_CLOSE, self.set_exiting)
     self.url_load = True  ## btn_expand
     (self.var_labels, self.var_notes, 
      self.var_types, 
      self.val_dics) = lib.get_var_dets(cc[mg.CURRENT_VDTS_PATH])
     self.variables_rc_msg = _('Right click variables to view/edit details')
     ## set up panel for frame
     self.panel = wx.Panel(self)
     bx_desc = wx.StaticBox(self.panel, -1, _('Purpose'))
     bx_vars = wx.StaticBox(self.panel, -1, _('Variables'))
     config_output.add_icon(frame=self)
     ## key settings
     self.drop_tbls_panel = self.panel
     self.drop_tbls_system_font_size = False
     hide_db = projects.get_hide_db()
     self.drop_tbls_idx_in_szr = 3 if not hide_db else 1  ## the 2 database items are missing)
     self.drop_tbls_sel_evt = self.on_table_sel
     self.drop_tbls_rmargin = 10
     self.drop_tbls_can_grow = False
     (self.szr_data,
      self.szr_output_config) = self.get_gen_config_szrs(self.panel,
                                             hide_db=hide_db)  ## mixin
     self.drop_tbls_szr = self.szr_data
     getdata.data_dropdown_settings_correct(parent=self)
     self.szr_output_display = self.get_szr_output_display(
         self.panel, inc_clear=False, idx_style=1)
     szr_main = wx.BoxSizer(wx.VERTICAL)
     szr_top = wx.BoxSizer(wx.HORIZONTAL)
     szr_desc = wx.StaticBoxSizer(bx_desc, wx.VERTICAL)
     eg1, eg2, eg3 = self.get_examples()
     lbl_desc1 = wx.StaticText(self.panel, -1, eg1)
     lbl_desc1.SetFont(mg.GEN_FONT)
     lbl_desc2 = wx.StaticText(self.panel, -1, eg2)
     lbl_desc2.SetFont(mg.GEN_FONT)
     lbl_desc3 = wx.StaticText(self.panel, -1, eg3)
     lbl_desc3.SetFont(mg.GEN_FONT)
     szr_desc.Add(lbl_desc1, 1, wx.GROW|wx.LEFT, 5)
     szr_desc.Add(lbl_desc2, 1, wx.GROW|wx.LEFT, 5)
     szr_desc.Add(lbl_desc3, 1, wx.GROW|wx.LEFT, 5)
     self.btn_help = wx.Button(self.panel, wx.ID_HELP)
     self.btn_help.SetFont(mg.BTN_FONT)
     self.btn_help.Bind(wx.EVT_BUTTON, self.on_btn_help)
     if mg.PLATFORM == mg.LINUX:  ## http://trac.wxwidgets.org/ticket/9859
         bx_vars.SetToolTip(self.variables_rc_msg)
     szr_vars = wx.StaticBoxSizer(bx_vars, wx.VERTICAL)
     self.szr_vars_top = wx.BoxSizer(wx.HORIZONTAL)
     szr_vars_bottom = wx.BoxSizer(wx.HORIZONTAL)
     szr_vars.Add(self.szr_vars_top, 1, wx.LEFT, 5)
     szr_vars.Add(szr_vars_bottom, 0, wx.LEFT, 5)
     ## groups
     self.lbl_group_a = wx.StaticText(self.panel, -1, _('Group A:'))
     self.lbl_group_a.SetFont(mg.LABEL_FONT)
     self.lbl_group_b = wx.StaticText(self.panel, -1, _('Group B:'))
     self.lbl_group_b.SetFont(mg.LABEL_FONT)
     self.setup_var_dropdowns()
     ## phrase
     self.lbl_phrase = wx.StaticText(
         self.panel, -1, _('Start making your selections'))
     szr_vars_bottom.Add(self.lbl_phrase, 0, wx.GROW|wx.TOP|wx.BOTTOM, 10)
     szr_bottom = wx.BoxSizer(wx.HORIZONTAL)
     if mg.MAX_HEIGHT <= 620:
         myheight = 130
     elif mg.MAX_HEIGHT <= 820:
         myheight = ((350 * mg.MAX_HEIGHT) / 1024.0) - 20
     else:
         myheight = 350
     if mg.PLATFORM == mg.MAC:
         myheight = myheight*0.3
     self.html = wx.html2.WebView.New(
         self.panel, -1, size=wx.Size(200, myheight))
     if mg.PLATFORM == mg.MAC:
         self.html.Bind(wx.EVT_WINDOW_CREATE, self.on_show)
     else:
         self.Bind(wx.EVT_SHOW, self.on_show)
     szr_bottom.Add(self.html, 1, wx.GROW)
     szr_bottom.Add(self.szr_output_display, 0, wx.GROW|wx.LEFT, 10)
     static_box_gap = 0 if mg.PLATFORM == mg.MAC else 10
     if static_box_gap:
         szr_main.Add(wx.BoxSizer(wx.VERTICAL), 0, wx.TOP, static_box_gap)
     help_down_by = 27 if mg.PLATFORM == mg.MAC else 17
     szr_top.Add(self.btn_help, 0, wx.TOP, help_down_by)
     szr_top.Add(szr_desc, 1, wx.LEFT, 5)
     szr_main.Add(szr_top, 0, wx.GROW|wx.LEFT|wx.RIGHT, 10)
     if static_box_gap:
         szr_main.Add(wx.BoxSizer(wx.VERTICAL), 0, wx.TOP, static_box_gap)
     szr_main.Add(self.szr_data, 0, wx.GROW|wx.LEFT|wx.RIGHT, 10)
     if static_box_gap:
         szr_main.Add(wx.BoxSizer(wx.VERTICAL), 0, wx.TOP, static_box_gap)
     szr_main.Add(szr_vars, 0, wx.GROW|wx.LEFT|wx.RIGHT, 10)
     if static_box_gap:
         szr_main.Add(wx.BoxSizer(wx.VERTICAL), 0, wx.TOP, static_box_gap)
     szr_main.Add(self.szr_output_config, 0, wx.GROW|wx.LEFT|wx.RIGHT, 10)
     szr_main.Add(szr_bottom, 2, wx.GROW|wx.ALL, 10)
     self.panel.SetSizer(szr_main)
     szr_lst = [szr_top, self.szr_data, szr_vars, self.szr_output_config,
         szr_bottom]
     lib.GuiLib.set_size(window=self, szr_lst=szr_lst, width_init=1024)