[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Moving torrc reloading to torrc panel
commit f494a50901129123890e11d0ef07fb16d1eaa1de
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon May 9 18:48:07 2011 -0700
Moving torrc reloading to torrc panel
---
src/cli/controller.py | 25 -------------------------
src/cli/torrcPanel.py | 15 +++++++++++++++
2 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/src/cli/controller.py b/src/cli/controller.py
index 6f4b70d..3d40631 100644
--- a/src/cli/controller.py
+++ b/src/cli/controller.py
@@ -1157,31 +1157,6 @@ def drawTorMonitor(stdscr, startTime, loggedEvents, isBlindMode):
setPauseState(panels, isPaused, page)
finally:
panel.CURSES_LOCK.release()
- elif page == 3 and key == ord('r') or key == ord('R'):
- # reloads torrc, providing a notice if successful or not
- loadedTorrc = torConfig.getTorrc()
- loadedTorrc.getLock().acquire()
-
- try:
- loadedTorrc.load()
- isSuccessful = True
- except IOError:
- isSuccessful = False
-
- loadedTorrc.getLock().release()
-
- #isSuccessful = panels["torrc"].loadConfig(logErrors = False)
- #confTypeLabel = confPanel.CONFIG_LABELS[panels["torrc"].configType]
- resetMsg = "torrc reloaded" if isSuccessful else "failed to reload torrc"
- if isSuccessful:
- panels["torrc"]._lastContentHeightArgs = None
- panels["torrc"].redraw(True)
-
- panels["control"].setMsg(resetMsg, curses.A_STANDOUT)
- panels["control"].redraw(True)
- time.sleep(1)
-
- panels["control"].setMsg(CTL_PAUSED if isPaused else CTL_HELP)
else:
for pagePanel in getPanels(page + 1):
isKeystrokeConsumed = pagePanel.handleKey(key)
diff --git a/src/cli/torrcPanel.py b/src/cli/torrcPanel.py
index 5ca839f..75ddd1b 100644
--- a/src/cli/torrcPanel.py
+++ b/src/cli/torrcPanel.py
@@ -6,6 +6,8 @@ import math
import curses
import threading
+import popups
+
from util import conf, enum, panel, torConfig, uiTools
DEFAULT_CONFIG = {"features.config.file.showScrollbars": True,
@@ -57,6 +59,19 @@ class TorrcPanel(panel.Panel):
self.stripComments = not self.stripComments
self._lastContentHeightArgs = None
self.redraw(True)
+ elif key == ord('r') or key == ord('R'):
+ # reloads torrc, providing a notice if successful or not
+ try:
+ torConfig.getTorrc().load()
+ self._lastContentHeightArgs = None
+ self.redraw(True)
+ resultMsg = "torrc reloaded"
+ except IOError:
+ resultMsg = "failed to reload torrc"
+
+ self._lastContentHeightArgs = None
+ self.redraw(True)
+ popups.showMsg(resultMsg, 1)
else: isKeystrokeConsumed = False
self.valsLock.release()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits