Changed menu item names

Added checks for its in channel & frequency
master
Pickles 2012-10-21 12:49:39 -07:00
parent cf72a8c6f6
commit 29811079c6
2 changed files with 9 additions and 11 deletions

View File

@ -31,19 +31,15 @@ class ToorChatProtocol():
def change_channel(self, channel): def change_channel(self, channel):
''' This is used to change the channel that the user operates in ''' ''' This is used to change the channel that the user operates in '''
self.device.setChannel(int(channel)) if isinstance(channel, int):
if channel != int self.device.setChannel(int(channel))
return None
else
return channel
def change_frequency(self, frequency): def change_frequency(self, frequency):
''' This is used to change the frequency that the user operates in ''' ''' This is used to change the frequency that the user operates in '''
self.device.setFreq(int(change_frequency)) if isinstance(frequency, int):
if frequency != int self.device.setFreq(int(frequency))
return None
else
return frequency
def send_web_request(self, site = ""): def send_web_request(self, site = ""):
'''This is used to attempt to get anyone who is registered as a server to load a website on your behalf ''' '''This is used to attempt to get anyone who is registered as a server to load a website on your behalf '''
if site != "": if site != "":

View File

@ -64,7 +64,7 @@ class Visualizer():
self.last_message_index = 0 self.last_message_index = 0
while True: while True:
self.screen_max_y, self.screen_max_x = self.screen.getmaxyx() self.screen_max_y, self.screen_max_x = self.screen.getmaxyx()
self.screen.addstr(0, 1, "[S] Send Message [U] Set User Name [C] Set Channel [F] Set Frequency [W] Load Webpage") self.screen.addstr(0, 1, "[S] Message [U] Username [C] Channel [F] Frequency [W] Load Webpage")
self.__add_message_to_screen__() self.__add_message_to_screen__()
entry = self.screen.getch() entry = self.screen.getch()
if entry == curses.KEY_RESIZE: if entry == curses.KEY_RESIZE:
@ -92,6 +92,8 @@ class Visualizer():
self.screen.nodelay(0) self.screen.nodelay(0)
user_input = self.screen.getstr(1, 1, 60) user_input = self.screen.getstr(1, 1, 60)
self.frequency = self.protocol.change_frequency(user_input) self.frequency = self.protocol.change_frequency(user_input)
self.screen.nodelay(1)
self.screen.addstr(1,1," "*(self.screen_max_x-3))
if entry == ord('w'): if entry == ord('w'):
self.screen.nodelay(0) self.screen.nodelay(0)
user_input = self.screen.getstr(1, 1, 60) user_input = self.screen.getstr(1, 1, 60)