def submit(self):
     type_errors = (
         self.update_types()
     )  # Convert the types of 'from' and 'to', returning None if successful
     if self.data_name is not None and self.data_name in [
             d.name for d in self.appctx.datasets
     ]:
         warnings.show_warning(
             "Dataset already exists",
             f"A dataset named '{self.data_name}' already exists.\n"
             f"Use a different name or clear the dataset name field.",
         )
     elif type_errors is not None:
         warnings.show_critical("Error", type_errors)
     else:
         # Run with a progress dialog
         if self.data_name is None:
             slot = self.appctx.update_data
         else:
             slot = self.appctx.add_dataset
         RunProgress.run_with_progress(
             progress_str="Recoding variables...",
             function=self.get_func(),
             slot=slot,
             parent=self,
         )
         self.log_command()
         self.accept()
Esempio n. 2
0
    def submit(self):
        if self.data_name is None:
            self.data_name = self.le_data_name.placeholderText()

        if self.data_name is not None and self.data_name in [
            d.name for d in self.appctx.datasets
        ]:
            warnings.show_warning(
                "Dataset already exists",
                f"A dataset named '{self.data_name}' already exists.\n"
                f"Use a different name.",
            )
        elif (
            self.top_idx is None
            or self.bottom_idx is None
            or self.top_idx == self.bottom_idx
        ):
            warnings.show_warning(
                "Select Two Datasets", "Two different datasets must be selected."
            )
        else:
            RunProgress.run_with_progress(
                progress_str="Merging Data...",
                function=self.get_func(),
                slot=self.appctx.add_dataset,
                parent=self,
            )
            self.log_command()
            self.accept()
Esempio n. 3
0
 def submit(self):
     print(f"categorize with {self.cat_min}, {self.cat_max}, {self.cont_min}")
     if self.cat_min > self.cat_max:
         warnings.show_warning(
             "Parameter Error",
             f"'Categorical Minimum' must be <= 'Categorical Maximum'",
         )
     elif self.cat_min > self.cont_min:
         warnings.show_warning(
             "Parameter Error",
             f"'Categorical Minimum' must be < 'Continuous Minimum'",
         )
     elif self.cat_max >= self.cont_min:
         warnings.show_warning(
             "Parameter Error",
             f"'Categorical Maximum' must be < 'Continuous Minimum'",
         )
     else:
         # Run with a progress dialog
         RunProgress.run_with_progress(
             progress_str="Categorizing variables...",
             function=self.get_func(),
             slot=self.appctx.update_data,
             parent=self,
         )
         self.log_command()
         self.accept()
 def submit(self):
     if len(self.filename) == 0:
         self.reject()
         return
     datafile = Path(self.filename)
     if not datafile.exists():
         warnings.show_warning(
             title="File Not Found",
             text=f"The file could not be found:\n'{str(datafile)}''",
         )
     elif not datafile.is_file():
         warnings.show_warning(
             title="Not a File",
             text=
             f"A folder was given instead of a file:\n'{str(datafile)}''",
         )
     elif self.data_name in [d.name for d in self.appctx.datasets]:
         warnings.show_warning(
             title="Dataset already exists",
             text=
             f"A dataset named '{self.data_name}' already exists.  Use a different name.",
         )
     else:
         RunProgress.run_with_progress(
             progress_str=f"Loading {self.kind} file...",
             function=self.get_func(),
             slot=self.appctx.add_dataset,
             parent=self,
         )
         self.log_command()
         self.accept()
 def submit(self):
     if self.data_name is not None and self.data_name in [
         d.name for d in self.appctx.datasets
     ]:
         warnings.show_warning(
             "Dataset already exists",
             f"A dataset named '{self.data_name}' already exists.\n"
             f"Use a different name or clear the dataset name field.",
         )
     else:
         # Run with a progress dialog
         if self.data_name is None:
             slot = self.appctx.update_data
         else:
             slot = self.appctx.add_dataset
         RunProgress.run_with_progress(
             progress_str="Filtering variables...",
             function=self.get_func(),
             slot=slot,
             parent=self,
         )
         self.accept()