def __init__(self): Gtk.Window.__init__(self, title="Hello PyObject") self.imgH, self.imgW = [800, 600] self.set_default_size(self.imgH, self.imgW) # self.set_size_request(self.imgH, self.imgW) self.GtkWindowType = Gtk.WindowType.TOPLEVEL self.connect("key-press-event", self.on_key_press_event) self.data_path = path.join(path.abspath(path.dirname(__file__)), "data") self.media_path = path.join(path.abspath(path.dirname(__file__)), "media") self.mainBox = Gtk.Fixed() self.revealer1 = Gtk.Revealer() self.revealer1.set_reveal_child(True) self.revealer1.set_transition_type(Gtk.RevealerTransitionType.CROSSFADE) self.revealer1.set_transition_duration(1000) self.fixWin = Gtk.Fixed() filePath = path.join(self.media_path, "img1.jpg") self.newImage = ipImage("demoImage", filePath, 800, 600) self.fixWin.put(self.newImage, 0, 0) self.revealer1.add(self.fixWin) self.mainBox.put(self.revealer1, 0, 0) self.revealer2 = Gtk.Revealer() self.revealer2.set_reveal_child(False) self.revealer2.set_transition_type(Gtk.RevealerTransitionType.CROSSFADE) self.revealer2.set_transition_duration(1000) self.fixWin2 = Gtk.Fixed() filePath = path.join(self.media_path, "img2.jpg") self.newImage2 = ipImage("demoImage3", filePath, 800, 600) self.fixWin2.put(self.newImage2, 0, 0) self.newVideo = ipVideo( "tempVideo", path.join(self.media_path, "Video1280x720b.mp4"), 640, 480 ) self.fixWin.put(self.newVideo, 0, 0) self.revealer2.add(self.fixWin2) self.mainBox.put(self.revealer2, 0, 0) self.revealer3 = Gtk.Revealer() self.revealer3.set_reveal_child(False) self.revealer3.set_transition_type(Gtk.RevealerTransitionType.CROSSFADE) self.revealer3.set_transition_duration(1000) self.fixWin3 = Gtk.Fixed() filePath = path.join(self.media_path, "img5.jpg") self.newImage3 = ipImage("demoImage5", filePath, 800, 600) self.fixWin3.put(self.newImage3, 0, 0) self.revealer3.add(self.fixWin3) self.mainBox.put(self.revealer3, 0, 0) self.add(self.mainBox) self.show_all() self.iScheduler = BackgroundScheduler() exec_date = datetime.now() + timedelta(seconds=5) print(exec_date) self.iScheduler.add_job(self.switchClipWin, "date", run_date=exec_date) self.iScheduler.start()
def __init__(self): Gtk.Window.__init__(self, title="Revealer Example") self.data_path = path.join(path.abspath(path.dirname(__file__)), "data") self.media_path = path.join(path.abspath(path.dirname(__file__)), "media") fixed = Gtk.Fixed() fixed.set_size_request(800, 600) revealer = Gtk.Revealer() filePath = path.join(self.media_path, "img1.jpg") self.image = ipImage("demoImage", filePath, 800, 600) # Gtk.Image.new_from_icon_name("help-about", Gtk.IconSize.MENU) revealer.add(self.image) revealer.set_reveal_child(True) revealer.set_transition_duration(1000) revealer.set_transition_type(Gtk.RevealerTransitionType.CROSSFADE) fixed.add(revealer) _, w, h = Gtk.IconSize.lookup(Gtk.IconSize.MENU) self.width = fixed.get_size_request()[0] - w self.height = fixed.get_size_request()[1] - h self.add(fixed) GLib.timeout_add(1000, self.timeout, fixed, revealer)
def __init__(self, elementList): Gtk.Box.__init__(self) self.video = None # self.connect("realize", self.on_realize) self.fixCon = Gtk.Fixed() self.add(self.fixCon) for elem in elementList: addElem = None if elem.elementType == "image": addElem = ipImage( elem.name, path.join(media_path, elem.info), elem.width, elem.height ) if elem.elementType == "ticker": addElem = ipTicker(elem.name, elem.info, elem.width, elem.height) if elem.elementType == "video": self.video = elem if addElem is not None: self.fixCon.put(addElem, elem.dx, elem.dy)
def __init__(self): Gtk.Window.__init__(self, title="Hello PyObject") imgH, imgW = [800, 600] self.set_default_size(imgH, imgW) # set_size_request(imgH, imgW) self.GtkWindowType = Gtk.WindowType.TOPLEVEL # set hiden window bar # self.set_decorated(False) # keyname = Gdk.keyval_name(self.key) self.connect("key-press-event", self.on_key_press_event) self.data_path = path.join(path.abspath(path.dirname(__file__)), "data") self.media_path = path.join(path.abspath(path.dirname(__file__)), "media") # box = Gtk.VBox() # label = Gtk.Label("Insert text you want to search for:") # box.add(label) # self.entry = Gtk.Entry() # box.add(self.entry) self.main_area = Gtk.Stack() self.main_area.set_transition_type( Gtk.StackTransitionType.SLIDE_LEFT_RIGHT) self.main_area.set_transition_duration(1000) self.conWin1 = Gtk.Box() self.main_area.add_titled(self.conWin1, "window1", "window1") fixCon = Gtk.Fixed() self.conWin1.add(fixCon) filePath = path.join(self.media_path, "img1.jpg") newImage = ipImage("demoImage", filePath, 800, 600) fixCon.put(newImage, 0, 0) # self.labelS = Gtk.Label() # self.label_txt = """<big><i>you have choice to runn the scan directly or after setup the scanning process you want to follow on your target</i></big>""" # self.labelS.set_markup(self.label_txt) # self.labelS.set_line_wrap(True) self.conWin2 = Gtk.Box() self.main_area.add_titled(self.conWin2, "window2", "window2") fixCon2 = Gtk.Fixed() self.conWin2.add(fixCon2) filePath2 = path.join(self.media_path, "img5.jpg") newImage2 = ipImage("demoImage2", filePath2, 800, 600) fixCon2.put(newImage2, 0, 0) # self.our_stackSwitcher = Gtk.StackSwitcher() # self.our_stackSwitcher.set_stack(self.main_area) # box.add(self.our_stackSwitcher) # box.add(self.main_area) self.add(self.main_area) self.show_all() self.iScheduler = BackgroundScheduler() exec_date = datetime.now() + timedelta(seconds=5) print(exec_date) self.iScheduler.add_job(self.switchClipWin, "date", run_date=exec_date) self.iScheduler.start()