Beispiel #1
0
    def __init__(self):
        self.model = None
        self.sliced_model = None
        self.settings = settings.Settings()
        self.settings.load_from_file()

        self.app = wx.App()
        self.frame = ui.MainFrame(self, self.settings)
        self.toolbar = ui.MainFrameToolBar(self.frame, self)
        self.frame.SetToolBar(self.toolbar)
        self.frame.SetDropTarget(ui.MainFrameFileDropTarget(self.on_drop_files))
Beispiel #2
0
    def OnInit(self):
        self.doc = doc.MapDocument()

        self.mainWindow = ui.MainFrame(None,
                                       -1,
                                       "Geomorph Painter",
                                       pos=(0, 0),
                                       size=(800, 600))
        self.doc.new()
        self.mainWindow.Show(True)

        return True
Beispiel #3
0
 def OnInit( self ):
     self.gizmo = False
     self._xformTask = None
     
     # Bind publisher events
     pub.subscribe( self.OnUpdate, 'Update' )
     
     # Build main frame, start Panda and replace the wx event loop with
     # Panda's.
     self.frame = ui.MainFrame( None, size=(800, 600) )
     ShowBase( self.frame.pnlViewport )
     self.ReplaceEventLoop()
     self.frame.Show()
     wx.CallAfter( self.FinishInit )
     
     return True
Beispiel #4
0
    if sys.argv[1] in ['-v', '-V', '--version']:
        print('OCI Auditing Tool, version ' + version)
    elif sys.argv[1] in ['--help', '-?']:
        print('OCI Auditing Tool, version ' + version)
        print(help)
    else:
        print('== Error: Invalid arguments ==\n' + help)
    os._exit(0)
elif (argLen > 1 and argLen < argLen_min) or argLen > argLen_max:
    print('== Error: Invalid number of arguments ==\n' + help)
    os._exit(0)

import wx
import the
the.init(version, tool_name)  # after this initialization only, import ui
import ui

# Process command line arguments
# Commandline usage supported with limited options, for normal options, use directly with GUI
if argLen > 1:  # Todo: need to complete
    ui.commandlineMode = True
    ui.commandlineTenancies = sys.argv[1].split()
    the.analysisType = sys.argv[2].split()
    if argLen == 4:
        if sys.argv[3] == 'sendMail': the.sendMail = True
app = wx.App(
    False
)  #mandatory in wx, create an app, False stands for not redirection stdin/stdout
self = ui.MainFrame(None)
app.MainLoop()  #start the applications
Beispiel #5
0
def main(stdscr, args):

    # Audio init
    ensemble = Ensemble()
    ensemble.load_models("./models/parallel", n_models=5, forked=False)

    pa = pyaudio.PyAudio()
    stream = pa.open(format=pyaudio.paInt16,
                     channels=1,
                     rate=FS,
                     input=True,
                     frames_per_buffer=int(FS * BUFFER_SIZE))

    # UI init
    curses.start_color()
    curses.curs_set(False)
    stdscr.clear()

    curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_CYAN)
    curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_WHITE)

    num_rows, num_cols = stdscr.getmaxyx()
    mainframe_x = int((num_cols - ui.WIDTH) / 2)
    mainframe_y = int((num_rows - ui.HEIGHT) / 2)

    mainframe_x = max([mainframe_x, 0])
    mainframe_y = max([mainframe_y, 0])

    mainframe = ui.MainFrame(mainframe_y, mainframe_x)
    mainframe.print_port(args.port)

    # Serial communication init
    if args.port:
        baudrate = 9600
        serial_comm = serial.Serial(args.port, baudrate)

    # Colormap init
    cm = ColorMapper(args.colormap)

    a_rolling, v_rolling = 0.5, 0.5

    while True:
        x = read_and_process_stream(stream)
        features, f_names = ShortTermFeatures.feature_extraction(
            x, FS, WINDOW * FS, STEP * FS)
        a_current, v_current = ensemble.predict_from_features(features)
        a_current, v_current = scale_value(a_current), scale_value(v_current),

        a_rolling = update_rolling_value(a_rolling, a_current)
        v_rolling = update_rolling_value(v_rolling, v_current)

        mainframe.set_bar_value("a_current", int(a_current * 50),
                                f"Arousal: {a_current:.4f}")
        mainframe.set_bar_value("v_current", int(v_current * 50),
                                f"Valence: {v_current:.4f}")

        mainframe.set_bar_value("a_rolling", int(a_rolling * 50),
                                f"Arousal: {a_rolling:.4f}")
        mainframe.set_bar_value("v_rolling", int(v_rolling * 50),
                                f"Valence: {v_rolling:.4f}")

        rgb = cm.get_color(a_rolling, v_rolling)
        colorname = cm.rgb_to_name(rgb)
        mainframe.print_rgb(rgb, colorname)

        if args.port:
            serial_comm.write(bytes([1] + list(rgb)))
Beispiel #6
0
#!/usr/bin/python
# -*- coding:utf-8 -*-
import wx
import ui
import glob
import sys


class Main(wx.App):
    def __init__(self,
                 redirect=False,
                 filename=None,
                 useBestVisual=False,
                 clearSigInt=True):
        super(Main, self).__init__(redirect, filename, useBestVisual,
                                   clearSigInt)


if __name__ == "__main__":
    reload(sys)
    sys.setdefaultencoding('utf-8')
    main = Main()
    customsize = (wx.DisplaySize()[0] * 0.7, wx.DisplaySize()[1] * 0.9)
    frame = ui.MainFrame(None, wx.ID_ANY, glob.SOFTWARE_NAME, size=customsize)
    main.MainLoop()