コード例 #1
0
ファイル: namelist.py プロジェクト: swprojects/unimacro
def runPanel(frame, notebook):
    """add functions to controlpanel"""
    print 'starting cp %s'% __name__
    from controlpanel import ControlPanel
    cp = ControlPanel(notebook, frame, -1, __name__)
    cp.addFunction(namelist, 'inputfile, outputfile')
    cp.addDefaults()
    print 'started cp %s'% __name__
    return cp
コード例 #2
0
    def __init__(self, parent, id = wx.ID_ANY, title="",
                 pos = wx.DefaultPosition, size = wx.DefaultSize,
                 style = wx.DEFAULT_FRAME_STYLE,
                 name = "MyFrame"):

        super(MyFrame, self).__init__(parent, id, title,
                                      pos, size, style, name)

        # reference to main app
        self.app = wx.GetApp()

        # two panel layout: the left panel is always the EventPanel.
        # The right panel starts off as a MarketPanel (which is
        # empty), but this can change to be a PricePanel.  
        self._epanel = EventPanel(self)

        self._splitter = wx.SplitterWindow(self)
        self._mpanel = MarketPanel(self._splitter)
        self._ppanel = PricePanel(self._splitter)
        self._cpanel = ControlPanel(self._splitter,
                                    style = wx.BORDER_SUNKEN)

        # splash panel is ugly place holder at the moment
        self._spanel = SplashPanel(self._splitter, 'logo.png')
        self.ShowSplashPanel()

        # layout
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self._epanel, 0, wx.EXPAND | wx.ALL, 10)
        self.sizer.Add(self._splitter, 1, wx.EXPAND)
        self.SetSizer(self.sizer)

        # logo
        path = os.path.abspath("./logo.png")
        icon = wx.Icon(path, wx.BITMAP_TYPE_PNG)
        self.SetIcon(icon)

        # menus
        self.CreateMenus()

        # StatusBar
        self.CreateStatusBar()

        # event handler for close
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # store dict of open frames from the menu only
        self._oframes = {'settings': None,
                         'strategies': None,
                         'automations': None,
                         'orders': None,
                         'livebets': None
                         }

        self.Layout()
コード例 #3
0
ファイル: mainframe.py プロジェクト: liudhzhyym/pythogram
 def __init__(self, parent):
   wx.Panel.__init__(self, parent=parent, style=wx.BORDER_SUNKEN)
   self.SetBackgroundColour("white")
   
   # control panel for user input/output
   self.control_panel = ControlPanel(self)
   
   # create sine signal
   self.signal = Sine()
   self.nfft = 256
   
   self.createMatplotPanels()
   
   # the main box sizer
   main_hbox = wx.BoxSizer(wx.HORIZONTAL)
   self.SetSizer(main_hbox)
   
   # left box containing control panel and spectrogram
   left_vbox = wx.BoxSizer(wx.VERTICAL)
   left_vbox.Add(item=self.control_panel, proportion=0, flag=wx.EXPAND)
   left_vbox.Add(item=self.matplot_panel3, proportion=1, flag=wx.EXPAND)
   
   # right box for signal and spectrum
   right_vbox = wx.BoxSizer(wx.VERTICAL)
   right_vbox.Add(item=self.matplot_panel1, proportion=1, flag=wx.EXPAND)
   right_vbox.Add(item=self.matplot_panel2, proportion=1, flag=wx.EXPAND)
   
   # all together in main box
   main_hbox.Add(item=left_vbox, proportion=5, flag=wx.EXPAND)
   main_hbox.Add(item=right_vbox, proportion=4, flag=wx.EXPAND)
コード例 #4
0
ファイル: Timer4.py プロジェクト: ofirtal/WorkRest_Timer
    def __init__(self, root):
        self.root = root
        self.root.title('Timer')
        self.root.iconbitmap(
            'C:\\Users\\Adi Tal\\PycharmProjects\\Tkinter_Projects\\timer3\\clock_icon.ico'
        )
        self.clock_running = False
        self.is_work_flag = True
        self.continuation = False
        self.total_time = 0
        self.work_time = 0
        self.rest_time = 0
        self.clock_h = 0
        self.clock_m = 0
        self.clock_s = 0

        # frames from different class
        self.free_note = Note(root, 0, 0)
        self.timer_reg = TimeInput(root, 'Main Timer', 1, 0)
        self.display_of_time = TimeShow(root, 2, 0)
        self.work_time_input = TimeInput(root, 'Work time', 7, 0)
        self.rest_time_input = TimeInput(root, 'Rest time', 8, 0)
        self.sound_frame = PlayTheSound(root, 9, 0)
        self.control_panel = ControlPanel(root, 0, 1, self.start_regular_timer,
                                          self.clear_func, self.pause_clock,
                                          self.continue_clock,
                                          self.start_work_rest_timer)
コード例 #5
0
    def __init__(self, root, machine, files, mach_dir):
        self.root = root
        self.machine = machine
        self.files = files
        self.mach_dir = mach_dir
        self.step = 0
        self.step_text = 'Step: %s'

        self.control_panel = ControlPanel(root, self)
        self.main_viewer = Viewer(self)
        self.update_all()
コード例 #6
0
 def createPanel(self):
     controlPanel = ControlPanel(self, -1, self.sketch)
     box = wx.BoxSizer(wx.HORIZONTAL)
     # (object to be added, stretchfactor (+ve is relative), bitmask flag)
     # verticalbox (stretchfactor = vertical change, flag = horizontal change)
     # horizontalbox (stretchfactor = horizontal change, flag = vertical change)
     # EXPAND = totally fill available space
     # controlPanel = no horizontal change, expand to fill vertical
     box.Add(controlPanel, 0, wx.EXPAND)
     box.Add(self.sketch, 1, wx.EXPAND)
     self.SetSizer(box)
コード例 #7
0
ファイル: namelist.py プロジェクト: tanabarr/unimacro
def runPanel(frame, notebook):
    """add functions to controlpanel"""
    print 'starting cp %s' % __name__
    from controlpanel import ControlPanel
    cp = ControlPanel(notebook, frame, -1, __name__)
    cp.addFunction(namelist, 'inputfile, outputfile')
    cp.addDefaults()
    print 'started cp %s' % __name__
    return cp
コード例 #8
0
	def __init__(self, parent):
		wx.Panel.__init__(self, parent, size = (1100,700))

		self.frame = parent
		self.SetBackgroundColour((40,40,40))
		self.SetForegroundColour((255,255,255))

		self.color_writing = True
		self.speech = True
		self.highlighting = True

		self.mainSizer = wx.BoxSizer(wx.HORIZONTAL)
		self.SetSizer(self.mainSizer)
		
		self.inputPanel = wx.Panel(self)
		self.inputSizer = wx.BoxSizer(wx.VERTICAL)
		self.inputPanel.SetSizer(self.inputSizer)

		self.outputPanel = wx.Panel(self)
		self.outputSizer = wx.BoxSizer(wx.VERTICAL)
		self.outputPanel.SetSizer(self.outputSizer)
		
		self.log = Log(self.outputPanel, self)           # text control for text output
		#self.outputSizer.AddSpacer((0,50))
		self.outputSizer.Add(self.log)

		self.controlPanel = ControlPanel(self.inputPanel, self, size=wx.Size(205,-1))
		self.sourceboard = SourceBoard(self.inputPanel, self, self.log, channels=[])
		
		self.ep = EntryPad(self.outputPanel,self.sourceboard,self.log,self)
		#self.outputSizer.AddSpacer((0,10))
		self.outputSizer.Add(self.ep)

		self.inputSizer.Add(self.controlPanel)
		self.inputSizer.Add(self.sourceboard)
		
		self.mainSizer.Add(self.inputPanel)
		#self.mainSizer.AddSpacer((10,0))
		self.mainSizer.Add(self.outputPanel)
		#self.load_TED()

		#self.load_assembly_module()
		self.addChannel(['/Users/jbrew/Desktop/library/spaceneedle_low'])
		#self.addChannel(['/Users/jbrew/Desktop/library/lyrics/bowie'])
		#self.addPathAsChannel('/Users/jbrew/Desktop/library/beehive_manual.txt')
		#self.addPathAsChannel('/Users/jbrew/Desktop/library/prose/bible/genesis')
		#self.addPathAsChannel('/Users/jbrew/Desktop/library/speeches/feynman/1/_cleaner/all')
		"""
コード例 #9
0
    def onStart(self):
        self.FluoDev = FluoDevice()
        npyscreen.setTheme(npyscreen.Themes.ElegantTheme)
        self.registerForm(MAIN_FORM, \
            FluoForm())

        self.registerForm(BIND_DEVICES_FORM, \
            ConfigDevicesPathsForm())

        self.registerForm(CONFIG_FLUO_FORM, \
            FluorimeterSetupForm())

        self.registerForm(CONFIG_LTR11_FORM, \
            Ltr11SetupForm())

        self.registerForm(CONFIG_LTR210_FORM, \
            Ltr210SetupForm())

        self.registerForm(TEST_PANEL_FORM, \
            ControlPanel())
コード例 #10
0
    def __init__(self):
        # Tk init
        Tk.__init__(self)
        self.title("Visualized Sorting Algorithms")
        self.geometry("{}x{}".format(WIDTH, HEIGHT))
        self.resizable(False, False)

        # Sorting control variables
        self.sorting = False
        data = random_list(0, 100, 200)
        self.sort = list(self.ALGORITHMS.values())[0](data) # First algorithm

        self.sort_delay = 1000/DEFAULT_SORT_SPEED # delay, in milliseconds
        self.tick_timer = current_milli_time()

        # Visualizer init
        self.visualizer = Visualizer(self, width=CANVAS_WIDTH, height=CANVAS_HEIGHT, bd=0, highlightthickness=0)

        # Control panel init
        self.control_panel = ControlPanel(self)

        # Main loop
        while True:
            self.tick()
コード例 #11
0
from tkinter import *
from controlpanel import ControlPanel
if __name__ == '__main__':
    root = Tk()
    panel = ControlPanel(root)
    panel.pack(expand=YES, fill=BOTH)
    root.mainloop()
コード例 #12
0
class MyFrame(wx.Frame):
    """Main window.

    This holds the menus, and manages the panels that are used.
    """
    
    def __init__(self, parent, id = wx.ID_ANY, title="",
                 pos = wx.DefaultPosition, size = wx.DefaultSize,
                 style = wx.DEFAULT_FRAME_STYLE,
                 name = "MyFrame"):

        super(MyFrame, self).__init__(parent, id, title,
                                      pos, size, style, name)

        # reference to main app
        self.app = wx.GetApp()

        # two panel layout: the left panel is always the EventPanel.
        # The right panel starts off as a MarketPanel (which is
        # empty), but this can change to be a PricePanel.  
        self._epanel = EventPanel(self)

        self._splitter = wx.SplitterWindow(self)
        self._mpanel = MarketPanel(self._splitter)
        self._ppanel = PricePanel(self._splitter)
        self._cpanel = ControlPanel(self._splitter,
                                    style = wx.BORDER_SUNKEN)

        # splash panel is ugly place holder at the moment
        self._spanel = SplashPanel(self._splitter, 'logo.png')
        self.ShowSplashPanel()

        # layout
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self._epanel, 0, wx.EXPAND | wx.ALL, 10)
        self.sizer.Add(self._splitter, 1, wx.EXPAND)
        self.SetSizer(self.sizer)

        # logo
        path = os.path.abspath("./logo.png")
        icon = wx.Icon(path, wx.BITMAP_TYPE_PNG)
        self.SetIcon(icon)

        # menus
        self.CreateMenus()

        # StatusBar
        self.CreateStatusBar()

        # event handler for close
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # store dict of open frames from the menu only
        self._oframes = {'settings': None,
                         'strategies': None,
                         'automations': None,
                         'orders': None,
                         'livebets': None
                         }

        self.Layout()

    def CreateMenus(self):
        menubar = wx.MenuBar()

        # file menu
        filemenu = wx.Menu()
        filemenu.Append(wx.ID_FILE, "Load Automation")
        filemenu.Append(wx.ID_EXIT, "Exit")
        menubar.Append(filemenu, "File")
        
        # edit menu
        editmenu = wx.Menu()
        editmenu.Append(wx.ID_PREFERENCES, "Settings")
        menubar.Append(editmenu, "Edit")

        # view menu
        viewmenu = wx.Menu()
        currstrat = viewmenu.Append(wx.ID_ANY, "Current Strategies")
        currord = viewmenu.Append(wx.ID_ANY, "Current Orders")
        currauto = viewmenu.Append(wx.ID_ANY, "Current Automations")
        menubar.Append(viewmenu, "View")

        # help menu
        helpmenu = wx.Menu()
        helpmenu.Append(wx.ID_ABOUT, "About")
        menubar.Append(helpmenu, "Help")

        self.SetMenuBar(menubar)

        # bind events to menu clicks so that we show correct frames
        self.Bind(wx.EVT_MENU, self.OnLoadAutomation, id = wx.ID_FILE)
        self.Bind(wx.EVT_MENU, self.OnClose, id = wx.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.OnCurrentStrategies, currstrat)
        self.Bind(wx.EVT_MENU, self.OnCurrentOrders, currord)
        self.Bind(wx.EVT_MENU, self.OnCurrentAutomations, currauto)
        self.Bind(wx.EVT_MENU, self.OnSettings, id = wx.ID_PREFERENCES)
        self.Bind(wx.EVT_MENU, self.OnAbout, id = wx.ID_ABOUT)

    def OnLoadAutomation(self, event):
        """Load an automation file."""

        dialog = wx.FileDialog(self, "Open automation", "automation/", "",
                               "Py files (*.py)|*.py", 
                               wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)

        if dialog.ShowModal() == wx.ID_CANCEL:
            return

        # we only want to save the name of the file here, and the fact
        # that there is now an automation registered.
        afile = dialog.GetPath()

        # add the automation to the app: this will mean that the
        # automation gets called every tick.
        self.app.AddAutomation(afile)

    def OnCloseFrame(self, event, nm):
        """Called when we close a frame opened by a menu option."""

        print "closing frame", nm

        # remove any listeners so that we don't try to update this
        # view after the frame has been killed.
        if hasattr(self._oframes[nm], 'RemoveListeners'):
            self._oframes[nm].RemoveListeners()

        self._oframes[nm] = None
        print 'sucessfully set oframe to None'
        event.Skip()

    def OnSettings(self, event):
        """Show the settings frame."""

        nm = 'settings'

        frame = self._oframes[nm]
        if frame is None:
            frame = menuframes.SettingsFrame(self)
            self._oframes['settings'] = frame
            frame.Bind(wx.EVT_CLOSE, 
                       lambda e,n=nm: self.OnCloseFrame(e, n))
            frame.Show()
        else:
            frame.Raise()

    def OnAbout(self, event):
        """Show the about dialog."""
        
        # note that the about box is not modal on Linux, which is
        # apparently a bug in wxPython.  This means we can open
        # multiple about boxes.  On Windows and OS/X this is
        # apparently not a problem.  To solve the Linux problem, it
        # seems it is necessary to create a custom about box.
        info = wx.AboutDialogInfo()
        info.SetName(const.NAME)
        info.SetVersion("0.1")
        info.SetCopyright("Copyright (C) 2013-2014 James Mithen")
        # info.SetWebSite()
        wx.AboutBox(info)

    def OnCurrentStrategies(self, event):
        """Show frame with currently running strategies."""

        nm = 'strategies'

        frame = self._oframes[nm]
        if frame is None:
            if self.app.engine.have_strategies():
                if not self._oframes['strategies']:
                    frame = menuframes.CurrentStrategiesFrame(self)
                    frame.Show()
                    self._oframes[nm] = frame
                    frame.Bind(wx.EVT_CLOSE, 
                               lambda e,n=nm: self.OnCloseFrame(e, n))
            else:
                wx.MessageBox("No strategies currently running.", 
                              style=wx.CENTER|wx.OK, parent = self)
        else:
            frame.Raise()

    def OnCurrentOrders(self, event):
        """Show frame with orders made so far and their status."""

        nm = 'livebets'

        frame = self._oframes[nm]

        # MVC
        #self.omodel = models.OrderModel.Instance()

        if frame is None:
            if not self._oframes['livebets']:
                frame = livebetsframe.LiveBetsFrame(self)
                frame.Show()
                self._oframes[nm] = frame
                frame.Bind(wx.EVT_CLOSE, 
                           lambda e,n=nm: self.OnCloseFrame(e, n))
            else:
                wx.MessageBox("No orders made yet.", 
                              style=wx.CENTER|wx.OK, parent = self)
        else:
            frame.Raise()

    def OnCurrentAutomations(self, event):
        """Show frame with currently running automations."""

        nm = 'automations'

        frame = self._oframes[nm]
        if frame is None:
            if self.app.engine.have_automations():
                if not self._oframes['automations']:
                    frame = menuframes.CurrentAutomationsFrame(self)
                    frame.Show()
                    self._oframes[nm] = frame
                    frame.Bind(wx.EVT_CLOSE, 
                               lambda e,n=nm: self.OnCloseFrame(e, n))
            else:
                wx.MessageBox("No automations currently running.", 
                              style=wx.CENTER|wx.OK, parent = self)
        else:
            frame.Raise()

    def OnClose(self, event):
        result = wx.MessageBox("Are you sure you want to close?",
                               style=wx.CENTER|wx.ICON_QUESTION\
                               |wx.OK|wx.CANCEL, parent=self)
        if result == wx.CANCEL:
            if event.CanVeto():
                event.Veto()
        else:
            # save configuration file which may have been changed in
            # settings.
            self.app.gconfig.SaveCurrentConfigToFile()
            # Skip() will go allow the event to propagate to the
            # default event handler, which will destroy the window.
            event.Skip()

    def ShowSplashPanel(self):
        """
        In the main window show the splash panel.  This is called at
        startup only.
        """

        self._splitter.SplitVertically(self._spanel, self._cpanel)
        self._splitter.Unsplit()
        self._splitter.Layout()
        self.Layout()

    def ShowMarketPanel(self):
        """
        In the main window show the Market Panel, which displays
        matching markets for a particular event, and hide all other
        panels.
        """

        # hide the splash panel (this will only have an effect the
        # first time this fn is called).
        self._spanel.Hide()
        
        # stop the timer on the control panel if it is running! The
        # timer updates market prices.  Note we may want to change
        # this at some point.
        self._cpanel.StopUpdatesIfRunning()
        self._ppanel.Hide()
        self._mpanel.Show()
        self._splitter.SplitVertically(self._mpanel, self._cpanel)
        
        # unsplit means we only show the left panel of the splitter
        # window.
        self._splitter.Unsplit()
        self._splitter.Layout()
        self.Layout()
        self._mpanel.Layout()

        # this seems to resize the panel correctly(?) NOPE
        #self._splitter.UpdateSize()

        print "size of splitter: ", self._splitter.GetSize()
        print "size of marketpanel: ", self._mpanel.GetSize()

    def GoToPricePanel(self, name, bdaqmid):
        self.ShowPricePanel()
        self._ppanel.InitMids(name, bdaqmid)

    def ShowPricePanel(self):
        """
        In the main window show the Price Panel, which displays prices
        for a given Market pair, alongisde the control panel.
        """
        
        self._mpanel.Hide()
        self._ppanel.Show()
        self._splitter.SplitVertically(self._ppanel, self._cpanel)
        self._splitter.Layout()
        self.Layout()

    def GetMarketPanel(self):
        return self._mpanel

    def GetEventPanel(self):
        return self._epanel

    def GetPricePanel(self):
        return self._ppanel

    def GetControlPanel(self):
        return self._cpanel