def Memory(self, col=8, row=8, value=0): if 0 > int(col) or 0 > int(row): return "Out of range" if int(value, 16) > 255: return "Too big" UI.Set_Memory(int(col)+(int(row) * 16) + UI.Current_Page , int(value, 16)) return UI.returnPage()
def SPEEDBREAKPOINT(self): UI.Step_lilith() while UI.Current_IP not in UI.Watchpoints: UI.Step_lilith() if UI.Count == UI.Debug_Point: break return UI.returnPage()
def DEBUG(self, Inst=""): if int(Inst, 16) in UI.Watchpoints: UI.Watchpoints.remove(int(Inst, 16)) print("Watchpoint Deleted: " + Inst) else: UI.Watchpoints.add(int(Inst, 16)) return UI.returnPage()
def main(): setup() quit = 'q' choice = None while choice != quit: choice = User_Interface.display_menu_get_choice() handle_choice(choice)
def RESET(self): UI.Reset_lilith() return UI.returnPage()
def STOP(self): print("Stopping after: " + str(UI.Count) + " Instructions" ) return UI.returnPage()
def STEP(self): UI.Step_lilith() return UI.returnPage()
def RUN(self): UI.Step_lilith() if UI.Current_IP in UI.Watchpoints: raise cherrypy.HTTPRedirect("/") return UI.returnPage()
@author: Alex Kerzner """ import sys from PyQt5.QtWidgets import QApplication # Import the Graphical User Interface import User_Interface # Import config parser from lib import Config # Run the application # Don't run if loaded as module if (__name__ == "__main__"): config = Config.getConfig() # IPython override app = 0 app = QApplication(sys.argv) app.aboutToQuit.connect(app.deleteLater) mw = User_Interface.Main_Window() app.exec_()
def WINDOW(self, Window=0): UI.Current_Page = int(Window, 16) return UI.returnPage()
def index(self): return UI.returnPage()
@cherrypy.expose def WINDOW(self, Window=0): UI.Current_Page = int(Window, 16) return UI.returnPage() @cherrypy.expose def SPEEDBREAKPOINT(self): UI.Step_lilith() while UI.Current_IP not in UI.Watchpoints: UI.Step_lilith() if UI.Count == UI.Debug_Point: break return UI.returnPage() if __name__ == '__main__': UI.main(sys.argv[1:]) conf = { '/': { 'tools.sessions.on': True, 'tools.staticdir.root': os.path.abspath(os.getcwd()) }, '/generator': { 'request.dispatch': cherrypy.dispatch.MethodDispatcher(), 'tools.response_headers.on': True, 'tools.response_headers.headers': [('Content-Type', 'text/plain')], }, '/static': { 'tools.staticdir.on': True, 'tools.staticdir.dir': './public' } }
import User_Interface import nyc_residential_sales import numpy as np # Create the full welcome page welcome = User_Interface.WelcomePage() # Save the user's inputs to a list variable for use in the model user_information = welcome.user_data #print(user_information) #Converting user information to a list to send to "Sale-Predictor model #Here, user_information list in this order : Borough, Neighborhood, Building class, year built, # of units, GROSS SQ FT, Sale Month #[1, 'FINANCIAL', '09 COOPS - WALKUP APARTMENTS', '1935', '5', '2019', '01'] # Need to get X_test array from "nyc_residential_sales.py". How? X_test1 = nyc_residential_sales.X_test X_test1 = X_test1.drop(X_test1.index[1:]) #print(X_test1) df = X_test1 #Converting all data values to '0' df.iloc[0, 0:233] = '0' #print(df) X_test1 = df #print(X_test1). All values must be '0' at this point #data_sample = (1, 'FINANCIAL', '09 COOPS - WALKUP APARTMENTS', '1935', '5', '2019', '01') #data_sample_1 = "NEIGHBORHOOD_" + "data_sample[1]" #print(data_sample_1) #Updating Column for Residential Units X_test1.iloc[0, 0] = np.log1p(int(user_information[4]))
def DEBUG(self, Inst=""): UI.Watchpoints UI.Watchpoints.add(int(Inst, 16)) return UI.returnPage()
def main(): root = Tk() stuff = User_Interface.JeromesButtons(root) root.title("Generics PERM Automation Framework") root.mainloop()
def __main__(tonic, scale, volume=0.5, fs=44100, duration=1.0): ui = User_Interface.UI_Interface(prompts) fm = Frequency_Maker.Frequency_Maker(tonic, scale, volume, fs, duration) # fp = Frequency_Player.Frequency_Player(tonic, scale, volume, fs, duration) print(prompts['initialGreeting']) # you still work, great # for note in fm.chromatic: # sample = fp.sample_maker(note, volume, fs, duration) # fp.stream_player(sample, volume, fs, duration) # lamba == like a tiny function, not even important/big enough for a 'def' scale_name = lambda: 'minor' if scale == minor_scale else 'major' while True: # main menu print("Current tonic:", tonic) print("Current scale: %s\n" % scale_name()) userChoice_mainMenu = ui.get_user_input(prompts['menu_start']) print(prompts['menu_chosen'] % str(userChoice_mainMenu)) # option 1. New data if userChoice_mainMenu == 1: tonic = ui.get_user_new_frequency() print("New frequency chosen: %s\nSetting new frequency...\n" % tonic) fm = Frequency_Maker.Frequency_Maker(tonic, scale, volume, fs, duration) # fp = Frequency_Player.Frequency_Player(tonic, scale, volume, fs, duration) elif userChoice_mainMenu == 2: scale = minor_scale if scale == major_scale else major_scale print('Switching scale to %s \n' % scale_name()) fm.change_scale(scale) elif userChoice_mainMenu == 3: try: new_duration = float( input( "How long do you want it? Please don't say something terrible like 10.0+ seconds. " )) if (new_duration < 0): print("Well you're being a negative nancy aren't you.\n") continue duration = float(new_duration) except: print("N") sleep(1.0) print("o") sleep(1.0) print("You know what that spells?") sleep(1.0) print("That's right.") sleep(1.0) print("No.") sleep(1.0) print("And now you get to sit there") sleep(1.0) print("Cuz I TOLD YOU to not do that.") sleep(2.0) print("hmph\n") # option 4: View chords elif userChoice_mainMenu == 4: print("okie dokes, chordy chord chord") user_chord_choice = ui.get_user_input( prompts['menu_chords'][scale]) print("\nChord chosen:", prompts['menu_chords'][scale][user_chord_choice - 1]) chord_samples = fm.chord_stacker(user_chord_choice - 1) chord_unison = fm.actual_chord(user_chord_choice - 1) for note in chord_samples: to_play = fp.sample_maker(note, volume, fs, duration) fp.stream_player(to_play, volume, fs, duration) sleep(duration / 2) fp.stream_player(chord_unison, volume, fs, duration) # option 5: 2-5-1 elif userChoice_mainMenu == 5: # print("2-5-1, got it") # print(scale) two = fm.actual_chord(scale[1]) five = fm.actual_chord(scale[4]) one = fm.actual_chord(scale[0]) fp.stream_player(two, volume, fs, duration) fp.stream_player(five, volume, fs, duration) fp.stream_player(one, volume, fs, duration)
def PAGEDOWN(self): UI.Current_Page = UI.Current_Page + 4096 return UI.returnPage()
def PAGEUP(self): UI.Current_Page = UI.Current_Page - 4096 if 0 > UI.Current_Page: UI.Current_Page = 0 return UI.returnPage()
def Register(self, Reg="", value=0): UI.Set_Register(int(Reg[1:]), int(value, 16)) return UI.returnPage()
## Copyright (C) 2016 Jeremiah Orians ## This file is part of stage0. ## ## stage0 is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## stage0 is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with stage0. If not, see <http://www.gnu.org/licenses/>. import User_Interface as UI print(UI.returnPage())
exit(1) #Terminate the script #Exception handling code for the XML file process try: cfgData = configData.confData("settings.xml") except: print("There is a problem with the XML file handling. See log file for the traceback of the exception.\n") logdata.log("EXCEPT", "There is a problem with the XML file handling. Program terminates.", __name__) exit(1) #Terminate the script #Exception handling code for the TCP initial setup try: tcpClient = TCPClient.TCPClient(cfgData) except: print("There is a problem with the TCP handling. See log file for the traceback of the exception.\n") logdata.log("EXCEPT", "There is a problem with the TCP handling. Program terminates.", __name__) exit(1) #Terminate the script #General exception handling code try: User_Interface.uInterface(cfgData, tcpClient) #Initiate the user interface except KeyboardInterrupt: print("User requested termination with a keyboard interrupt.\n") logdata.log("EXCEPT", "User requested termination with a keyboard interrupt.", __name__) tcpClient.disconnect() exit(0) #Terminate the script except: print("Something really bad happened!! We should terminate.\n") logdata.log("EXCEPT", "Something really bad happened!! See the traceback below.", __name__) exit(1) #Terminate the script logdata.logClose() #Terminate all logging operations before exiting the script