def open_popup_new_dir(self,path): poupup = Popup(content=PopupNewDir(make_new_dir=self.make_new_dir)) poupup.title = lang['New_Folder'] poupup.title_size = 16 poupup.size_hint = None, None poupup.height = 120 poupup.width = 250 poupup.id = 'pop_new_dir' self.ids['pop_new_dir'] = poupup global path_new_dir self.path_new_dir = path poupup.open()
def open_popup_new_dir(self, path): poupup = Popup(content=PopupNewDir(make_new_dir=self.make_new_dir)) poupup.title = lang['New_Folder'] poupup.title_size = 16 poupup.size_hint = None, None poupup.height = 120 poupup.width = 250 poupup.id = 'pop_new_dir' self.ids['pop_new_dir'] = poupup global path_new_dir self.path_new_dir = path poupup.open()
def phone(self): button = Button(text='挂断', size_hint=(0.3, 0.15), pos_hint={ 'x': .35, 'y': .05 }) #button.pos_x = 370 #label = Label(text='内容',size_hint=(None, None),size=(300,500)) #初始化摄像头,此时Play=False camera = Camera(id='camera', resolution=(480, 640), play=False, pos=(0, -80)) phoneTime = Label(text="00:00", pos_hint={'x': .15, 'y': .55}) #filename = 'E:\\PythonProjects\\project_kivy\\venv\\share\\kivy-examples\\widgets\\cityCC0.mpg' #filename = 'http://192.168.0.100:8080/' #filename = 'udp://@:192.168.0.100:1234' #filename = 'rtsp://192.168.0.100:8554/play' filename = 'rtsp://192.168.0.100:8554/play' #filename = 'http://192.168.0.100:6060' ''' 当两次连接时,可以正常看视频,当有视频出现,显示视频纹理 size默认值为(100,100) ?添加部件通话时长 连接成功后,得到视频数据时,显示(如何判断) VLC RTSP通过UDP实现,Gstream通过什么? ''' video = Video(source=filename, play='True', pos=(0, 120), volume=0.8) #通话时间 count = 0 relaytiveLayout = RelativeLayout(id='phone') relaytiveLayout.add_widget(camera) relaytiveLayout.add_widget(phoneTime) relaytiveLayout.add_widget(video) relaytiveLayout.add_widget(button) # label = Label(text='内容',size_hint=(None, None)) # floatLayout = FloatLayout(size_hint=(None, None),size=(400, 600)) # floatLayout.add_widget(label) # floatLayout.add_widget(relaytiveLayout) #覆盖整个窗口 popup = Popup(title='正在与谁通话', content=relaytiveLayout, size_hint=(None, None), size=(300, 500), auto_dismiss=False) #self.proxy_ref.add_widget(popup) #print(popup.parent) popup.id = 'popup' #button.pos_x = popup.center_x + (popup.size[0] - button.size[0])/2 #print(camera.size) #print(self.children[0].children) #print(self.ids.popup) #print(camera.properties()) #print(self.id['camera']) #print(type(self.id['popup'])) #print(popup.proxy_ref) ''' 摄像头没有释放,因为属性play值为True ''' button.bind(on_press=popup.dismiss) #button.bind(on_touch_down=cv2.) #button.bind(on_press=) #popup.bind(on_dismiss=self.play) popup.open() for widget in self.walk(): print('{} -> {}'.format(widget, widget.id)) # if isinstance(widget,RelativeLayout): # #print('{} -> {}'.format(widget,widget.id)) # for child in widget.walk(): # print('{} -> {}'.format(child, child.id)) #为什么需要obj,其他值也可以,或许需要它来绑定事件的对象 def closeCamera(obj): print(camera.play) #print(str(obj)) camera.play = False print(camera.play) def closeVideo(obj): video.play = False video.unload() Clock.unschedule(phone_time_callback) def displayPhoneTime(*largs): # obj is float # print('obj is',type(largs)) # print(largs) nonlocal count count = count + 1 #print(count) #true #print(str(video.duration)) phoneTime.text = str(s2t(count)) phone_time_callback = Clock.schedule_interval(displayPhoneTime, 1.) video.bind(on_play=phone_time_callback) #video.bind(play=phone_time_callback) button.bind(on_press=closeCamera) button.bind(on_press=closeVideo) # 稍后启动摄像头 camera.play = True