mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-04 07:25:10 -04:00
Remove watchdog, replace with a simple background thread
This commit is contained in:
parent
e84ca43da8
commit
a9d55e9169
5 changed files with 90 additions and 129 deletions
|
@ -18,13 +18,12 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
from watchdog.observers import Observer
|
||||
|
||||
from onionshare import strings
|
||||
from onionshare.mode_settings import ModeSettings
|
||||
|
||||
from .tab import Tab
|
||||
from .event_handler import EventHandler
|
||||
from .threads import EventHandlerThread
|
||||
|
||||
|
||||
class TabWidget(QtWidgets.QTabWidget):
|
||||
|
@ -72,17 +71,15 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||
self.move_new_tab_button()
|
||||
|
||||
# Watch the events file for changes
|
||||
self.event_handler = EventHandler(common)
|
||||
self.event_handler.new_tab.connect(self.add_tab)
|
||||
self.event_handler.new_share_tab.connect(self.new_share_tab)
|
||||
self.observer = Observer()
|
||||
self.observer.schedule(self.event_handler, self.common.gui.events_dir)
|
||||
self.observer.start()
|
||||
self.event_handler_t = EventHandlerThread(common)
|
||||
self.event_handler_t.new_tab.connect(self.add_tab)
|
||||
self.event_handler_t.new_share_tab.connect(self.new_share_tab)
|
||||
self.event_handler_t.start()
|
||||
|
||||
def cleanup(self):
|
||||
# Stop the event thread
|
||||
self.observer.stop()
|
||||
self.observer.join()
|
||||
self.event_handler_t.stop()
|
||||
self.event_handler_t.join()
|
||||
|
||||
# Clean up each tab
|
||||
for index in range(self.count()):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue