Пример #1
0
    def _go(self, catme=False):
        print("going....")
        source_csv_path = self.path_from_box(self.source_folder_box)
        main_csv_path = self.path_from_box(self.main_folder_box)
        if not main_csv_path:
            # exit
            return None

        ind = self.source_listbox.GetSelection()
        if ind is None:
            #exit
            return None
        src_label = self.source_listbox.GetString(ind)
        mymapper = spreadsheet_mapper.delimited_grade_spreadsheet(
            main_csv_path)
        mymapper.map_from_path(source_csv_path, src_label)
        if catme:
            mymapper.catme_labels()

        # browse for output name
        outpath = wx_utils.my_file_dialog(parent=None, \
                                          start_dir=self.start_dir, \
                                          msg="Select output file", \
                                          wildcard="CSV files (*.csv)|*.csv", \
                                          kind="save", \
                                          )

        if outpath:
            mymapper.save(outpath)
    def _go(self, catme=False):
        print("going....")
        source_csv_path = self.path_from_box(self.source_folder_box)
        main_csv_path = self.path_from_box(self.main_folder_box)
        if not main_csv_path:
            # exit
            return None

        ind = self.source_listbox.GetSelection()
        if ind is None:
            #exit
            return None
        src_label = self.source_listbox.GetString(ind)
        mymapper = spreadsheet_mapper.delimited_grade_spreadsheet(main_csv_path)
        mymapper.map_from_path(source_csv_path, src_label)
        if catme:
            mymapper.catme_labels()
            
        # browse for output name
        outpath = wx_utils.my_file_dialog(parent=None, \
                                          start_dir=self.start_dir, \
                                          msg="Select output file", \
                                          wildcard="CSV files (*.csv)|*.csv", \
                                          kind="save", \
                                          )

        if outpath:
            mymapper.save(outpath)
Пример #3
0
 def load(self, event=None):
     xml_path = wx_utils.my_file_dialog(parent=self.frame, \
                                        start_dir=git_dir, \
                                        msg="Choose an xml file", \
                                        kind="open", \
                                        wildcard=xml_wildcard, \
                                        )
     self.load_xml(xml_path)
 def _browse(self, save_box, msg):
     mypath = wx_utils.my_file_dialog(parent=None, \
                                      start_dir=self.start_dir, \
                                      msg=msg, \
                                      )
     if mypath:
         #rp = relpath.relpath(folder_path, base=course_dir)
         self.path_to_box(save_box, mypath)
 def load(self, event=None):
     xml_path = wx_utils.my_file_dialog(parent=self.frame, \
                                        start_dir=self.start_dir, \
                                        msg="Choose an xml file", \
                                        kind="open", \
                                        wildcard=xml_wildcard, \
                                        )
     self.load_xml(xml_path)
 def _browse(self, save_box, msg):
     mypath = wx_utils.my_file_dialog(parent=None, \
                                      start_dir=self.start_dir, \
                                      msg=msg, \
                                      )
     if mypath:
         #rp = relpath.relpath(folder_path, base=course_dir)
         self.path_to_box(save_box, mypath)
Пример #7
0
 def load(self, event=None):
     xml_path = wx_utils.my_file_dialog(parent=self.frame, \
                                msg="Choose an xml file", \
                                kind="open", \
                                wildcard=xml_wildcard, \
                                )
     self.load_xml(xml_path)
     sp_path = self.spreadsheet_path_box.GetValue()
     self.validate_spreadsheet(sp_path)
Пример #8
0
    def on_browse(self, event):
        spreadsheet_path = wx_utils.my_file_dialog(parent=None, \
                                                   msg="Chose a spreadsheet file", default_file="", \
                                                   wildcard=spreadsheet_wildcard, \
                                                   kind="open", \
                                                   check_overwrite=False)

        if spreadsheet_path:
            self.spreadsheet_path_box.SetValue(spreadsheet_path)
            self.validate_spreadsheet(spreadsheet_path)
    def on_save(self, event):
        xml_path = wx_utils.my_file_dialog(parent=self, \
                                           msg="Save Block Diagram System as", \
                                           kind="save", \
                                           wildcard=xml_wildcard, \
                                           )
        if xml_path:
            root = ET.Element('block_diagram_system')
            bd_list_xml = ET.SubElement(root, 'blocks')

            for block in self.blocklist:
                block.create_xml(bd_list_xml)

            xml_utils.write_pretty_xml(root, xml_path)
Пример #10
0
    def save(self, event=None):
        xml_path = wx_utils.my_file_dialog(parent=self.frame, \
                                   msg="Save GUI state as", \
                                   kind="save", \
                                   wildcard=xml_wildcard, \
                                   )

        control_attr_list = ['spreadsheet_path_box','greeting_box','body_box',\
                             'closing_box','signature_box','subject_box']
        self.create_xml('multi_email_gui', control_attr_list)

        print('xml_path = ' + xml_path)
        #import pdb
        #pdb.set_trace()
        xml_utils.write_pretty_xml(self.xml, xml_path)
    def on_save_data(self, event):
        #need filepath dialog here
        filepath = wx_utils.my_file_dialog(parent=self, \
                                           msg="Save data as txt file", default_file="", \
                                           wildcard=txt_wildcard, \
                                           kind="save", \
                                           check_overwrite=False)
        if filepath:
            plot_list = self.plot_panel.get_plot_list()
            data_list = self.validate_plot_list_and_get_data(plot_list)
            if data_list:
                label_list = self.get_labels(plot_list)

            all_data = [self.t] + data_list
            all_labels = ['Time (sec.)'] + label_list
            c_labels = clean_labels(all_labels)
            data_mat = np.column_stack(all_data)
            # I could kind of use a way to clean the labels from latex to plain ascii
            # i.e. $\ddot{x}_{tip}$ --> accel
            txt_mixin.dump_delimited(filepath, data_mat, labels=c_labels)
Пример #12
0
    def on_load_xml(self, event=0):
        """Load a list of blocks from a block diagram xml file"""
        xml_path = wx_utils.my_file_dialog(parent=self, \
                                           msg="Load block list/system from XML", \
                                           kind="open", \
                                           wildcard=xml_wildcard, \
                                           )
        if xml_path:
            print('xml_path = ' + xml_path)
            myparser = block_diagram_system_parser(xml_path)
            myparser.parse()
            myparser.convert()
            self.bd_parent.blocklist = []
            for block in myparser.block_list:
                print('block.params = %s' % block.params)
                self.append_one_block(block.name, block.blocktype, block.params)

            self.xml_path = xml_path

            return self.xml_path