Exemple #1
0
    def __init__( self, parent ):
        wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = "CREST Character Management", pos = wx.DefaultPosition, size = wx.Size( 550,250 ), style = wx.DEFAULT_DIALOG_STYLE )

        mainSizer = wx.BoxSizer( wx.HORIZONTAL )

        self.lcCharacters = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)

        self.lcCharacters.InsertColumn(0, heading='Character')
        self.lcCharacters.InsertColumn(1, heading='Refresh Token')

        self.popCharList()

        mainSizer.Add( self.lcCharacters, 1, wx.ALL|wx.EXPAND, 5 )

        btnSizer = wx.BoxSizer( wx.VERTICAL )

        self.addBtn = wx.Button( self, wx.ID_ANY, u"Add Character", wx.DefaultPosition, wx.DefaultSize, 0 )
        btnSizer.Add( self.addBtn, 0, wx.ALL | wx.EXPAND, 5 )

        self.deleteBtn = wx.Button( self, wx.ID_ANY, u"Revoke Character", wx.DefaultPosition, wx.DefaultSize, 0 )
        btnSizer.Add( self.deleteBtn, 0, wx.ALL | wx.EXPAND, 5 )

        mainSizer.Add( btnSizer, 0, wx.EXPAND, 5 )

        self.addBtn.Bind(wx.EVT_BUTTON, self.addChar)
        self.deleteBtn.Bind(wx.EVT_BUTTON, self.delChar)

        pub.subscribe(self.ssoLogin, 'login_success')

        self.SetSizer( mainSizer )
        self.Layout()

        self.Centre( wx.BOTH )
Exemple #2
0
    def __init__(self, viewer):
        DefaultInteractorStyle.__init__(self, viewer)

        self.viewer = viewer
        self.orientation = self.viewer.orientation
        self.matrix = None

        self.operation = BRUSH_FOREGROUND

        self.mg_size = 3

        self.picker = vtk.vtkWorldPointPicker()

        self.AddObserver("EnterEvent", self.OnEnterInteractor)
        self.AddObserver("LeaveEvent", self.OnLeaveInteractor)

        self.RemoveObservers("MouseWheelForwardEvent")
        self.RemoveObservers("MouseWheelBackwardEvent")
        self.AddObserver("MouseWheelForwardEvent",self.WOnScrollForward)
        self.AddObserver("MouseWheelBackwardEvent", self.WOnScrollBackward)

        self.AddObserver("LeftButtonPressEvent", self.OnBrushClick)
        self.AddObserver("LeftButtonReleaseEvent", self.OnBrushRelease)
        self.AddObserver("MouseMoveEvent", self.OnBrushMove)

        Publisher.subscribe(self.expand_watershed, 'Expand watershed to 3D ' + self.orientation)
        Publisher.subscribe(self.set_operation, 'Set watershed operation')
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Panel.__init__(self, id=wxID_PNLDATATABLE, name=u'pnlDataTable',
              parent=prnt,  size=wx.Size(677, 449),
              style=wx.TAB_TRAVERSAL)
        self.myOlv = FastObjectListView(self, -1, style=wx.LC_REPORT)#Virtual



        # self.myOlv.SetObjectGetter(self.fetchFromDatabase)
        self.myOlv.SetEmptyListMsg("")

        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.myOlv, 1, wx.ALL|wx.EXPAND, 4)
        self.SetSizer(sizer_2)
        self.doneselecting=True

        self.myOlv._highlightBrush=wx.Brush("red")
        self.myOlv.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected )
##        self.myOlv.Bind(wx.EVT_LIST_COL_END_DRAG , self.OnLUp,id=wxID_PNLDATATABLE )
##        self.myOlv.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeSelected )
##        self.myOlv.Bind(wx.EVT_LEFT_UP, self.OnLUp, id=wxID_PNLDATATABLE )
##        self.myOlv.Bind(wx.EVT_LEFT_DOWN, self.OnLDown, id=wxID_PNLDATATABLE)
        Publisher.subscribe(self.OnChangeSelection, ("changeTableSelection"))
        Publisher.subscribe(self.OnRefresh, ("refreshTable"))

        self.Layout()
Exemple #4
0
    def __init__(self, myLog, parent=None, *arg, **kw):
        self._log = myLog

        super(MainFrame, self).__init__(parent, *arg, **kw)

        self._destEmail      = ''
        self._ccEmail        = ''
        self._bugReportEmail = ''

        self.GenerateIDs()
        self.OnInitWidgets()
        self.OnInitMenu()
        self.OnInitLayout()
        self.OnBindEvents()
        self.OnLoadSettings()
        self.OnCheckDestEmail()

        self._log.debug('Creating PyTimer instance for clock.')
        self.clockTimer = wx.PyTimer(self.OnClockTimer)
        self._log.debug('Starting clock timer.')
        self.clockTimer.Start(1000)

        self._log.debug('Creating PyTimer instance for OnBtnTimer.')
        self.buttonTimer = wx.PyTimer(self.OnBtnTimer)
        self._log.debug('Starting the timer for OnBtnTimer.')
        self.buttonTimer.Start(3600000) # 1 Hour intervals

      # Outlook Module
        self._log.debug('Creating instance of the Outlook module.')
        self.olModule = _ol.CustomOutlookModule()

        pub.subscribe(self.SentEmailNotify, 'email.sent')
 def __init__(self, parent):
     
     self.parent = parent
     
     # Set up pubsub
     pub.subscribe(self.OnUpdatePatient, 'patient.updated.raw_data')
     pub.subscribe(self.OnUpdatePatient, 'patient.updated.parsed_data')
 def __init__(self, request, client_address, server):
     self.logger = logging.getLogger("TCPServerHandler")
     self.logger.debug('__init__')
     
     pub.subscribe(self.close_request, 'TCPS_Close_Request')
     pub.subscribe(self.send_data,'TCPS_Send_Data')    
     SocketServer.BaseRequestHandler.__init__(self, request, client_address, server)
    def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)
        global filePath
        
        global ttempA_list
        global tempA_list
        global ttempB_list
        global tempB_list
        
        self.create_title("Temperature Panel")
        self.init_plot()
        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
        self.create_control_panel()
        self.create_sizer()
        
        pub.subscribe(self.OnTimeTempA, "Time Temp A")
        pub.subscribe(self.OnTempA, "Temp A")
        pub.subscribe(self.OnTimeTempB, "Time Temp B")
        pub.subscribe(self.OnTempB, "Temp B")

        
        # For saving the plots at the end of data acquisition:
        pub.subscribe(self.save_plot, "Save_All")
        
        self.animator = animation.FuncAnimation(self.figure, self.draw_plot, interval=500, blit=False)
Exemple #8
0
    def __init__(self, parent, *args, **kwargs):
        """Create the girderPanel."""
        wx.Panel.__init__(self, parent, *args, **kwargs)

        self.parent = parent


        # subscribe the girderPanel to some pubsub messages:
        pub.subscribe(self.onCompleted, 'completed')

###############################################################################
# MORE BRAINSTORM
# 1. Search box for searching buttons, recently used constructs, containers,...
# 2. Constructs (collapsible pane)
# 2.1. Create new construct ... ( and adapters ?? ) -> opens an 'editor' frame
# 2.2. Open/Load existing construct
# 2.3. list of recently used constructs, perhaps also favourites, projects, ...
# 3. Containers
# 3.1. Create new Container ...
# 3.2. Open/Load existing Container
# 3.3. list of recently used containers, perhaps also favourites, projects, ...
# 4. Open pcap file / real-time sniffing with pcapy module ??
# ?? where does the encode/decode frame belong?

    # GIRDER - SEARCH BOX
        self.searchbox = ExtendedSearchCtrl(self,
                                       id=ID_SEARCH_BOX,
                                       style=wx.TE_PROCESS_ENTER)
    # GIRDER - COLLAPSIBLEPANE
    # probably need some kind of list here to make it easy to add stuff
    # also needs drag-n-drop for dropping files
    # perhaps needs some virtual folders (like code::blocks)

        self.cp = cp = wx.CollapsiblePane(self,
                                          label="colpane",
                                 style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp)
        # self.MakePaneContent(cp.GetPane())



        self.newConstructBtn = wx.Button(self,
                                         id= -1,
                                         label="Create new Struct...")
        self.Bind(wx.EVT_BUTTON, self.OnnewConstructBtn, self.newConstructBtn)


        self.newValueBtn = wx.Button(self, id= -1, label="Request new value")
        self.Bind(wx.EVT_BUTTON, self.OnBtn, self.newValueBtn)
       # self.newValueBtn.Bind(wx.EVT_BUTTON, self.OnBtn)

        self.displayLbl = wx.StaticText(self, id= -1, label="Value goes here")

        Sizer = wx.BoxSizer(wx.VERTICAL)
        Sizer.Add(self.searchbox, 0, wx.ALIGN_LEFT | wx.ALL, 5)
        Sizer.Add(self.newConstructBtn, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        Sizer.Add(self.newValueBtn, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        Sizer.Add(self.displayLbl, 0, wx.ALL | wx.CENTER, 5)

        self.SetSizerAndFit(Sizer)
Exemple #9
0
    def __init__(self, parent, title, loggerName, closeButtonText="Close", clearButtonText="Clear"):
        wx.Frame.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.logsTextCtrl = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.TE_WORDWRAP | wx.TE_RICH2)
        closeButton = wx.Button(self, wx.ID_ANY, closeButtonText)
        clearButton = wx.Button(self, wx.ID_ANY, clearButtonText)
        self.loggerName = loggerName

        self.SetTitle(title)
        self.SetSize((521, 461))

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer.Add(self.logsTextCtrl, 6, wx.ALL | wx.EXPAND, 5)
        sizer_2.Add(closeButton, 0, wx.LEFT | wx.RIGHT, 5)
        sizer_2.Add(clearButton, 0, wx.LEFT | wx.RIGHT, 5)
        mainSizer.Add(sizer_2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
        self.SetSizer(mainSizer)
        self.Layout()
        closeButton.Bind(wx.EVT_BUTTON, self.onCloseButton)
        clearButton.Bind(wx.EVT_BUTTON, self.onClearButton)
        pub.subscribe(self.append, constants.PUB_APPENDLOG)
        self.logsTextCtrl.Clear()
        self._attrs = [wx.TextAttr(wx.BLACK), wx.TextAttr(wx.Colour(130, 130, 130))]
        self._attrIndex = 0
        self.append(loggerName, pvscomm.PVSCommunicationLogger().get(loggerName))
Exemple #10
0
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent)
        splitter0 = wx.SplitterWindow(self, id=0, style=wx.SP_3D)
        splitter1 = wx.SplitterWindow(splitter0, id=0, style=wx.SP_3D)

        self.scroll  = wx.ScrolledWindow(splitter0, wx.ID_ANY, style= wx.FULL_REPAINT_ON_RESIZE )
        self.scroll.SetScrollbars(0, 10, 1, 10)
        self.scroll.SetScrollRate( 1, 15 )      # Pixels per scroll increment

        self.dnaview = dnaEditorCairo_GUI.TextEdit(self.scroll, id=wx.ID_ANY) # This generates 8 OnSize draw events

        scrollSizer = wx.BoxSizer()
        scrollSizer.Add(self.dnaview, flag=wx.EXPAND|wx.ALL, border=0)
        self.scroll.SetSizer(scrollSizer)

        self.parent = parent
        self.plasmidview = plasmid_GUI.PlasmidView2(splitter0, -1)

        splitter0.SplitVertically( self.scroll, self.plasmidview, sashPosition=(windowsize[0]/1.75))

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(splitter0, proportion=-1, flag=wx.EXPAND)
        self.SetSizer(sizer)

        # Setup the publisher listeners for use with UI updates
        MSG_CHANGE_TEXT = "change.text" #This message requires the argument "text"
        pub.subscribe(self.onChangeText, MSG_CHANGE_TEXT)


        self.update_ownUI()
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Panel.__init__(self, id=wxID_PNLDATATABLE, name=u'pnlDataTable',
                          parent=prnt, size=wx.Size(677, 449),
                          style=wx.TAB_TRAVERSAL)
        self.parent = prnt
        self.record_service = self.parent.Parent.getRecordService()
        self.myOlv = FastObjectListView(self, -1, style=wx.LC_REPORT)  #Virtual

        # self.myOlv.SetObjectGetter(self.fetchFromDatabase)
        self.myOlv.SetEmptyListMsg("No Series Selected for Editing")
        #self.myOlv.handleStandardKeys = True
        #self.myOlv.rowFormatter = self._rowFormatter

        self.currentItem = None

        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.myOlv, 1, wx.ALL | wx.EXPAND, 4)
        self.SetSizer(sizer_2)

        #self.myOlv.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onItemSelected)
        #self.myOlv.Bind(wx.EVT_CHAR, self.onKeyPress)
        #self.myOlv.Bind(wx.EVT_LIST_KEY_DOWN, self.onKeyPress)

        Publisher.subscribe(self.onChangeSelection, ("changeTableSelection"))
        Publisher.subscribe(self.onRefresh, ("refreshTable"))

        self.Layout()
 def __init__(self, *args, **kwds):
     kwds["style"] = wx.TAB_TRAVERSAL
     wx.Panel.__init__(self, *args, **kwds)
     
     self.panel_details  = wx.Panel(self, -1)
     self.panel_buttons  = panel_buttons(self, -1)
     
     self.label_details = wx.StaticText(self, -1, 'DETAILS')
     self.details_list          = vListCtrl(self.panel_details,  style = wx.LC_HRULES | wx.LC_SINGLE_SEL)
     self.panel_details_botttom = wx.Panel( self.panel_details, -1)
     
     self.txt_ctrl_details_records = wx.TextCtrl(self.panel_details_botttom, -1, "")
     self.txt_ctrl_details_total   = wx.TextCtrl(self.panel_details_botttom, -1, "")
     
     tc = (self.txt_ctrl_details_records,
           self.txt_ctrl_details_total)
     
     pub.subscribe(self.displayData, 'studentpaymentrecords.studentselected')
     
     self.panel_buttons.new.Bind(wx.EVT_BUTTON, self.OnNew,       self.panel_buttons.new )
     self.panel_buttons.edit.Bind(wx.EVT_BUTTON, self.OnEdit,     self.panel_buttons.edit )
     self.panel_buttons.cancel.Bind(wx.EVT_BUTTON, self.OnCancel, self.panel_buttons.cancel )
     self.Bind(wx.EVT_BUTTON, self.OnDelete,  self.panel_buttons.delete)
     self.Bind(wx.EVT_BUTTON, self.OnSave,    self.panel_buttons.save)
     self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.panel_buttons.refresh )
     
     for t in tc: t.SetEditable(False)
     self.__layout()
    def __init__(self, *args, **kwds):
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        
        self.panel_filter_dates   = wx.Panel(self, -1)
        self.label_from           = wx.StaticText(self.panel_filter_dates,  -1, "Date")
        self.datepicker_ctrl_from = DateCtrl(self.panel_filter_dates, -1)
        self.label_to             = wx.StaticText(self.panel_filter_dates, -1, "to")
        self.datepicker_ctrl_to   = DateCtrl(self.panel_filter_dates, -1)
    
        self.label_pay_type       = wx.StaticText(self.panel_filter_dates,  -1, "Payment Type")
        self.choice_pay_type      = wx.Choice(self.panel_filter_dates,      -1, choices=[])
        
        self.vList                = vListCtrl(self, style = wx.LC_HRULES | wx.LC_SINGLE_SEL)
        
        self.text_ctrl_record_count = wx.TextCtrl(self, -1, '')
          
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.vList)
 
        self.Bind(wx.EVT_CHOICE,   self.OnSelectSaleItem, self.choice_pay_type)
        
        pub.subscribe(self.DateChange, 'DateCtrl.date_change')
        
        self.__set_properties()
        self.__do_layout()
        self.__do_main()
Exemple #14
0
    def __init__(self, full_screen=True, top_window=False):

        if top_window:
            win_style = wx.CLIP_CHILDREN | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR | \
                      wx.NO_BORDER | wx.FRAME_SHAPED | wx.DEFAULT_FRAME_STYLE
        else:
            win_style = wx.DEFAULT_FRAME_STYLE

        (win_pos, win_size) = self.top_right()

        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title="Mondrian",
                          style=win_style, pos=win_pos, size=win_size)

        # EVT_KEY_DOWN doesn't seem to work on OS X
        self.Bind(wx.EVT_CHAR_HOOK, self.on_key)

        self.Bind(wx.EVT_SIZE, self.on_size)

        Publisher.subscribe(self.shutdown, SHUTDOWN_PUBSUB)

        MainPanel(self)
        self.Show()

        if full_screen:
            self.ShowFullScreen(True)
 def __init__(self, *args, **kwargs):
     wx.Frame.__init__(self, *args, **kwargs)
     self.init_UI()
     self.create_statusbar()
     self.create_menu()
     
     pub.subscribe(self.update_statusbar, "Status Bar")
Exemple #16
0
    def __init__(self, parent = None):
        scrolled.ScrolledPanel.__init__(self, parent, -1)

        self.sr = 250 
        self.leadNum = 2
        self.step = 5
        self.clip_len = self.sr*self.step
        self.ecg_data = [] 

        self.ecg_cfg = ecg_data.ECG_Config()
        self.obj_ecg_data = ecg_data.ECG_Data()


        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add(self.buildPlayECG_bar())
        self.mgnfied_ecg = PlotCanvasDiv(self)
        vbox.Add(self.mgnfied_ecg,1,wx.EXPAND)

        self.SetSizer(vbox)
        self.SetAutoLayout(1)
        self.SetupScrolling()

        pub.subscribe(self._update,"msg_timer") 
        pub.subscribe(self._getFilePath, "fOpen_filePath")
Exemple #17
0
    def __init__(self, parent=None, message=None, wait_time=None):
        """
        Class constructor

        @param parent    Parent object
        @param message   Message to be displayed
        @param wait_time Max time to wait for a response (in seconds)
        """
        ConfigDialog.__init__(self, parent, title="Waiting...")
        
        pub.subscribe(self.cb_close, "close_wait")
        
        ## Message to be displayed
        self.message = message
        ## Max time to wait for a response (in seconds)
        self.wait_time = wait_time
        ## Timer
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self._cb_timedout, self.timer)
        ## Create widgets
        self._createControls()
        ## Layout widgets
        self.doLayout()
        ## Fit dialog size to its contents
        self.Fit()
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        pub.subscribe(self.myListener, "panelListener")

        btn = wx.Button(self, label="Open Frame")
        btn.Bind(wx.EVT_BUTTON, self.onOpenFrame)
Exemple #19
0
    def __init__(self, tab_data, main_frame, settings_controller, roa, vas):
        """
        tab_data (MicroscopyGUIData): the representation of the microscope GUI
        main_frame: (wx.Frame): the frame which contains the 4 viewports
        settings_controller (SettingsController)
        roa (VA): VA of the ROA
        vas (list of VAs): all the VAs which might affect acquisition (time)
        """
        self._tab_data_model = tab_data
        self._main_data_model = tab_data.main
        self._main_frame = main_frame
        self._roa = roa
        self._vas = vas

        # For file selection
        self.conf = conf.get_acqui_conf()

        # for saving/restoring the settings
        self._settings_controller = settings_controller
        self._orig_settings = {} # Entry -> value to restore

        # TODO: this should be the date at which the user presses the acquire
        # button (or when the last settings were changed)!
        # At least, we must ensure it's a new date after the acquisition
        # is done.
        # Filename to save the acquisition
        self.filename = model.StringVA(self._get_default_filename())
        self.filename.subscribe(self._onFilename, init=True)

        # For acquisition
        # a ProgressiveFuture if the acquisition is going on
        self.btn_acquire = self._main_frame.btn_sparc_acquire
        self.btn_change_file = self._main_frame.btn_sparc_change_file
        self.btn_cancel = self._main_frame.btn_sparc_cancel
        self.acq_future = None
        self.gauge_acq = self._main_frame.gauge_sparc_acq
        self.lbl_acqestimate = self._main_frame.lbl_sparc_acq_estimate
        self._acq_future_connector = None

        # TODO: share an executor with the whole GUI.
        self._executor = futures.ThreadPoolExecutor(max_workers=2)

        # Link buttons
        self.btn_acquire.Bind(wx.EVT_BUTTON, self.on_acquisition)
        self.btn_change_file.Bind(wx.EVT_BUTTON, self.on_change_file)
        self.btn_cancel.Bind(wx.EVT_BUTTON, self.on_cancel)

        self.gauge_acq.Hide()
        self._main_frame.Layout()

        # TODO: we need to be informed if the user closes suddenly the window
        # self.Bind(wx.EVT_CLOSE, self.on_close)

        # Event binding
        pub.subscribe(self.on_setting_change, 'setting.changed')
        # TODO We should also listen to repetition, in case it's modified after we've
        # received the new ROI. Or maybe always compute acquisition time a bit delayed?
        for va in vas:
            va.subscribe(self.onAnyVA)
        roa.subscribe(self.onROA, init=True)
 def __bind_events(self):
     self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption)
     Publisher.subscribe(self.OnEnableState, "Enable state project")
     Publisher.subscribe(self.OnOverwrite, 'Create surface from index')
     Publisher.subscribe(self.OnFoldSurface, 'Fold surface task')
     Publisher.subscribe(self.OnFoldExport, 'Fold export task')
     Publisher.subscribe(self.SetNavigationMode, "Set navigation mode")
Exemple #21
0
    def start_gui(self, controller):
        self.controller = controller
        # tell FrameManager to manage this frame
        self._mgr = wx.aui.AuiManager()
        self._mgr.SetManagedWindow(self)

        # create menu
        mb = wx.MenuBar()

        file_menu = wx.Menu()
        file_menu.Append(wx.ID_EXIT, "Exit")

        help_menu = wx.Menu()
        help_menu.Append(ID_About, "About...")

        mb.Append(file_menu, "File")
        mb.Append(help_menu, "Help")

        self.SetMenuBar(mb)

        self.SetMinSize(wx.Size(400, 300))

        # create some center panes
        self._mgr.AddPane(MainNotebookPanel(self, self, controller._interp), wx.aui.AuiPaneInfo().Caption("Raw HTTP Content").Name("analysis_notebook").CenterPane())
        self._mgr.AddPane(self.CreateNotebook(), wx.aui.AuiPaneInfo().Name("main_notebook").CenterPane())
        self._mgr.Update()

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_About)

        pub.subscribe(self.OnAddTab, "create_tab")
Exemple #22
0
 def __init__(self, parent = None):
     """
     
         Initialization.
         
         Parameters:
             parent    -    parent window (wx.Window)
     
     """
     self.is_loop = False
     self.is_display = False
     self.is_save = False
     self.is_axis = False
     self.is_input = False
     self.is_root = False
     self.is_active = True
     self.is_visible = True
     self.can_run = True
     self.host = parent
     self.name = self.__extname__
     self.itmList = []
     self.propNodes = []
     self.propNames = []
     self.m_id = 0
     #self.propFont = wx.Font(8,wx.DECORATIVE,wx.NORMAL,wx.NORMAL)
     #self.propColour = "#3F3F3F"
     self.config = [] # variables to be saved in config files
     pub.subscribe(self.stop, "scan.stop")
Exemple #23
0
    def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        
        self.label_heading = wx.StaticText(self, -1, '')
        
        self.panel_middle  = wx.Panel(self, -1)
        
        heading = (('',10), ('',10), ('',10))
        self.vlist_ctrl_pool = VirtualList(self.panel_middle, heading, style = wx.LC_HRULES)
        self.scrolledPanel   = scrolled.ScrolledPanel(self.panel_middle, - 1,  size=wx.DefaultSize)
        self.panel_footer    = wx.Panel(self, -1, style=wx.TAB_TRAVERSAL)
        self.text_ctrl_1     = wx.TextCtrl(self.panel_footer, -1, 'x')
        self.text_ctrl_2     = wx.TextCtrl(self.panel_footer, -1, 'x')

        self.panel_btns_footer_mid = wx.Panel(self.panel_footer,   -1, style=wx.TRANSPARENT_WINDOW | wx.TAB_TRAVERSAL)
        self.panel_save_spc        = wx.Panel(self.panel_footer,   -1, style=wx.TAB_TRAVERSAL)

        self.button_save   = wx.Button(self.panel_save_spc,        -1,  label='Save')
        self.button_delete = wx.Button(self.panel_btns_footer_mid, -1, 'Delete')
        self.button_add    = wx.Button(self.panel_btns_footer_mid, -1, 'Add')
        self.button_edit   = wx.Button(self.panel_btns_footer_mid, -1, 'Edit')
        
        pub.subscribe(self.displayData, 'exculFilter.changed')
        #self.vlist_ctrl_pool.Bind(wx.EVT_LIST_BEGIN_DRAG, self.OnBeginDrag)
        
        self.button_save.Bind(wx.EVT_BUTTON,   self.OnSave)
        #self.button_delete.Bind(wx.EVT_BUTTON, self.OnDelete)
        #self.button_add.Bind(wx.EVT_BUTTON,    self.OnAdd)
        #self.button_edit.Bind(wx.EVT_BUTTON,   self.OnEdit)

        self.__do_properties()
        self.__do_layout()
        self.__do_main()
Exemple #24
0
    def __init__(self, tab_data, stream_bar, static=False, locked=False):
        """
        tab_data (MicroscopyGUIData): the representation of the microscope Model
        stream_bar (StreamBar): an empty stream panel
        static (Boolean): Treat streams as static
        locked (Boolean): Don't allow to add/remove/hide/show streams
        """
        self._tab_data_model = tab_data
        self._main_data_model = tab_data.main
        self._stream_bar = stream_bar

        self._scheduler_subscriptions = {} # stream -> callable
        self._sched_policy = SCHED_LAST_ONE # works well in most cases

        if stream_bar.btn_add_stream:
            self._createAddStreamActions()

        self._tab_data_model.focussedView.subscribe(self._onView, init=True)
        pub.subscribe(self.removeStream, 'stream.remove')

        # TODO: uncomment if needed
        # if hasattr(tab_data, 'opticalState'):
        #     tab_data.opticalState.subscribe(self.onOpticalState, init=True)
        #
        # if hasattr(tab_data, 'emState'):
        #     tab_data.emState.subscribe(self.onEMState, init=True)

        # This attribute indicates whether live data is processed by the streams
        # in the controller, or that they just display static data.
        self.static_mode = static
        # Disable all controls
        self.locked_mode = locked
Exemple #25
0
    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"FengxEngine 1.0", pos = wx.DefaultPosition, size = wx.Size( 876,685 ), style =wx.DEFAULT_FRAME_STYLE  ) #wx.NO_BORDER|wx.TAB_TRAVERSAL ) #wx.RESIZE_BORDER|

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
        self.SetForegroundColour( UI_COLOR_MAIN_FG )
        self.SetBackgroundColour( UI_COLOR_MAIN_BG )

        self.tex_show = wx.TextCtrl(self, -1, "", size=(125, -1),style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
        self.tex_input = wx.TextCtrl(self, -1, "", size=(125, -1),style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
        self.but_send = wx.Button(self, 10, "send", (20, 20))
        self.but_send.Bind(wx.EVT_BUTTON, self.OnClick_send)
        self.tex_show.SetBackgroundColour( UI_COLOR_MAIN_BG )
        self.tex_input.SetBackgroundColour( UI_COLOR_MAIN_BG )


        Sizer_main = wx.BoxSizer( wx.VERTICAL )
        Sizer_send = wx.BoxSizer( wx.HORIZONTAL )
        # self.p_moveBar.Layout()
        self.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)
        # self.box_movebar.Fit( self.p_moveBar)
        Sizer_send.Add( self.tex_input, 7, wx.EXPAND |wx.ALL, 0 )
        Sizer_send.Add( self.but_send, 3, wx.EXPAND |wx.ALL, 0 )
        Sizer_main.Add( self.tex_show, 6, wx.EXPAND |wx.ALL, 0 )
        Sizer_main.Add( Sizer_send, 4, wx.EXPAND |wx.ALL, 0 )
        # bSizer_mainScene.Add( self.tree_project, 1, wx.ALL|wx.EXPAND, 0 )

        self.SetSizer( Sizer_main )
        self.Layout()
        self.Centre( wx.BOTH )
        #pub.subscribe(self.recvMsg, "recvMsg")
        pub.subscribe(self.recvMsgFromServer, "getMsg")
 def __bind_events(self):
     Publisher.subscribe(self.SetThresholdBounds,
                                     'Update threshold limits')
     Publisher.subscribe(self.ChangeMaskColour, 'Change mask colour')
     Publisher.subscribe(self.SetGradientColour, 'Add mask')
     Publisher.subscribe(self._set_brush_size, 'Set edition brush size')
     Publisher.subscribe(self._set_threshold_range_gui, 'Set edition threshold gui')
Exemple #27
0
 def __init__(self, parent, style):
     wx.Panel.__init__(self, parent=parent, style=style)
     
     pub.subscribe(self.UpdateFloor, 'updateFloor')
     pub.subscribe(self.UpdateDirection, 'updateDirection')
     
     self.InitUI()
    def RebootPlayer(self):
        self.prgDialog = wx.ProgressDialog(tr("dlg_title_reboot"), wordwrap(tr("dlg_msg_reboot"), 350, wx.ClientDC(self)), parent = self)
        Publisher.subscribe(self.RebootComplete, "boot_complete")
        self.prgDialog.Pulse()

        msgData = network.messages.getMessage(PLAYER_REBOOT)
        network.udpconnector.sendMessage(msgData, self.host, UDP_REBOOT_TIMEOUT)
Exemple #29
0
    def __init__(self, parent, statusbar):
        scrolled.ScrolledPanel.__init__(self, parent)
        self.statusbar = statusbar
        self.parent = parent

        self.list = FastObjectListView(self, sortable=True, style=wx.LC_REPORT | wx.SUNKEN_BORDER, size=(950, 350))
        self.list.handleStandardKeys = False
        self.list.SetEmptyListMsg("This database has no rows")
        self.list.SetEmptyListMsgFont(wx.FFont(24, wx.DEFAULT, faceName="Tekton"))

        self.width_date = 170
        self.width = 100
        self.width_model = 130
        self.check_date = 0

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnItemSelected, self.list)

        mastersizer = wx.BoxSizer(wx.HORIZONTAL)
        mastersizer.Add(self.list, 0, wx.ALL, 5)

        pub.subscribe(self.fill_list, pubsub_fill_list_DB)
        pub.subscribe(self.re_fill_list, pubsub_update_db_nb_line)

        self.SetSizer(mastersizer)
        self.Layout()
        self.SetAutoLayout(1)
        self.SetupScrolling()
        self.initialize_list()
        c = DataBaseUse()
        c.initialize_database()
Exemple #30
0
  def __init__(self, name):
      wx.Frame.__init__(self, None, -1, title=name)
      # Global variables
      self.title = name
      self.files = {}
      self.running = False
      self.SE = ScriptEngine(self)
      self.target = 0

      # Layout part 1...
      FileMenu(self)
      Toolbar(self)

      self.SetMinSize((400,400))
      self._layout()
      self.Centre()
      self.Show()
      self.SetSize((900, 800))

      # If given statupargument(s), try to open as file

      if len(sys.argv) > 1:
        for path in sys.argv[1:]: 
          try:
            self.argumentOpen(path)
          except:
            self.writeLn('No such file: %s' % path)


      # CONNECT EVENTS
      Publisher.subscribe(self.scriptMsg, "update")
      self.tc.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onActivateFile)
Exemple #31
0
 def __init__(self, parent):
     self.notUseDetaul = None
     wx.Panel.__init__(self, parent=parent)
     BSizer = wx.BoxSizer(wx.VERTICAL)
     self.imagesDir = os.path.join(".", "images")
     self.screenShotDir = os.path.join(".", "screenShot")
     self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"),
                                            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
     self.screenShot = wx.StaticBitmap(self, -1, self.defaultScreenShotImage)
     self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.draw_or_reload_all)
     self.statusBar = wx.StaticText(self, -1, "")
     BSizer.Add(self.statusBar)
     BSizer.Add(self.screenShot, proportion=0, flag=wx.ALL, border=10)
     self.SetSizer(BSizer)
     pub.subscribe(self.update_status, "update")
     pub.subscribe(self.draw_from_selected_node, "DrawFromSelectedNode")
     pub.subscribe(self.do_swipe_or_input, "DoSwipeOrInput")
     self.hasDrew = False
     self.Fit()
Exemple #32
0
    def __init__(self,
                 parent,
                 num_tasks=None,
                 msg='Please wait...',
                 size=(400, 300),
                 *args,
                 **kwargs):
        wx.Dialog.__init__(self, parent, size=size, *args, **kwargs)

        self.signal = 'signals.progress.{id}'.format(id=id(self))

        panel = wx.Panel(self)
        t_msg = wx.StaticText(panel, label=msg)
        self.t_task = wx.StaticText(panel, label='')
        self.gauge = wx.Gauge(panel, size=(200, 25))

        panel.sizer = vbox(t_msg, self.t_task, self.gauge)
        panel.SetSizer(panel.sizer)
        panel.Fit()
        self.Fit()

        self.alive = True
        self.mailbox = multiprocessing.Queue()
        self.finish_cb = None

        pub.subscribe(self._start_event, self.signal + '.start')
        pub.subscribe(self._tick_event, self.signal + '.tick')
        pub.subscribe(self._done_event, self.signal + '.done')

        self.num_tasks = num_tasks
        if num_tasks is not None:
            self.val = 0
            self.gauge.SetRange(num_tasks)
            self.timer = None
        else:
            self.val = None
            self.gauge.Pulse()
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, lambda _: self.deliver())
            self.timer.Start(50)

        self.Show()
Exemple #33
0
    def InitUI(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        # Create the dialog
        self.text = wx.TextCtrl(self, value=self.message,
                size=(600, 100), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.gauge = wx.Gauge(self, range=100, size=(250, 25))
        self.cancel = wx.Button(self, wx.ID_CANCEL)

        # Window design
        sizer.Add(self.text)
        sizer.Add(self.gauge)
        sizer.Add(self.cancel)

        # Event binding
        pub.subscribe(self.OnUpdateProgress, "UpdateProgress")
        pub.subscribe(self.OnUpdateText, "UpdateText")
        pub.subscribe(self.OnUpdateTitle, "UpdateTitle")
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)
    def __init__(self, parent=None):
        wx.Frame.__init__(self, parent, -1, __appname__, size=(650, 440))

        self.init_gui()

        icon = get_icon_path()
        if icon is not None:
            self.SetIcon(wx.Icon(icon, wx.BITMAP_TYPE_PNG))

        Publisher.subscribe(self.update_handler, "update")
        Publisher.subscribe(self.download_handler, "dlmanager")
        Publisher.subscribe(self.download_handler, "dlthread")

        self.opt_manager = OptionsManager(CONFIG_PATH)
        self.download_manager = None
        self.update_thread = None
        self.log_manager = None

        if self.opt_manager.options['enable_log']:
            self.log_manager = LogManager(CONFIG_PATH,
                                          self.opt_manager.options['log_time'])
Exemple #35
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
	
        self.mySer = None
	self.applicationIsConnected = False
        #self.Bind(wx.EVT_PAINT, self.OnPaint)

	traceSizer = self.setup_trace_sizer()
	statusSizer = self.setup_status_sizer()
	nullSizer2 = wx.BoxSizer(wx.VERTICAL)

        topSizer = wx.BoxSizer(wx.VERTICAL)
	topSizer.Add(traceSizer, 0, wx.TOP|wx.LEFT|wx.RIGHT, BORDER1)
	topSizer.Add(statusSizer, 0, wx.TOP|wx.LEFT|wx.RIGHT, BORDER1)
        self.SetSizer(topSizer)

	pub.subscribe(self.serialListener, 'serialListener')
	pub.subscribe(self.configListener, 'configListener')
	pub.subscribe(self.dataListener, 'dataListener')

        logging.basicConfig(format="%(filename)s: %(funcName)s() - %(message)s", level=logging.INFO)
Exemple #36
0
    def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        self.app = wx.GetApp()
        self.propExps = {}
        self.refocus = False

        # Define how each type of value should be edited
        self.propMap = {
            None: wxpg.PropertyCategory,
            pm.Vec2: custProps.Float2Property,
            pm.Vec3: custProps.Float3Property,
            pm.Vec4: custProps.Float4Property,
            pm.Point2: custProps.Point2Property,
            pm.Point3: custProps.Point3Property,
            pm.Point4: custProps.Point4Property,
            pm.NodePath: custProps.NodePathProperty,
            int: wxpg.IntProperty,
            str: wxpg.StringProperty,
            bool: wxpg.BoolProperty,
            float: wxpg.FloatProperty,
            Filename: custProps.FilePathProperty,
            dict: custProps.DictProperty
        }

        # Bind publisher events
        pub.subscribe(self.OnUpdate, 'Update')
        pub.subscribe(self.OnUpdate, 'UpdateSelection')
        pub.subscribe(self.OnSelectionModified, 'SelectionModified')

        # Build property grid
        self.pg = PropertyGrid(self)

        # Bind property grid events
        self.pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPgChanged)

        # Build sizers
        self.bs1 = wx.BoxSizer(wx.VERTICAL)
        self.bs1.Add(self.pg, 1, wx.EXPAND)
        self.SetSizer(self.bs1)
Exemple #37
0
    def __init__(self, parent, *args, **kwargs):
        wx.Frame.__init__(self, parent, *args, **kwargs)
        self.SetIcon(wx.Icon(wx.IconLocation(str(ICON_PATH))))
        self.SetSizeHints(minW=500, minH=500)
        self._Devices = self._ProbeDevices()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(EVT_PUBSUB, self.OnPubSend)

        # Create notebook and its pages.
        notebook = wx.Notebook(self)
        notebook.AddPage(
            MiningScreen(notebook, devices=self._Devices),
            text='Mining')
        notebook.AddPage(
            BenchmarksScreen(notebook, devices=self._Devices),
            text='Benchmarks')
        notebook.AddPage(
            SettingsScreen(notebook),
            text='Settings')
        notebook.AddPage(
            AboutScreen(notebook),
            text='About')

        # Check miner downloads.
        pub.subscribe(self._OnDownloadProgress, 'download.progress')
        self._DlThread = self._DlProgress = None
        self._DownloadMiners()

        # Read user data.
        pub.subscribe(self._OnSettings, 'data.settings')
        pub.subscribe(self._OnBenchmarks, 'data.benchmarks')

        loaded_settings = nuxhash.settings.load_settings(CONFIG_DIR)
        if loaded_settings == nuxhash.settings.DEFAULT_SETTINGS:
            self._FirstRun()
        pub.sendMessage('data.settings', settings=loaded_settings)

        pub.sendMessage(
            'data.benchmarks',
            benchmarks=nuxhash.settings.load_benchmarks(CONFIG_DIR, self._Devices))
Exemple #38
0
    def __init__(self, parent, image=None):
        wx.Panel.__init__(self, parent)

        self.parent = parent

        fm = FileManager()
        fm.New('image', BITMAP_SIZE, BITMAP_SIZE)

        self.OnSize(self)
        self.SetCursor(wx.StockCursor(wx.CURSOR_PENCIL))

        self.Bind(wx.EVT_MOTION, self.OnMouseMove)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

        pub.subscribe(self.OnSize, "SizeBitmap")
        pub.subscribe(self.UpdateBitmap, "UpdateBitmap")
        pub.subscribe(self.OnRecolor, "Recolor")
Exemple #39
0
    def OnInit(self):
        self.com = commandparser()
        self.worker = None
        self.OnStart(None)

        self.mainframe = MainFrame(None, self.com.model, self)
        self.resframe = ResultFrame(self.mainframe, self.com.results)
        self.mainframe.Show()
        #self.resframe.Show()

        pub.subscribe(self.OnCommand, "COMMAND")
        pub.subscribe(self.OnGUI, "GUI")
        pub.subscribe(self.OnGUIREFRESH, "GUIREFRESH")

        redir = RedirectText(self.mainframe.TextMessage)
        sys.stdout = redir

        print '*Webfe desktop version started on %s' % datetime.datetime.now()

        # Set up event handler for any worker thread results
        EVT_RESULT(self, self.OnResult)

        return True
Exemple #40
0
    def __init__(self, conf):
        self.conf = conf
        resources_path = self.conf.get('general', 'resources_path')

        config_fpath = self.conf.get('orbslam', 'config_fpath')
        voc_db_fpath = resources_path + '/ORBvoc.txt'

        frame_width = self.conf.getint('camera', 'width')
        frame_height = self.conf.getint('camera', 'height')
        self.model = DMCModel(config_fpath,
                              voc_db_fpath,
                              frame_width,
                              frame_height)

        self.view = PCapMainFrame(self, resources_path)

        self.mvs_builder = DMCDenseStereoBuilder(self)
        self.working_dir = None

        pub.subscribe(self.update_frame, "new frame")
        pub.subscribe(self.update_odometry, "new odometry")
        pub.subscribe(self.update_keyframe, "new keyframe")

        self.view.Show()
Exemple #41
0
 def __bind_evt(self):
     Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list')
     #Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview')
     #Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel')
     #Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel')
     pass
Exemple #42
0
 def __bind_pubsub_evt(self):
     #Publisher.subscribe(self.SelectSeries, 'Select series in import panel')
     Publisher.subscribe(self.Populate, 'Populate tree')
     Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list')
Exemple #43
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        backgroud_colour = wx.Colour(255, 255, 255)
        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        # Image(s) for buttons
        BMP_ADD = wx.Bitmap(os.path.join(const.ICON_DIR, "object_add.png"),
                            wx.BITMAP_TYPE_PNG)
        #BMP_ADD.SetWidth(25)
        #BMP_ADD.SetHeight(25)

        # Button for creating new surface
        button_new_mask = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
                                   pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
        button_new_mask.SetBackgroundColour(self.GetBackgroundColour())
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Fixed hyperlink items
        tooltip = wx.ToolTip(
            _("Create mask for slice segmentation and editing"))
        link_new_mask = hl.HyperLinkCtrl(self, -1, _("Create new mask"))
        link_new_mask.SetUnderlines(False, False, False)
        link_new_mask.SetBold(True)
        link_new_mask.SetColours("BLACK", "BLACK", "BLACK")
        link_new_mask.SetBackgroundColour(self.GetBackgroundColour())
        link_new_mask.SetToolTip(tooltip)
        link_new_mask.AutoBrowse(False)
        link_new_mask.UpdateLink()
        link_new_mask.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkNewMask)

        Publisher.subscribe(self.OnLinkNewMask, 'New mask from shortcut')

        # Create horizontal sizers to represent lines in the panel
        line_new = wx.BoxSizer(wx.HORIZONTAL)
        line_new.Add(link_new_mask, 1, wx.EXPAND | wx.GROW | wx.TOP | wx.RIGHT,
                     4)
        line_new.Add(button_new_mask, 0, wx.ALL | wx.EXPAND | wx.GROW, 0)

        # Fold panel which contains mask properties and edition tools
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_DESKTOP)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_SCROLLBAR)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUHILIGHT)
        try:
            default_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUBAR)
        except AttributeError:
            default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        fold_panel = FoldPanel(self)
        fold_panel.SetBackgroundColour(default_colour)
        self.fold_panel = fold_panel

        # Button to fold to select region task
        button_next = wx.Button(self, -1, _("Create surface"))
        check_box = wx.CheckBox(self, -1, _("Overwrite last surface"))
        self.check_box = check_box
        if sys.platform != 'win32':
            button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            check_box.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
        button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask)

        next_btn_sizer = wx.BoxSizer(wx.VERTICAL)
        next_btn_sizer.Add(button_next, 1, wx.ALIGN_RIGHT)

        line_sizer = wx.BoxSizer(wx.HORIZONTAL)
        line_sizer.Add(check_box, 0, wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Add(next_btn_sizer, 1,
                       wx.EXPAND | wx.ALIGN_RIGHT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Fit(self)

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(line_new, 0,
                       wx.GROW | wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_sizer.Add(fold_panel, 1, wx.GROW | wx.EXPAND | wx.ALL, 5)
        main_sizer.Add(line_sizer, 0, wx.GROW | wx.EXPAND)
        main_sizer.AddSpacer(5)
        main_sizer.Fit(self)

        self.SetSizerAndFit(main_sizer)
        self.Update()
        self.SetAutoLayout(1)

        self.sizer = main_sizer
Exemple #44
0
                    error = wx.MessageDialog(self, tr("enter_valid_number"), tr("invalid_interval"), wx.OK | wx.ICON_EXCLAMATION)
                    error.ShowModal()

            dlg.Destroy()
        elif button.GetName() == 'btn_player_name':
            dlg = wx.TextEntryDialog(self, tr("new_name")+":", tr("player_name"), self.playerNameLabel.GetLabel())
            if dlg.ShowModal() == wx.ID_OK:
                newName = dlg.GetValue()
                self.playerNameLabel.SetLabel(newName)
                msgData = network.messages.getConfigUpdateMessage("player_name", str(newName))
                network.udpconnector.sendMessage(msgData, self.host)
                time.sleep(0.2)
                self.LoadConfig()
            dlg.Destroy()
        elif button.GetName() == 'btn_update':
            Publisher.subscribe(self.RebootComplete, 'boot_complete')

            self.prgDialog = wx.ProgressDialog("Updating...", wordwrap(tr("update_message"), 350, wx.ClientDC(self)))
            self.prgDialog.Pulse()

            msgData = network.messages.getMessage(PLAYER_UPDATE)
            network.udpconnector.sendMessage(msgData, self.host, UDP_UPDATE_TIMEOUT)
        elif button.GetName() == 'btn_setup_wifi':
            self.ShowWifiSettings()

    def ShowWifiSettings(self, event=None):
        wifiDlg = wifi.WifiDialog(self, -1, tr("wifi_settings"), self.host)
        wifiDlg.ShowModal()

    def RebootComplete(self):
        # print "SETTING FRAME - BOOT COMPLETE RECEIVED"
Exemple #45
0
 def __bind_events(self):
     Publisher.subscribe(self.AddMask, 'Add mask')
     # TODO: Uncomment
     Publisher.subscribe(self.SetThresholdBounds, 'Update threshold limits')
     Publisher.subscribe(self.SetThresholdModes, 'Set threshold modes')
     Publisher.subscribe(self.SetItemsColour, 'Set GUI items colour')
     Publisher.subscribe(self.SetThresholdValues,
                         'Set threshold values in gradient')
     Publisher.subscribe(self.SelectMaskName, 'Select mask name in combo')
     Publisher.subscribe(self.ChangeMaskName, 'Change mask name')
     Publisher.subscribe(self.OnRemoveMasks, 'Remove masks')
     Publisher.subscribe(self.OnCloseProject, 'Close project data')
     Publisher.subscribe(self.SetThresholdValues2, 'Set threshold values')
Exemple #46
0
 def initPubSub(self):
     Publisher.subscribe(self.toggleEditButtons, "EnableEditButtons")
     Publisher.subscribe(self.enableButtons, "EnablePlotButtons")
     Publisher.subscribe(self.resetDateRange, "resetdate")
     Publisher.subscribe(self.onToggleEdit, "toggleEdit")
     Publisher.subscribe(self.setEdit, "setEdit")
Exemple #47
0
 def __bind_events(self):
     Publisher.subscribe(self.ChangeButtonColour,
                              'Change volume viewer gui colour')
     Publisher.subscribe(self.DisablePreset, 'Close project data')
     Publisher.subscribe(self.Uncheck, 'Uncheck image plane menu')
     Publisher.subscribe(self.DisableVolumeCutMenu, 'Disable volume cut menu')
     Publisher.subscribe(self.StatusTargetSelect, 'Disable or enable coil tracker')
     Publisher.subscribe(self.StatusObjTracker, 'Status target button')
     Publisher.subscribe(self.ActiveTarget, 'Active target button')
     Publisher.subscribe(self.DeactiveTarget, 'Deactive target button')
Exemple #48
0
    def __init__(self, frame_title):
        wx.Frame.__init__(
            self,
            parent=None,
            id=wx.ID_ANY,
            title=frame_title,
            pos=wx.DefaultPosition,
            size=wx.DefaultSize,
        )

        self.serial_port = Serial()
        self.command = command()

        self.create_objects()
        self.connect_events()
        self.arrange_objects()

        pub.subscribe(self.on_recieve_area_update, "update")
        pub.subscribe(self.on_serial_read_error, "serial_read_error")
        pub.subscribe(self.on_run_write_error, "run_write_error")
        pub.subscribe(self.on_run_seq_started, "run_seq_started")
        pub.subscribe(self.on_run_seq_finished, "run_seq_finished")
        pub.subscribe(self.on_single_command_finished,
                      "single_command_finished")
Exemple #49
0
    def __init__(self, parent=None, title='my title', size=(800, 600)):
        """
        build wxpython frame, including it's layout,event,control
        :param parent: none
        :param title: software name
        :param size: softsware size
        """
        wx.Frame.__init__(self, parent=parent, title=title, size=size)
        self.Centre()
        self.panel = wx.Panel(self, -1)
        self.gauge_count = 0
        self.log_is_begin = True

        self.model_archi = ''
        self.model_weigh = ''
        self.input_files_path = ''
        self.output_path = ''
        '''text,button'''
        self.text_intro = wx.StaticText(self.panel,
                                        -1,
                                        'Clothes-classfier by deep learning',
                                        pos=(180, 0))
        # self.text_intro.SetBackgroundColour('green')
        self.text_intro.SetFont(wx.Font(26, wx.SWISS, wx.NORMAL, wx.BOLD))
        self.text_line = wx.StaticLine(self.panel)

        self.text_archi = wx.StaticText(self.panel, -1,
                                        'load model architecture:')
        self.text_archi.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        self.text_weigh = wx.StaticText(self.panel, -1, 'load model weights:')
        self.load_model_archi = wx.FilePickerCtrl(
            self.panel,
            2,
            wildcard='*.json',
            path='path_to_model_architecture(*.json)',
            size=(400, -1))
        self.load_model_weigh = wx.FilePickerCtrl(
            self.panel,
            3,
            wildcard='*.h5',
            path='path_to_model_weights(*.h5)',
            size=(400, -1))

        self.text_load_pic = wx.StaticText(
            self.panel, -1, 'pictures folder(must only contain pictures):')
        self.text_res_output = wx.StaticText(self.panel, -1,
                                             'result output folder:')
        self.load_pic = wx.DirPickerCtrl(
            self.panel,
            4,
            path='path_to_pic',
            size=(400, -1),
            message='input must be dir')  #message is tips when browse path
        self.output_res = wx.DirPickerCtrl(self.panel,
                                           4,
                                           path='output_result',
                                           size=(400, -1),
                                           message='output must be dir')

        self.text_output_name = wx.StaticText(
            self.panel, -1, 'save predict result name(*.csv):')
        self.ctrl_output_name = wx.TextCtrl(self.panel, -1)
        self.ctrl_output_name_button = wx.Button(self.panel, -1, 'save')

        self.gauge_training = wx.Gauge(self.panel, -1)
        self.text_logging = wx.StaticText(self.panel, -1, 'process log:')
        self.logging_output = wx.TextCtrl(self.panel,
                                          -1,
                                          style=wx.TE_MULTILINE | wx.TE_RICH,
                                          size=(400, 80))

        # self.button_clf = wx.Button(self.panel,-1,'Classify',size=(100,100),)
        self.button_clf = wx.ToggleButton(self.panel, -1, 'Classify')
        self.button_clf.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD))
        # self.button_clf.SetBackgroundColour('AQUAMARINE')
        '''event'''
        self.load_model_archi.Bind(wx.EVT_FILEPICKER_CHANGED,
                                   self.event_getpath, self.load_model_archi)
        self.load_model_weigh.Bind(wx.EVT_FILEPICKER_CHANGED,
                                   self.event_getpath, self.load_model_weigh)

        self.load_pic.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath,
                           self.load_pic)
        self.output_res.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath,
                             self.output_res)

        # self.ctrl_output_name.Bind(wx.EVT_TEXT,self.on_text_path)
        self.ctrl_output_name_button.Bind(wx.EVT_BUTTON,
                                          self.on_text_path_sure)

        self.gauge_training.Bind(wx.EVT_IDLE, self.do_gauge)

        self.button_clf.Bind(wx.EVT_TOGGLEBUTTON, self.begin_classify,
                             self.button_clf)

        # wx.CallAfter(self.dologging)
        '''get info for model'''
        self.model_archi = self.load_model_archi.GetPath()
        self.model_weigh = self.load_model_weigh.GetPath()
        self.input_files_path = self.load_pic.GetPath()
        self.output_path = self.output_res.GetPath()
        self.output_csv_name = ''
        """layout"""
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text_intro, 0, flag=wx.CENTER)
        main_sizer.Add(self.text_line, 0, flag=wx.EXPAND)
        main_sizer.Add((20, 20))

        left_sizer = wx.BoxSizer(wx.VERTICAL)
        left_sizer.Add(self.sizer_model_staticbox(
            'Load Model',
            text=[self.text_archi, self.text_weigh],
            item=[self.load_model_archi, self.load_model_weigh]),
                       1,
                       flag=wx.EXPAND)
        left_sizer.Add((10, 10))
        #ctrl_text and it's button
        left_down_sizer = wx.BoxSizer(wx.HORIZONTAL)
        left_down_sizer.Add(self.ctrl_output_name, 1, wx.EXPAND)

        left_down_sizer.Add(self.ctrl_output_name_button, 0)

        left_sizer.Add(self.sizer_model_staticbox(
            'Input-dir Output-file',
            text=[self.text_load_pic, self.text_res_output],
            item=[self.load_pic, self.output_res]),
                       1,
                       flag=wx.BOTTOM | wx.EXPAND | wx.ALL)

        left_sizer.Add((10, 10))
        left_sizer.Add(self.text_output_name, 0)
        left_sizer.Add(left_down_sizer, 0, wx.EXPAND)

        middle_sizer = wx.BoxSizer(wx.VERTICAL)
        middle_top_sizer = wx.BoxSizer(wx.VERTICAL)
        middle_top_sizer.Add(self.button_clf, 1, flag=wx.CENTER)
        middle_top_sizer.Add(self.gauge_training, 1, flag=wx.EXPAND)
        middle_sizer.Add(middle_top_sizer, 1, flag=wx.EXPAND)
        middle_sizer.Add((10, 10))
        log_box = wx.StaticBox(self.panel, -1, 'Result')
        logsizer = wx.StaticBoxSizer(log_box, wx.VERTICAL)
        logsizer.Add(self.sizer_load_model(self.text_logging,
                                           self.logging_output,
                                           flag=wx.EXPAND | wx.ALL),
                     1,
                     flag=wx.BOTTOM | wx.EXPAND | wx.ALL)
        middle_sizer.Add(logsizer, 1, flag=wx.BOTTOM | wx.EXPAND | wx.ALL)

        core_sizer = wx.BoxSizer(wx.HORIZONTAL)
        core_sizer.Add(left_sizer, 1, flag=wx.LEFT | wx.EXPAND | wx.ALL)
        core_sizer.Add(middle_sizer, 1, flag=wx.EXPAND | wx.ALL)

        main_sizer.Add(core_sizer, 1, wx.ALL, 5)
        self.panel.SetSizer(main_sizer)
        main_sizer.Fit(self)

        Publisher.subscribe(self.dologging, 'update')
        Publisher.subscribe(self.do_gauge, 'update_gauge')
Exemple #50
0
    def __init__(self):
        super(MainFrame, self).__init__(
            parent=None,
            id=-1,
            title=u'Huayra TDA',
        )

        self._pref= wx.GetApp().preferences
        self._guide = wx.GetApp().guide
        self._volume= wx.GetApp().volume
        self._scan_screen = None
        self._about_screen = None

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.HidePanel, self.timer)

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self.status_bar = self.CreateStatusBar()
        self.status_bar.SetFields((u'', u'Canal: ', u'SNR: '))

        # Menú archivo
        file_menu = wx.Menu()
        btn_scan = file_menu.Append(id=-1, text=u'Escanear canales')
        file_menu.AppendSeparator()
        file_menu.Append(wx.ID_EXIT, 'Salir', 'Salir de HuayraTDA')

            # Submenú desentrelazado
        opt_deinterlace_menu = wx.Menu()
        self.opt_deint_none = opt_deinterlace_menu.AppendRadioItem(id=-1, text=u'Ninguno')
        self.opt_deint_blend = opt_deinterlace_menu.AppendRadioItem(id=-1, text=u'Blend')
        self.opt_deint_linear = opt_deinterlace_menu.AppendRadioItem(id=-1, text=u'Linear')
        self.opt_deint_x = opt_deinterlace_menu.AppendRadioItem(id=-1, text=u'X')

        self.Bind(wx.EVT_MENU, self.OnDeinterlace, self.opt_deint_none)
        self.Bind(wx.EVT_MENU, self.OnDeinterlace, self.opt_deint_blend)
        self.Bind(wx.EVT_MENU, self.OnDeinterlace, self.opt_deint_linear)
        self.Bind(wx.EVT_MENU, self.OnDeinterlace, self.opt_deint_x)

        self.Bind(wx.EVT_MENU, self.OnScan, btn_scan)

            # Submenú aspecto
        opt_aspect_menu = wx.Menu()
        self.opt_asp_none = opt_aspect_menu.AppendRadioItem(id=-1, text=u'Ninguno')
        self.opt_asp_43 = opt_aspect_menu.AppendRadioItem(id=-1, text=u'4:3')
        self.opt_asp_169 = opt_aspect_menu.AppendRadioItem(id=-1, text=u'16:9')
        self.opt_asp_1610 = opt_aspect_menu.AppendRadioItem(id=-1, text=u'16:10')

        self.Bind(wx.EVT_MENU, self.OnAspect, self.opt_asp_none)
        self.Bind(wx.EVT_MENU, self.OnAspect, self.opt_asp_43)
        self.Bind(wx.EVT_MENU, self.OnAspect, self.opt_asp_169)
        self.Bind(wx.EVT_MENU, self.OnAspect, self.opt_asp_1610)

        # Menú opciones
        options_menu = wx.Menu()
        options_menu.AppendSubMenu(opt_deinterlace_menu, 'Desentrelazado')
        options_menu.AppendSubMenu(opt_aspect_menu, 'Aspecto')
        
        # Menú archivo
        help_menu = wx.Menu()
        btn_about = help_menu.Append(id=-1, text=u'Acerca de...')
        self.Bind(wx.EVT_MENU, self.OnAbout, btn_about)

        # Asignación de Menú
        menu_bar = wx.MenuBar()
        menu_bar.Append(file_menu, u'Archivo')
        menu_bar.Append(options_menu, u'Opciones')
        menu_bar.Append(help_menu, u'Ayuda')
        self.SetMenuBar(menu_bar)

        # Panel de video
        self.panel_video = wx.Panel(parent=self)
        self.panel_video.SetBackgroundColour(wx.BLACK)
        self.panel_video.Bind(wx.EVT_LEFT_DCLICK, self.OnToggleFullScreen)

        # Panel de control
        self.panel_control = wx.Panel(parent=self)
        #self.panel_control.SetBackgroundColour(wx.RED) # Para ver el panel

        # Botones de control
        channel_list = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap('gtk-justify-fill')
        )
        channel_up = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap(wx.ART_GO_UP),
        )

        channel_down = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN)
        )
        self.volume_mute = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap('stock_volume-med')
        )
        self.full_screen = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap('view-fullscreen')
        )
        take_picture = wx.BitmapButton(parent=self.panel_control,
            bitmap=wx.ArtProvider.GetBitmap('camera-photo')
        )
        self.volume_slider = wx.Slider(
            parent=self.panel_control,
            value=50,
            minValue=0,
            maxValue=100,
            size=(100, -1)
        )

        self.volume_slider.Bind(wx.EVT_SCROLL, self.OnVolumeChange)

        # Tooltips
        channel_list.SetToolTip(wx.ToolTip(u'Lista de canales'))
        channel_up.SetToolTip(wx.ToolTip(u'Subir canal'))
        channel_down.SetToolTip(wx.ToolTip(u'Bajar canal'))
        self.volume_mute.SetToolTip(wx.ToolTip(u'Silenciar'))
        self.full_screen.SetToolTip(wx.ToolTip(u'Pantalla completa'))
        take_picture.SetToolTip(wx.ToolTip(u'Sacar foto'))

        # Sizers
        szr_control = wx.BoxSizer(wx.HORIZONTAL)
        szr_control.Add(self.volume_mute, flag=wx.RIGHT, border=2)
        szr_control.Add(self.volume_slider, flag=wx.TOP, border=6)
        szr_control.Add(take_picture, flag=wx.LEFT|wx.RIGHT, border=2)
        szr_control.Add(self.full_screen, flag=wx.RIGHT, border=2)
        szr_control.Add(channel_list, flag=wx.RIGHT, border=2)
        szr_control.Add(channel_down, flag=wx.RIGHT, border=2)
        szr_control.Add(channel_up, flag=wx.RIGHT, border=2)
        self.panel_control.SetSizer(szr_control)
        
        self.channels_list_box = wx.ListBox(choices=[], name='channelsListBox', parent=self)
        self.Bind(wx.EVT_LISTBOX, self.OnChannelsListBox, self.channels_list_box)

        self.updateChannelsList()

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.panel_video, 4, flag=wx.EXPAND)
        self.sizer.Add(self.panel_control, flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=2)
        self.sizer.Add(self.channels_list_box, 1, flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=2)
        self.SetSizer(self.sizer)

        self.SetMinSize((450, 300))
        self.Center()

        # Bindeos
        #self.Bind(wx.EVT_MENU, self.OnTune, btn_scan)
        self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
        self.Bind(wx.EVT_BUTTON, self.OnChannelUp, channel_up)
        self.Bind(wx.EVT_BUTTON, self.OnChannelDown, channel_down)
        self.Bind(wx.EVT_BUTTON, self.OnToggleFullScreen, self.full_screen)
        self.Bind(wx.EVT_BUTTON, self.OnShowChannelsList, channel_list)
        
        take_picture.Bind(wx.EVT_BUTTON, self.OnSnapshot)
        self.volume_mute.Bind(wx.EVT_BUTTON, self.OnMute)

        # Bindeos de teclas
        self.id_ESC = wx.NewId()
        self.id_LEFT = wx.NewId()
        self.id_RIGHT = wx.NewId()
        self.id_UP = wx.NewId()
        self.id_DOWN = wx.NewId()
        self.id_M = wx.NewId()

        self.Bind(wx.EVT_MENU, self.OnChannelUp, id=self.id_UP)
        self.Bind(wx.EVT_MENU, self.OnChannelDown, id=self.id_DOWN)
        self.Bind(wx.EVT_MENU, self.OnVolumeUp, id=self.id_RIGHT)
        self.Bind(wx.EVT_MENU, self.OnVolumeDown, id=self.id_LEFT)
        self.Bind(wx.EVT_MENU, self.OnMute, id=self.id_M)

        self.SetAcceleratorTable(
            wx.AcceleratorTable(
                [
                    (wx.ACCEL_NORMAL,  wx.WXK_ESCAPE, self.id_ESC),
                    (wx.ACCEL_NORMAL,  wx.WXK_LEFT, self.id_LEFT),
                    (wx.ACCEL_NORMAL,  wx.WXK_RIGHT, self.id_RIGHT),
                    (wx.ACCEL_NORMAL,  wx.WXK_UP, self.id_UP),
                    (wx.ACCEL_NORMAL,  wx.WXK_DOWN, self.id_DOWN),
                    (wx.ACCEL_NORMAL,  ord('m'), self.id_M),
                ]
            )
        )

        self.vlc_instance = vlc.Instance(' '.join(VLC_SETTINGS))
        self.player = self.vlc_instance.media_player_new()
        self.panel_video.SetFocus()

        self.vlc_events = self.player.event_manager()
        self.vlc_events.event_attach(
            vlc.EventType.MediaPlayerOpening,
            self.test
        )

        self.vlc_events.event_attach(
            vlc.EventType.MediaPlayerPlaying,
            self.test1
        )
        self.delay_start_timer = wx.Timer()
        self.delay_start_timer.Bind(wx.EVT_TIMER, self.OnStartTimer)
        self.delay_start_timer.Start(1000, oneShot = wx.TIMER_ONE_SHOT)
        self.signal_level_thread = SignalLevelThread()
        atexit.register(self.signal_level_thread.terminate)
        pub.subscribe(self.signalLevelUpdate, 'signalLevelUpdate')
Exemple #51
0
 def _bind_events(self):
     Publisher.subscribe(self._add_point, "Add measurement point")
     Publisher.subscribe(self._change_name, "Change measurement name")
     Publisher.subscribe(self._remove_measurements, "Remove measurements")
     Publisher.subscribe(self._set_visibility, "Show measurement")
     Publisher.subscribe(self._load_measurements, "Load measurement dict")
     Publisher.subscribe(self._rm_incomplete_measurements,
                         "Remove incomplete measurements")
     Publisher.subscribe(self._change_measure_point_pos,
                         'Change measurement point position')
Exemple #52
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        self.wholeBox = wx.BoxSizer(wx.VERTICAL)
        srcPicBox = wx.BoxSizer(wx.HORIZONTAL)
        srcFileBox = wx.BoxSizer(wx.HORIZONTAL)
        dstBox = wx.BoxSizer(wx.HORIZONTAL)
        btnBox = wx.BoxSizer(wx.HORIZONTAL)
        """
        添加一行标题内容,用来显示这部分使用的算法
        """
        staticTitle = wx.StaticText(self,
                                    id=wx.ID_ANY,
                                    label=u"使用LSB水印的方法隐藏高位图像信息")
        font = wx.Font(20, wx.ROMAN, wx.SLANT, wx.BOLD)
        staticTitle.SetFont(font)
        staticTitle.SetForegroundColour(wx.RED)
        """
        设置源图片路径,,水平box
        """
        staticPicPath = wx.StaticText(self, id=wx.ID_ANY, label=u"源图片路径:   ")
        self.txtPicPath = wx.TextCtrl(self,
                                      id=wx.ID_ANY,
                                      value=u"这里记录源图片路径",
                                      size=(0, -1))
        btnPicPath = wx.Button(self, id=wx.ID_ANY, label=u"...", size=(40, 25))

        srcPicBox.Add(staticPicPath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        srcPicBox.Add(self.txtPicPath, 1, wx.ALL | wx.ALIGN_CENTER, 5)
        srcPicBox.Add(btnPicPath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        """
        设置隐写文件路径,,水平box
        """
        staticFilePath = wx.StaticText(self, id=wx.ID_ANY, label=u"隐写文件路径:")
        self.txtFilePath = wx.TextCtrl(self,
                                       id=wx.ID_ANY,
                                       value=u"这里记录隐写文件路径",
                                       size=(0, -1))
        btnFilePath = wx.Button(self,
                                id=wx.ID_ANY,
                                label=u"...",
                                size=(40, 25))

        srcFileBox.Add(staticFilePath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        srcFileBox.Add(self.txtFilePath, 1, wx.ALL | wx.ALIGN_CENTER, 5)
        srcFileBox.Add(btnFilePath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        """
        设置目标文件路径,,水平box
        """
        staticDstPath = wx.StaticText(self, id=wx.ID_ANY, label=u"目的文件路径:")
        self.txtDstPath = wx.TextCtrl(self,
                                      id=wx.ID_ANY,
                                      value=u"这里记录目标文件路径",
                                      size=(0, -1))
        btnDstPath = wx.Button(self, id=wx.ID_ANY, label=u"...", size=(40, 25))

        dstBox.Add(staticDstPath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        dstBox.Add(self.txtDstPath, 1, wx.ALL | wx.ALIGN_CENTER, 5)
        dstBox.Add(btnDstPath, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        """
        创建 进度条 | 滑块 | 开始 清除  解密 按钮
        """
        self.gauge = wx.Gauge(self, id=wx.ID_ANY, range=100, size=(250, 30))
        self.slider = wx.Slider(self,
                                wx.ID_ANY,
                                4,
                                1,
                                7,
                                pos=(10, 10),
                                size=(250, -1),
                                style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS
                                | wx.SL_LABELS)
        self.slider.SetTickFreq(1)
        btnStart = wx.Button(self, id=wx.ID_ANY, label=u"开始")
        btnClear = wx.Button(self, id=wx.ID_ANY, label=u"清除")
        btnDecry = wx.Button(self, id=wx.ID_ANY, label=u"解密")
        btnBox.Add(self.gauge, 1, wx.ALL | wx.ALIGN_LEFT | wx.LEFT, 5)
        btnBox.Add(self.slider, 1,
                   wx.ALL | wx.ALIGN_LEFT | wx.LEFT | wx.EXPAND, 5)
        btnBox.Add(btnStart, 0, wx.ALL, 5)
        btnBox.Add(btnClear, 0, wx.ALL, 5)
        btnBox.Add(btnDecry, 0, wx.ALL, 5)

        Publisher.subscribe(self.updateGauge, "updateGauge_pix")
        """
        将各个boxsizer分别放入 wholeBox,
        顺序是: 标题
                ------------------------------
                源图片路径设置box
                ------------------------------
                隐写文件路径设置box
                ------------------------------
                目标文件路径设置box
                ------------------------------
                                  开始    清除
                ------------------------------
        """
        self.wholeBox.Add(staticTitle, 0, wx.ALL | wx.EXPAND)
        self.wholeBox.Add(wx.StaticLine(self, ), 0, wx.ALL | wx.EXPAND, 5)

        self.wholeBox.Add(srcPicBox, 0, wx.ALL | wx.EXPAND, 5)
        self.wholeBox.Add(wx.StaticLine(self, ), 0, wx.ALL | wx.EXPAND, 5)

        self.wholeBox.Add(srcFileBox, 0, wx.ALL | wx.EXPAND, 5)
        self.wholeBox.Add(wx.StaticLine(self, ), 0, wx.ALL | wx.EXPAND, 5)

        self.wholeBox.Add(dstBox, 0, wx.ALL | wx.EXPAND, 5)
        self.wholeBox.Add(wx.StaticLine(self, ), 0, wx.ALL | wx.EXPAND, 5)

        #self.wholeBox.Add(btnBox,0,wx.ALIGN_RIGHT|wx.RIGHT,5)
        self.wholeBox.Add(btnBox, 0, wx.ALL | wx.EXPAND, 5)
        """
        绑定按钮事件
        """
        btnPicPath.Bind(wx.EVT_BUTTON, self.ChooseSrcPic)
        btnFilePath.Bind(wx.EVT_BUTTON, self.ChooseSrcFile)
        btnDstPath.Bind(wx.EVT_BUTTON, self.ChooseDstFile)
        btnStart.Bind(wx.EVT_BUTTON, self.OnStart)
        btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        btnDecry.Bind(wx.EVT_BUTTON, self.OnDecry)
        self.SetSizer(self.wholeBox)
        """
        创建一个图片预览框
        """
        self.Image = wx.StaticBitmap(self, bitmap=wx.EmptyBitmap(400, 300))
        self.wholeBox.Add(self.Image, 0, wx.ALIGN_CENTER, 5)
        """
        使用与背景色颜色相同的图片填充图片预览框
        """
        img = wx.Image(u"./example/background.jpg", wx.BITMAP_TYPE_ANY)
        img = img.Scale(400, 300)

        self.Image.SetBitmap(wx.BitmapFromImage(img))
        self.Fit()
        pass
Exemple #53
0
 def __bind_events(self):
     Publisher.subscribe(self._Exit, 'Exit')
Exemple #54
0
 def __bind_pubsub_evt(self):
     Publisher.subscribe(self._set_brush_size, 'Set watershed brush size')
Exemple #55
0
 def __bind_events(self):
     Publisher.subscribe(self.ShowRaycastingWidget,
                             'Show raycasting widget')
     Publisher.subscribe(self.HideRaycastingWidget,
                             'Hide raycasting widget')
     Publisher.subscribe(self.OnSetRaycastPreset,
                             'Update raycasting preset')
     Publisher.subscribe(self.RefreshPoints,
                             'Refresh raycasting widget points')
     Publisher.subscribe(self.LoadHistogram,
                             'Load histogram')
     Publisher.subscribe(self._Exit, 'Exit')
Exemple #56
0
 def __bind_pubsub_evt(self):
     Publisher.subscribe(self.OnRetrieveStyle, 'Retrieve task slice style')
     Publisher.subscribe(self.OnDisableStyle, 'Disable task slice style')
     Publisher.subscribe(self.OnCloseProject, 'Close project data')
     Publisher.subscribe(self.OnColapsePanel, 'Show panel')
Exemple #57
0
    def __init__( self, parent, manager=None):
        wx.Panel.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
        #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        sizer = wx.BoxSizer( wx.VERTICAL )
        self.canvas = Canvas3D(self, manager)
        self.toolbar = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize)
        tsizer = wx.BoxSizer( wx.HORIZONTAL )

        root = osp.abspath(osp.dirname(__file__))

        #self.SetIcon(wx.Icon('data/logo.ico', wx.BITMAP_TYPE_ICO))

        self.btn_x = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap( osp.join(root, 'imgs/x-axis.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_x, 0, wx.ALL, 1 )
        self.btn_y = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap( osp.join(root, 'imgs/y-axis.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_y, 0, wx.ALL, 1 )
        self.btn_z = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap( osp.join(root, 'imgs/z-axis.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_z, 0, wx.ALL, 1 )
        tsizer.Add(wx.StaticLine( self.toolbar, wx.ID_ANY,  wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL), 0, wx.ALL|wx.EXPAND, 2 )
        self.btn_pers = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap( osp.join(root, 'imgs/isometric.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_pers, 0, wx.ALL, 1 )
        self.btn_orth = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap( osp.join(root, 'imgs/parallel.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_orth, 0, wx.ALL, 1 )
        tsizer.Add(wx.StaticLine( self.toolbar, wx.ID_ANY,  wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL), 0, wx.ALL|wx.EXPAND, 2 )
        self.btn_save = wx.BitmapButton( self.toolbar, wx.ID_ANY, wx.Bitmap(osp.join(root, 'imgs/save.png'), wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW )
        tsizer.Add( self.btn_save, 0, wx.ALL, 1 )
        
        self.btn_color = wx.ColourPickerCtrl( self.toolbar, wx.ID_ANY, wx.Colour( 128, 128, 128 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
        tsizer.Add( self.btn_color, 0, wx.ALIGN_CENTER|wx.ALL, 1 )
        self.toolbar.SetSizer( tsizer )

        self.settingbar = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        ssizer = wx.BoxSizer( wx.HORIZONTAL )
        
        self.m_staticText1 = wx.StaticText( self.settingbar, wx.ID_ANY, u"Object:", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText1.Wrap( -1 )
        ssizer.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.LEFT, 10 )
        
        cho_objChoices = ['None']
        self.cho_obj = wx.Choice( self.settingbar, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cho_objChoices, 0 )
        self.cho_obj.SetSelection( 0 )
        ssizer.Add( self.cho_obj, 0, wx.ALL, 1 )
        
        self.chk_visible = wx.CheckBox( self.settingbar, wx.ID_ANY, u"visible", wx.DefaultPosition, wx.DefaultSize, 0 )
        ssizer.Add( self.chk_visible, 0, wx.ALIGN_CENTER|wx.LEFT, 10 )
        
        self.col_color = wx.ColourPickerCtrl( self.settingbar, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
        ssizer.Add( self.col_color, 0, wx.ALIGN_CENTER|wx.ALL, 1 )
        
        self.m_staticText2 = wx.StaticText( self.settingbar, wx.ID_ANY, u"Blend:", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText2.Wrap( -1 )
        ssizer.Add( self.m_staticText2, 0, wx.ALIGN_CENTER|wx.LEFT, 10 )
        
        self.sli_blend = wx.Slider( self.settingbar, wx.ID_ANY, 10, 0, 10, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL )
        ssizer.Add( self.sli_blend, 0, wx.ALIGN_CENTER|wx.ALL, 1 )
        self.settingbar.SetSizer(ssizer)

        self.m_staticText2 = wx.StaticText( self.settingbar, wx.ID_ANY, u"Mode:", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText2.Wrap( -1 )
        ssizer.Add( self.m_staticText2, 0, wx.ALIGN_CENTER|wx.LEFT, 10 )

        cho_objChoices = ['mesh', 'grid']
        self.cho_mode = wx.Choice( self.settingbar, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cho_objChoices, 0 )
        self.cho_mode.SetSelection( 0 )
        ssizer.Add( self.cho_mode, 0, wx.ALL, 1 )

        sizer.Add( self.toolbar, 0, wx.EXPAND |wx.ALL, 0 )
        sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 0)
        sizer.Add( self.settingbar, 0, wx.EXPAND |wx.ALL, 0 )
        
        self.SetSizer( sizer )
        self.Layout()
        self.Centre( wx.BOTH )
        
        self.btn_x.Bind( wx.EVT_BUTTON, self.view_x)
        self.btn_y.Bind( wx.EVT_BUTTON, self.view_y)
        self.btn_z.Bind( wx.EVT_BUTTON, self.view_z)
        self.btn_save.Bind( wx.EVT_BUTTON, self.on_save)
        self.btn_pers.Bind( wx.EVT_BUTTON, lambda evt, f=self.on_pers:f(True))
        self.btn_orth.Bind( wx.EVT_BUTTON, lambda evt, f=self.on_pers:f(False))
        self.btn_color.Bind( wx.EVT_COLOURPICKER_CHANGED, self.on_bgcolor )

        self.cho_obj.Bind( wx.EVT_CHOICE, self.on_select )
        self.cho_mode.Bind( wx.EVT_CHOICE, self.on_mode )
        self.chk_visible.Bind( wx.EVT_CHECKBOX, self.on_visible)
        self.sli_blend.Bind( wx.EVT_SCROLL, self.on_blend )
        self.col_color.Bind( wx.EVT_COLOURPICKER_CHANGED, self.on_color )

        if manager!=None: self.cho_obj.Set(list(manager.objs.keys()))
        pub.subscribe(self.add_obj, 'add_obj')
 def __init__(self):
     self.running = True
     Publisher.subscribe(self.CancelImageDataLoad, "Cancel DICOM load")
Exemple #59
0
 def initPubSub(self):
     Publisher.subscribe(self.onDateChanged, "onDateChanged")
     Publisher.subscribe(self.onDateFull, "onDateFull")
     Publisher.subscribe(self.onPlotType, "onPlotType")
     Publisher.subscribe(self.onShowLegend, "onShowLegend")
     Publisher.subscribe(self.onNumBins, "onNumBins")
     Publisher.subscribe(self.onRemovePlot, "removePlot")
     Publisher.subscribe(self.onChangeSelection, "changePlotSelection")
     Publisher.subscribe(self.onUpdateValues, "updateValues")
     Publisher.subscribe(self.clear, "clearPlot")
Exemple #60
0
    def __init__(self):
        #Setup the logger
        self.log = logging.getLogger('.'.join(
            (config.GUI_LOG_NAME, 'controller')))

        #Setup the view
        self.app = wx.App(False)

        # SecionName name description type_RADIO function
        self.mainView = mainView.MainWindow(
            None, "Uniquity -- The Unique File Analyzer")

        #Setup the model. Setting it up after the view is convienient, as no model code
        #will run if the view has a sudden crash (happens when testing new views)
        self.uniquity = None
        try:
            self.uniquity = uniquity.Uniquity()
        except Exception as e:
            message = "Please install Uniquity before using it."
            diag = wx.MessageBox(message, style=wx.OK | wx.ICON_EXCLAMATION)
            self.mainView.Destroy()
            return

        #Setup DupVC (for showing duplicate files)
        self.dupVC = dupViewController.DupViewController(
            self.uniquity, self.mainView.mainSplitter)
        self.mainView.setDupView(self.dupVC.view)

        #Setup various events we will respond to
        pub.subscribe(self.addFiles, "main.addfiles")
        pub.subscribe(self.removeFiles, "main.removefiles")
        pub.subscribe(self.updateViewProgress, "main.updaterequest")
        pub.subscribe(self.mainView.enableDupFileTools, "dupview.itemselected")
        pub.subscribe(self.mainView.disableDupFileTools,
                      "dupview.allitemsdeselected")
        pub.subscribe(self.mainView.status, "dupview.status")
        pub.subscribe(self.mainView.statusError, "dupview.statuserror")
        pub.subscribe(self.dupVC.viewSelected, "main.viewdupfiles")
        pub.subscribe(self.dupVC.deleteSelected, "main.deletedupfiles")
        pub.subscribe(self.dupVC.setFileFormat, "main.fileformat")