def initLoginUI(self): # Load UI file. main_ui_file = ui.get_ui_file("login.ui", ui_utils.get_folder()) self.ui = ui.loadUiWidget(main_ui_file, parent=self) # Layout. self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(2, 2, 2, 2) # Store ui elements for use later in signals or functions. self.lb_image_logo = ui.get_child(self.ui, "lb_image_logo") self.lb_image_wave = ui.get_child(self.ui, "lb_image_wave") self.le_user = ui.get_child(self.ui, "le_user") self.le_pass = ui.get_child(self.ui, "le_pass") self.lb_info = ui.get_child(self.ui, "lb_info") self.pb_login = ui.get_child(self.ui, "pb_login") # Set the ui images. image_logo_file = image.get_image_file("login_logo_full.png", ui_utils.get_folder()) image_wave_file = image.get_image_file("login_logo_wave.png", ui_utils.get_folder()) self.lb_image_logo.setPixmap(image.create_pixmap(image_logo_file)) self.lb_image_wave.setPixmap(image.create_pixmap(image_wave_file)) # Connect signals self.pb_login.clicked.connect(self.check_login)
def initUI(self): # Title self.setWindowTitle("Summus Render Monitor") # Applies the theme for the widget # theme.apply_style(self, "summus_dark.qss") # Icon for the window image_app_icon = image.get_image_file("summus_logo_icon.png", self.get_current_folder()) self.setWindowIcon(image.create_pixmap(image_app_icon)) # Allows maximize and minimize self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinMaxButtonsHint) # layout self.setLayout(QtGui.QVBoxLayout()) # add main widget self.mainWiget = SummusMonitorMainWidget() self.layout().addWidget(self.mainWiget) self.layout().setSpacing(0) # resizesthe interface to get the initial default. self.resize(1024, 768) self.show()
def get_file_image_dependencies(source_file): """Gets the lines that contain a call to a image file from a given file. Skips the commented lines. Args: source_file (string): Path of the file where search the image dependencies in. Returns: List of strings: List of paths pointing to the image files found. """ image_dependencies = [] with open(source_file, "r") as f: data = f.read() f.close() folder = os.path.dirname(source_file) regx = re.compile('.*"(.*\.png|.*\.jpg|.*\.gif|.*\.bmp)".*', re.MULTILINE) matches = regx.findall(data) if len(matches) > 0: for match in matches: match = match.lstrip() if not match.startswith("#") and match != "": image_dependency = image.get_image_file(str(match), folder, recursive=True) if image_dependency: image_dependencies.append(image_dependency) return image_dependencies
def initUI(self): # Title self.setWindowTitle("Inside Animation Campus") # Applies the theme for the widget # theme.apply_style(self, "inside_anim_dark.qss") # Icon for the window image_app_icon = image.get_image_file("app_icon.png", ui_utils.get_folder()) self.setWindowIcon(image.create_pixmap(image_app_icon)) # Allows maximize and minimize self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinMaxButtonsHint) # layout self.setLayout(QtGui.QVBoxLayout()) # add main widget self.mainWiget = InsideAnimCampusMainWidget() self.layout().addWidget(self.mainWiget) self.layout().setSpacing(0) # resizesthe interface to get the initial default. self.resize(1024, 768) self.show()
def initUI(self): # Load UI file current_file = self.get_current_file() current_folder = os.path.dirname(current_file) main_ui_file = ui.get_ui_file("esa_player.ui", current_folder) self.ui = ui.loadUiWidget(main_ui_file, parent=self) # Layout self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(2, 2, 2, 2) # Store ui elements for use later in signals or functions. self.le_folder = ui.get_child(self.ui, "le_folder") self.pb_folder = ui.get_child(self.ui, "pb_folder") self.cbx_categories = ui.get_child(self.ui, "cbx_categories") self.le_filter = ui.get_child(self.ui, "le_filter") self.pb_filter = ui.get_child(self.ui, "pb_filter") self.pb_clear = ui.get_child(self.ui, "pb_clear") self.lw_video = ui.get_child(self.ui, "lw_video") self.lb_playing_name = ui.get_child(self.ui, "lb_playing_name") # self.pb_crazy_random = ui.get_child(self.ui, "pb_crazy_random") # self.sb_crazy_random_seconds = ui.get_child(self.ui, "sb_crazy_random_seconds") # self.sb_crazy_random_seconds.setVisible(False) self.wg_video_player = ui.get_child(self.ui, "wg_video_player") self.video_player = video_player.video_player_widget() self.video_player.set_controls_visibility(["pb_size"], False) self.wg_video_player.layout().addWidget(self.video_player) theme.apply_style(self.wg_video_player, "video_player.qss") self.video_player.set_step_options(mode="percent", size=0.01, pause_on_step=False) self.set_video_player_state(False) self.pb_track_prev = ui.get_child(self.ui, "pb_track_prev") self.pb_track_next = ui.get_child(self.ui, "pb_track_next") self.pb_loop = ui.get_child(self.ui, "pb_loop") self.pb_random = ui.get_child(self.ui, "pb_random") self.pb_seek_random = ui.get_child(self.ui, "pb_seek_random") self.sb_seek_random_seconds = ui.get_child(self.ui, "sb_seek_random_seconds") # Set the ui images. self.pb_folder.setIcon(image.create_pixmap(image.get_image_file("folder.png", self.get_current_folder()))) self.pb_filter.setIcon(image.create_pixmap(image.get_image_file("search.png", self.get_current_folder()))) self.pb_clear.setIcon(image.create_pixmap(image.get_image_file("eraser.png", self.get_current_folder()))) # self.pb_loop.setIcon(image.create_pixmap(image.get_image_file("loop.png", self.get_current_folder()))) # self.pb_random.setIcon(image.create_pixmap(image.get_image_file("random.png", self.get_current_folder()))) # self.pb_crazy_random.setIcon(image.create_pixmap(image.get_image_file("crazy_random.png", self.get_current_folder()))) # Signals self.pb_folder.released.connect(self.choose_folder) self.cbx_categories.currentIndexChanged.connect(self.fill_video_list) self.le_filter.returnPressed.connect(self.fill_video_list) self.pb_filter.clicked.connect(self.fill_video_list) self.pb_clear.clicked.connect(self.clear_filters) self.lw_video.itemSelectionChanged.connect(self.play_video) self.pb_track_prev.clicked.connect(self.play_prev) self.pb_track_next.clicked.connect(self.play_next) self.pb_seek_random.clicked.connect(self.toggle_crazy_random) self.tmr_crazy_random.timeout.connect(self.crazy_random_process)
def initUI(self): self.setObjectName("VideoPlayer") # Applies the theme for the widget theme.apply_style(self, "video_player.qss") # Allows full screen self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint) # Inserts the .ui content video_player_ui_file = ui.get_ui_file("video_player.ui", self.get_current_folder()) self.ui = ui.loadUiWidget(video_player_ui_file, parent=self) # Layout. self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) # Phonon components to manage a video. # Video Player self.video_player = CustomVideoPlayer() self.video_player_size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.video_player_size_policy.setHorizontalStretch(0) self.video_player_size_policy.setVerticalStretch(0) self.video_player_size_policy.setHeightForWidth(self.video_player.sizePolicy().hasHeightForWidth()) self.video_player.setSizePolicy(self.video_player_size_policy) self.video_player.setVisible(False) self.video_player.setObjectName("video_player") # Seek Slider - timeline self.seek_slider = CustomSeekSlider() self.seek_slider.setMaximumSize(QtCore.QSize(16777215, 20)) self.seek_slider.setSingleStep(0) self.seek_slider.setObjectName("seek_slider") # Volume Slider. self.volume_slider = CustomVolumeSlider() self.volume_slider.setMaximumSize(QtCore.QSize(150, 20)) self.volume_slider.setMuteVisible(False) self.volume_slider.setSingleStep(0) self.volume_slider.setObjectName("volume_slider") # Inserts the phonon components in the widget containers prepared for them. ui.insert_widget(self, "wg_video", self.video_player, None) ui.insert_widget(self, "wg_seek", self.seek_slider, None) ui.insert_widget(self, "wg_volume", self.volume_slider, None) # Stores controls to use with signals and/or to get values in process. self.wg_controls_bar = ui.get_child(self, "wg_controls_bar") self.pb_time = ui.get_child(self, "pb_time") self.pb_time_total = ui.get_child(self, "pb_time_total") self.pb_time.setStyleSheet("QPushButton {text-align: right;}") self.pb_time_total.setStyleSheet("QPushButton {text-align: left;}") self.pb_refresh = ui.get_child(self, "pb_refresh") self.pb_track_prev = ui.get_child(self, "pb_track_prev") self.pb_step_prev = ui.get_child(self, "pb_step_prev") self.pb_play = ui.get_child(self, "pb_play") self.pb_step_next = ui.get_child(self, "pb_step_next") self.pb_track_next = ui.get_child(self, "pb_track_next") self.lb_loading = ui.get_child(self, "lb_loading") self.lb_state = ui.get_child(self, "lb_state") self.pb_volume_down = ui.get_child(self, "pb_volume_down") self.pb_volume_up = ui.get_child(self, "pb_volume_up") self.pb_volume_on = ui.get_child(self, "pb_volume_on") self.pb_loop = ui.get_child(self.ui, "pb_loop") self.pb_random = ui.get_child(self.ui, "pb_random") self.pb_seek_random = ui.get_child(self.ui, "pb_seek_random") self.sb_seek_random_seconds = ui.get_child(self.ui, "sb_seek_random_seconds") self.sb_seek_random_seconds.setVisible(False) self.pb_size = ui.get_child(self.ui, "pb_size") self.pb_expand = ui.get_child(self, "pb_expand") # Load the ui icons. self.refresh_icon = image.get_image_file("refresh.png", self.get_current_folder()) self.track_prev_icon = image.get_image_file("track_prev.png", self.get_current_folder()) self.step_prev_icon = image.get_image_file("step_prev.png", self.get_current_folder()) self.play_icon = image.get_image_file("play.png", self.get_current_folder()) self.pause_icon = image.get_image_file("pause.png", self.get_current_folder()) self.step_next_icon = image.get_image_file("step_next.png", self.get_current_folder()) self.track_next_icon = image.get_image_file("track_next.png", self.get_current_folder()) self.loading_icon = image.get_image_file("squares_002.gif", self.get_current_folder()) self.volume_up_icon = image.get_image_file("volume_up.png", self.get_current_folder()) self.volume_down_icon = image.get_image_file("volume_down.png", self.get_current_folder()) self.volume_on_icon = image.get_image_file("volume_on.png", self.get_current_folder()) self.volume_off_icon = image.get_image_file("volume_off.png", self.get_current_folder()) self.loop_icon = image.get_image_file("loop.png", self.get_current_folder()) self.loop_icon_checked = image.get_image_file("loop_checked.png", self.get_current_folder()) self.random_icon = image.get_image_file("random.png", self.get_current_folder()) self.random_icon_checked = image.get_image_file("random_checked.png", self.get_current_folder()) self.seek_random_icon = image.get_image_file("seek_random.png", self.get_current_folder()) self.seek_random_icon_checked = image.get_image_file("seek_random_checked.png", self.get_current_folder()) self.expand_icon = image.get_image_file("expand.png", self.get_current_folder()) self.size_icon = image.get_image_file("sizes.png", self.get_current_folder()) self.reduce_icon = image.get_image_file("reduce.png", self.get_current_folder()) # Applies the icons. self.pb_refresh.setIcon(image.create_pixmap(self.refresh_icon)) self.pb_track_prev.setIcon(image.create_pixmap(self.track_prev_icon)) self.pb_step_prev.setIcon(image.create_pixmap(self.step_prev_icon)) self.pb_play.setIcon(image.create_pixmap(self.play_icon)) self.pb_step_next.setIcon(image.create_pixmap(self.step_next_icon)) self.pb_track_next.setIcon(image.create_pixmap(self.track_next_icon)) self.pb_volume_down.setIcon(image.create_pixmap(self.volume_down_icon)) self.pb_volume_up.setIcon(image.create_pixmap(self.volume_up_icon)) self.pb_volume_on.setIcon(image.create_pixmap(self.volume_on_icon)) self.pb_loop.setIcon(image.create_pixmap(self.loop_icon)) self.pb_random.setIcon(image.create_pixmap(self.random_icon)) self.pb_seek_random.setIcon(image.create_pixmap(self.seek_random_icon)) self.pb_size.setIcon(image.create_pixmap(self.size_icon)) self.pb_expand.setIcon(image.create_pixmap(self.expand_icon)) # Special config for the ui elements dedicated to show the buffering process. self.lb_state.setMovie(image.create_movie(self.loading_icon)) self.lb_state.movie().setScaledSize(QtCore.QSize(18,18)) self.lb_state.movie().start() self.update_buffering_ui(force=True, force_state=False) # Config the timer to hide the controls self.timer_hide_controls_ticks_count = 0 self.timer_hide_controls.setInterval(1000) # Creates the signals self.pb_refresh.clicked.connect(self.refresh) self.pb_step_prev.clicked.connect(self.step_prev) self.pb_play.clicked.connect(self.toggle_play) self.pb_step_next.clicked.connect(self.step_next) self.pb_time.clicked.connect(self.toggle_time_display_mode) self.pb_volume_down.clicked.connect(self.volume_down) self.pb_volume_up.clicked.connect(self.volume_up) self.pb_volume_on.clicked.connect(self.toggle_volume) self.pb_loop.toggled.connect(self.update_icons) self.pb_random.toggled.connect(self.update_icons) self.pb_seek_random.toggled.connect(self.update_icons) # self.pb_size.clicked.connect(self.show_sizes) self.pb_expand.clicked.connect(self.toggle_full_screen) self.timer.timeout.connect(self.update_buffering_ui) self.timer_hide_controls.timeout.connect(self.update_controls_visibility)