UploaderApp.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码
def _settings_changed(self, api=None):
        """Reset the main display and attempt to connect to the server
           whenever the connection settings may have changed.

        Args:
            api: A placeholder for a complete api that's passed when the event is fired.
        """

        # before doing anything, clear all of the children from the sizer and
        # also delete any windows attached (Buttons and stuff extend from Window!)
        self._sizer.Clear(deleteWindows=True)
        # and clear out the list of discovered runs that we might be uploading to the server.
        self._discovered_runs = []
        # initialize the invalid sheets panel so that it can listen for events
        # before directory scanning starts, but hide it until we actually get
        # an error raised by the validation part.
        self._invalid_sheets_panel = InvalidSampleSheetsPanel(self, self._get_default_directory())
        self._invalid_sheets_panel.Hide()

        should_monitor_directory = read_config_option("monitor_default_dir", expected_type=bool, default_value=False)

        if should_monitor_directory:
            automatic_upload_status_sizer = wx.BoxSizer(wx.HORIZONTAL)
            auto_upload_enabled_text = wx.StaticText(self, label=u"? Automatic upload enabled.")
            auto_upload_enabled_text.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD))
            auto_upload_enabled_text.SetForegroundColour(wx.Colour(51, 102, 255))
            auto_upload_enabled_text.SetToolTipString("Monitoring {} for CompletedJobInfo.xml".format(self._get_default_directory()))

            self._sizer.Add(auto_upload_enabled_text, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
            logging.info("Going to monitor default directory [{}] for new runs.".format(self._get_default_directory()))
            # topics to handle when monitoring a directory for automatic upload
            pub.subscribe(self._prepare_for_automatic_upload, DirectoryMonitorTopics.new_run_observed)
            pub.subscribe(self._start_upload, DirectoryMonitorTopics.finished_discovering_run)

            threading.Thread(target=monitor_directory, kwargs={"directory": self._get_default_directory()}).start()

       # run connecting in a different thread so we don't freeze up the GUI
        threading.Thread(target=self._connect_to_irida).start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号