def __init__(self): super(WinMain,self).__init__() self.source_list = imageproviders.load_sources() c = VisionManager() if not c.is_connected(): print("Vision server is not accessible.") return #create and start server self.server = Server() self.server.start("127.0.0.1", 5030) #create dockWidgets self.winFilterChain = WinFilterChain(c) self.winFilter = WinFilter() self.winFilterSel = WinFilterSel() self.setCentralWidget(self.winFilterChain.ui) #connect action between dock widgets self.winFilterSel.onAddFilter.connect(self.winFilterChain.add_filter) self.winFilterChain.selectedFilterChanged.connect(self.winFilter.setFilter) self._addToolBar() self._addDockWidget() self._connectMainButtonsToWinFilterChain()
def init_window(self, controller): self.lastSecondFps = 0 self.fpsCount = 0 self.image_size = None self.controler = controller self.controler.get_thread().add_observer(self.chain_observer) #self.controler.add_image_observer(self.chain_observer) self.controler.add_filter_observer(self.filters_changed_observer) self.controler.add_thread_observer(self.thread_observer) self.source_list = imageproviders.load_sources() self.source_window = None self.thread_running = self.controler.is_thread_running() self.recorder = None ui = get_ui(self, 'filterChainListStore', 'sourcesListStore', 'imgOpen', 'imgNew', 'imgUp', 'imgDown') self.window = ui.get_object(win_name(self)) self.lstFilters = ui.get_object('lstFilters') self.btnView = ui.get_object('btnView') self.btnAdd = ui.get_object('btnAdd') self.btnRemove = ui.get_object('btnRemove') self.btnConfig = ui.get_object('btnConfig') self.btnUp = ui.get_object('btnUp') self.btnDown = ui.get_object('btnDown') self.btnRecord = ui.get_object('btnRecord') self.chkLoop = ui.get_object('chkLoop') self.lblLoopState = ui.get_object('lblLoopState') self.lblRealFPS = ui.get_object('lblRealFPS') self.txtFilterChain = ui.get_object('txtFilterChain') self.cboSource = ui.get_object('cboSource') self.spnFPS = ui.get_object('spnFPS') self.spnFPS.set_adjustment(self.create_adj()) self.spnFPS.set_value(20) self.win_list = [] self.sourcesListStore = ui.get_object('sourcesListStore') self.filterChainListStore = ui.get_object('filterChainListStore') self.set_state_empty() self.change_state() self.sourcesListStore.append(['None']) for name in self.source_list.keys(): self.sourcesListStore.append([name]) self.cboSource.set_active(0)
def __init__(self, controller): self.controler = controller self.controler.add_filter_observer(self.filters_changed_observer) self.controler.add_thread_observer(self.thread_observer) self.source_list = imageproviders.load_sources() self.source_window = None self.thread_running = self.controler.is_thread_running() ui = get_ui(self, 'filterChainListStore', 'sourcesListStore', 'imgOpen', 'imgNew', 'imgUp', 'imgDown') self.window = ui.get_object(win_name(self)) self.lstFilters = ui.get_object('lstFilters') self.btnView = ui.get_object('btnView') self.btnAdd = ui.get_object('btnAdd') self.btnRemove = ui.get_object('btnRemove') self.btnConfig = ui.get_object('btnConfig') self.btnUp = ui.get_object('btnUp') self.btnDown = ui.get_object('btnDown') self.chkLoop = ui.get_object('chkLoop') self.lblLoopState = ui.get_object('lblLoopState') self.txtFilterChain = ui.get_object('txtFilterChain') self.cboSource = ui.get_object('cboSource') self.spnFPS = ui.get_object('spnFPS') self.spnFPS.set_adjustment(self.create_adj()) self.spnFPS.set_value(30) self.win_list = [] self.sourcesListStore = ui.get_object('sourcesListStore') self.filterChainListStore = ui.get_object('filterChainListStore') self.set_state_empty() self.change_state() self.sourcesListStore.append(['None']) for name in self.source_list.keys(): self.sourcesListStore.append([name]) self.cboSource.set_active(1)
def loadSources(self): self.ui.sourcesComboBox.clear() self.sources = imageproviders.load_sources() self.ui.sourcesComboBox.addItem('None') for source in self.sources.keys(): self.ui.sourcesComboBox.addItem(source)