def _handle_buttons(self, event: wx.ListEvent) -> None:
     """
     Handle button clicks.
     :param event: Used to identify the button.
     :return: None
     """
     if event.GetId() == wx.ID_ADD:
         path = self._ask_for_file(self._config_manager.get_working_dir())
         if path:
             if not path.startswith(self._config_manager.get_working_dir()):
                 wx.MessageBox(
                     Strings.file + ':\n' + path + '\nNot in:\n' +
                     self._config_manager.get_working_dir(),
                     Strings.status_error, wx.OK | wx.ICON_WARNING)
             else:
                 if path not in self._upload_dict.values():
                     file_id = self._get_id()
                     # Extra files are assumed to be correct and their seo status is not checked,
                     # they may not be html.
                     self._upload_dict[file_id] = (path, True)
                     self._append_into_list(file_id, path, enabled=True)
     elif event.GetId() == wx.ID_OPEN:
         path = self._ask_for_file(Strings.home_directory)
         if path:
             self._field_keyfile.SetValue(path)
     elif event.GetId() == wx.ID_FILE:
         if self._upload_button.GetLabel() == Strings.button_upload:
             self._upload_files()
         elif self._sftp_thread.is_alive():
             self._sftp_thread.stop()
示例#2
0
 def onItemActivated(self, event: wx.ListEvent) -> None:
     """Handles clicks on the test results list."""
     index = event.GetIndex()
     id = event.GetData()
     with session_scope() as session:
         for result in session.query(Results).filter(Results.id == id):
             SingleResultDialog(self, result).ShowModal()
示例#3
0
 def vcf_data_view_col_clicked(self, event: wx.ListEvent):
     """VCF data view column clicked callback."""
     col = event.GetColumn()
     if col < 8:
         return
     sample_name = self.vcf_data_view.GetColumn(col).GetText()
     self.vcf_sample_input.SetValue(sample_name)
 def _check_handler(self, event: wx.ListEvent) -> None:
     """
     Handle list item check boxes.
     :param event: Used to identify which item is checked.
     :return: None
     """
     if self._file_list.IsItemChecked(event.GetIndex()):
         item_id = event.GetItem().GetData()
         if item_id > 0:
             # Items with ID -1 are disabled, prevent checking.
             path = self._upload_dict[item_id][0]
             if not os.access(path, os.R_OK) or not os.path.exists(path):
                 wx.MessageBox(
                     Strings.warning_file_inaccessible + ':\n' + path,
                     Strings.status_warning, wx.OK | wx.ICON_WARNING)
                 self._file_list.CheckItem(event.GetIndex(), False)
         else:
             self._file_list.CheckItem(event.GetIndex(), False)
     self._content_num_files.SetLabelText(str(self._count_checked_files()))
     self._validate_fields()
示例#5
0
    def on_results_item_selected(self, event: wx.ListEvent):
        """Results item selected callback."""
        n_row = event.GetIndex()
        df = _get_detail_result(self.results_data_view.df, self.df_isoform_level, n_row)
        self.detail_data_view.update_df(df)
        for n_col in [1, 2]:
            self.detail_data_view.SetColumnWidth(n_col, wx.LIST_AUTOSIZE)
        for n_col in range(4, df.shape[1]):
            self.detail_data_view.SetColumnWidth(n_col, wx.LIST_AUTOSIZE_USEHEADER)

        task_id = self.results_data_view.df.iloc[n_row, :]['Task ID']
        self.set_detail_label(task_id)
        self.plot_button.Enabled = True
示例#6
0
 def onItemActivated(self, event: wx.ListEvent) -> None:
     """Updates the user data shown when a user name is activated in the list."""
     from sqlalchemy.sql import func
     user = self.user_list.GetItem(event.GetIndex()).GetText()
     with session_scope() as session:
         count = session.query(Results).filter(
             Results.user_name == user).count()
         average_accuracy = session.query(func.avg(
             Results.accuracy)).filter(Results.user_name == user).scalar()
         average_speed = session.query(func.avg(
             Results.speed)).filter(Results.user_name == user).scalar()
     self.user_data.SetValue(
         f"{user} has taken {count} tests with an average accuracy of {average_accuracy:.1f}% and an average typing speed of {average_speed:.0f} words per minute"
     )
示例#7
0
 def ase_animations_list_label_edit(self, event: wx.ListEvent):
     self._sprite.animations[event.GetSelection()].name = event.GetText()
     self.modified = True
示例#8
0
 def address_right_click(self, event: wx.ListEvent) -> None:
     address = event.GetText()
     if address:
         self.PopupMenu(self.popup_menu)
示例#9
0
 def transactions_right_click(self, event: wx.ListEvent) -> None:
     if event.GetText():
         self.PopupMenu(self.popup_menu)