Пример #1
0
	def refresh_frame(self, date):
		self.date = date		
		for widget in self.get_children():
			self.remove(widget)
		self.create_file_list()
		css.add_css(self, '/home/user/musicbox/css/preferences.css')
		self.show_all()
Пример #2
0
	def change_label(self):
		# time.sleep(1)
		self.dialogLabel1.set_label(_('Done'))
		dialogLabel2 = Gtk.Label(label=_('(Press X)'))
		self.dialogVBox.add(dialogLabel2)
		css.add_css(self, '/home/user/musicbox/css/preferences.css')
		dialogLabel2.show()
		self.hotkeys_config()
Пример #3
0
	def __init__(self, window_type, settings, settings_option, parent=None, values=None, path='/home'):
		Gtk.Window.__init__(self)
		
		self.window_type     = window_type
		self.settings        = settings
		self.settings_option = settings_option
		self.parent          = parent
		self.values          = values
		self.path            = path

		try:
			if (os.path.exists(self.path) and os.path.isdir(self.path) and len(os.listdir(self.path)) > 0) or (self.window_type == widgets.STATISTICS_WINDOW and os.path.exists(self.path)):
				# Config window
				self.config_main_window()

				self.hbox = hbox = Gtk.HBox(homogeneous=False, spacing=20)
				self.add(hbox)

				# Left frame
				self.file_frame = None
				if self.window_type == widgets.STATISTICS_WINDOW:
					self.parse_stat_json()
					self.values.append(_('Exit'))
					self.file_frame = StatisticsFrame(parent=self, color=self.settings.get_option('preferences/theme'), date=self.values[0], songlist=self.statistics)
				else:
					self.file_frame = FileFrame(parent=self, path=self.path, color=self.settings.get_option('preferences/theme'))
				hbox.add(self.file_frame)

				# Right frame
				self.menu_frame = MenuFrame(parent=self, values=self.values, color=self.settings.get_option('preferences/theme'))
				hbox.add(self.menu_frame)
				if window_type == widgets.STATISTICS_WINDOW:
					self.menu_frame.set_size_request(100, 600)	

				self.setup_hotkeys()

				self.set_app_paintable(True)
				self.connect("draw", self.area_draw)
				css.add_css(self, '/home/user/musicbox/css/preferences.css')
				self.show_all()

				self.add_list = {}
				self.delete_list = set()
				self.selected_rows = set()
				self.current_index = 0
				self.menu_frame.treeview_menu.get_selection().select_path(Gtk.TreePath(self.current_index))
				self.file_frame.fileSystemTreeView.get_selection().select_path(Gtk.TreePath(self.current_index))
			else:
				if self.window_type == widgets.BANNER_WINDOW or self.window_type == widgets.MEDIA_WINDOW:
					DialogWindow(message=_('Insert media storage musicbox!'), color=self.settings.get_option('preferences/theme'))
				else:
					DialogWindow(message=_('Cant find path!'), color=self.settings.get_option('preferences/theme'))
		except Exception as err:
			if self.window_type == widgets.BANNER_WINDOW or self.window_type == widgets.MEDIA_WINDOW:
				DialogWindow(message=_('Insert media storage musicbox!') + ':\n' + str(err), color=self.settings.get_option('preferences/theme'))
			else:
				DialogWindow(message=_('Cant find path!'), color=self.settings.get_option('preferences/theme'))					
Пример #4
0
    def __init__(self,
                 parent=None,
                 message='None',
                 apply_key=True,
                 color=None,
                 clbck=None,
                 *clbck_args):
        Gtk.Window.__init__(self)
        # GObject.threads_init()
        self.parent = parent
        self.color = color
        self.message = message
        self.set_name('DialogWindow')
        self.set_decorated(False)
        self.set_app_paintable(True)
        # self.set_border_width(3)
        self.set_modal(True)
        self.set_size_request(300, 150)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            self.set_visual(self.visual)
        # self.connect('destroy', Gtk.main_quit)

        dialogBox = Gtk.Box(homogeneous=False, spacing=1)
        self.add(dialogBox)

        # Dialog frame
        dialogFrame = Gtk.Frame()
        dialogFrame.set_name('DialogFrame_' + color)
        dialogBox.pack_start(dialogFrame, True, True, 1)

        # Dialog labels
        self.dialogVBox = Gtk.VBox(homogeneous=False, spacing=5)
        dialogFrame.add(self.dialogVBox)
        self.dialogLabel1 = Gtk.Label(label=self.message)
        self.dialogVBox.add(self.dialogLabel1)

        if apply_key:
            dialogLabel2 = Gtk.Label(label=_('(Press X)'))
            self.dialogVBox.add(dialogLabel2)
            self.hotkeys_config()

        self.connect("draw", self.area_draw)
        css.add_css(self, '/home/user/musicbox/css/preferences.css')
        self.show_all()
        # time.sleep(1)

        if clbck != None:
            import threading
            self.thread = threading.Thread(target=self.file_thread,
                                           args=(clbck, clbck_args))
            self.thread.daemon = True
            self.thread.start()
Пример #5
0
    def __init__(self):
        Gtk.Window.__init__(self,
                            title='musicbox',
                            name='MainWindow',
                            border_width=10)
        self.stopped = False
        self.settings = settings.SettingsManager(
            "/home/user/musicbox/settings.ini")

        self.mainoverlay = Gtk.Overlay()

        self.mainframe = Gtk.Frame(vexpand=True, valign=Gtk.Align.FILL)
        self.maingrid = Gtk.Grid()
        self.maingrid.set_row_spacing(10)

        self.frame_infobar = frame.infobar
        self.frame_songbar = frame.songbar
        self.frame_banner = frame.banner
        self.frame_player = Gtk.Frame(name='FramePlayerHide')
        self.player = player.MediaPlayerWidget(self.on_end_track_player,
                                               self.frame_player)

        self.maingrid.attach(self.frame_infobar, 0, 0, 1, 1)
        self.maingrid.attach_next_to(self.frame_songbar, self.frame_infobar,
                                     Gtk.PositionType.BOTTOM, 1, 10)
        self.maingrid.attach_next_to(self.frame_banner, self.frame_songbar,
                                     Gtk.PositionType.BOTTOM, 1, 2)
        self.maingrid.attach_next_to(self.player, self.frame_banner,
                                     Gtk.PositionType.RIGHT, 1, 1)
        self.mainframe.add(self.maingrid)

        self.mainoverlay.add_overlay(self.mainframe)
        self.mainoverlay.add_overlay(self.frame_player)
        self.add(self.mainoverlay)
        self.fullscreen()

        self.microphone = equalizer.Microphone()
        self.microphone.start()
        self.demo_player = player.DemoPlayer(self.on_end_track_demo)
        self.key_manager = hotkeys.HotkeyManager(self)

        self.init_signals()
        self.init_settings()
        self.frame_infobar.set_demo_player_track(
            self.demo_player.get_current_track())
        css.add_css(self, '/home/user/musicbox/css/musicbox.css')
Пример #6
0
	def set_value_list(self, label, value):
		# for widget in widgets.ValuesFrame.alignment_values.get_children():
		# 	widgets.ValuesFrame.alignment_values.remove(widget)
		widgets.ValuesFrame.set_size_request(300,300)
		for widget in self.alignment_values.get_children():
			self.alignment_values.remove(widget)

		data = self.get_data_obj(self.data, label)
		if type(data) == widgets.ControlPanelRowNumerical:
			self.label_value = label_value = Gtk.Label(label='')
			# widgets.ValuesFrame.alignment_values.add(label_value)
			self.alignment_values.add(label_value)
			label_value.set_name('LabelValue')
			label_value.set_label(value)
			css.add_css(label_value, '/home/user/musicbox/css/preferences.css')
			label_value.show()
		elif type(data) == widgets.ControlPanelRowList:
			if len(data.values) > 0:
				self.model_values = model_values = Gtk.ListStore(str)
				for row in data.values:
					model_values.append([row[0],])

				renderer = Gtk.CellRendererText()
				renderer.set_alignment(0.5, 0)
				column = Gtk.TreeViewColumn("Value", renderer, text=self.COLUMN_NAME)
				# column.set_fixed_width(300)
				# column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
				column.set_alignment(0.5)
				
				self.treeview_value = treeview_value = Gtk.TreeView()
				treeview_value.set_name('TreeValue')
				# widgets.ValuesFrame.alignment_values.add(treeview_value)
				self.alignment_values.add(treeview_value)
				treeview_value.set_model(model_values)
				treeview_value.set_headers_visible(False)
				treeview_value.append_column(column)
				# treeview_value.connect('cursor-changed', self._on_move_cursor_on_values)
				css.add_css(treeview_value, '/home/user/musicbox/css/preferences.css')
				treeview_value.show()

				treeview_value.set_cursor(Gtk.TreePath(0))
				treeview_value.grab_focus()

		widgets.ValuesFrame.set_label(_('Value').upper())
Пример #7
0
	def __init__(self, settings, media_player, demo_player):
		Gtk.Window.__init__(self, title='Equalizer')
		self.set_decorated(False)

		self.settings = settings
		self.player = media_player
		self.demo_player = demo_player

		self.set_name('Equalizer')
		self.set_size_request(500, 500)
		self.set_modal(True)
		self.set_position(Gtk.WindowPosition.CENTER)
		self.screen = self.get_screen()
		self.visual = self.screen.get_rgba_visual()
		if self.visual != None and self.screen.is_composited():
			self.set_visual(self.visual)
		self.set_app_paintable(True)
		
		self.mainhbox = Gtk.HBox(homogeneous=False, spacing=3)

		# menu model
		self.model_menu = model_menu = Gtk.ListStore(str)

		renderer = Gtk.CellRendererText()
		renderer.set_alignment(0.5, 0)
		column = Gtk.TreeViewColumn("Name", renderer, text=0)
		column.set_fixed_width(170)
		# column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
		column.set_alignment(0.5)
		
		self.treeview_menu = treeview_menu = Gtk.TreeView()
		treeview_menu.set_name('EqualizerTreeMenu')

		self.menuframe = Gtk.Frame()
		self.menuframe.set_name('EqualizerFrame_' + self.settings.get_option('preferences/theme'))
		self.menuframe.set_size_request(175, 500)
		
		self.alignment_menu = alignment_menu = Gtk.Alignment(xalign=0.5, yalign=0.5, xscale=0.5, yscale=0.2)

		treeview_menu.set_model(model_menu)
		treeview_menu.set_headers_visible(False)
		treeview_menu.append_column(column)
		
		treeview_menu.set_cursor(Gtk.TreePath(0))
		treeview_menu.grab_focus()
		
		# mixers
		self.mixerframe = Gtk.Frame()
		self.mixerframe.set_name('EqualizerFrame_' + self.settings.get_option('preferences/theme'))

		self.maingrid = Gtk.Grid()
		# self.maingrid.set_column_homogeneous(True)

		self.chain = []
		x = 0 
		self.alsa_mixers = {}
		self.mixers = collections.OrderedDict()
		self.mixers['Volume'] = Scale(0, 101, 'Volume', mutable=True)
		self.alsa_mixers['Volume'] = alsaaudio.Mixer('Master')
		model_menu.append(['Volume',])
		self.maingrid.attach(self.mixers['Volume'], 0, 0, 50, 1)
		self.chain.append(self.mixers['Volume'])
		x+=1
		for mixer in alsaaudio.mixers( cardindex=0 ):
			if mixer not in ['Mix', 'Mix Mono', 'Capture'] and len(alsaaudio.Mixer( mixer, cardindex=0 ).getvolume()) != 0:
				mutable = False if len(alsaaudio.Mixer( mixer, cardindex=0 ).getvolume()) == 0 else True
				self.mixers[mixer] = Scale(0, 101, mixer, mutable)
				self.alsa_mixers[mixer] = alsaaudio.Mixer( mixer, cardindex=0 )
				model_menu.append([mixer,])
				if x == 0:
					self.maingrid.attach(self.mixers[mixer], 0, 0, 50, 1)
				else:
					self.maingrid.attach_next_to(self.mixers[mixer], self.chain[x-1], Gtk.PositionType.RIGHT, 50, 1)
				self.chain.append(self.mixers[mixer])
				x+=1

		mixer = 'Capture'
		self.alsa_mixers[mixer] = alsaaudio.Mixer(mixer)
		self.mixers[mixer] = Scale(0, 101, mixer, False)
		model_menu.append([mixer,])
		self.maingrid.attach_next_to(self.mixers[mixer], self.chain[x-1], Gtk.PositionType.RIGHT, 50, 1)

		model_menu.append(['Exit',])

		self.active_mixer = self.mixers['Volume']
		self.active_mixer_name = 'Volume'

		# print(self.alsa_mixers)
		
		# self.active_mixer = self.mixers['Master']
		# self.active_mixer_name = 'Master'

		self.get_mixers_from_settings(first=True)

		self.hotkeys = {
				'a':self.on_widget_prev,
				'z':self.on_widget_next,
				'c':self.on_down,
				'd':self.on_up,
				'x':self.on_saveNexit,
				'v':self._block_key,
				's':self._block_key
		}

		# add all elements
		self.add(self.mainhbox)
		self.mainhbox.add(self.menuframe)
		self.menuframe.add(alignment_menu)
		self.alignment_menu.add(treeview_menu)
		self.mainhbox.add(self.mixerframe)
		self.mixerframe.add(self.maingrid)

		self.hotkey_manager = hotkeys.HotkeyManager(self)
		self.hotkey_manager.register_hotkeys(self.hotkeys)
		self.set_app_paintable(True)
		self.connect("draw", self.area_draw)
		css.add_css(self, '/home/user/musicbox/css/preferences.css')
		self.show_all()
		self.active_mixer.label.set_markup('<b><u>'+self.active_mixer.label_text+'</u></b>')
Пример #8
0
	def __init__(self, mainwindow=None):
		Gtk.Window.__init__(self)

		self.mainwindow = mainwindow
		self.settings = mainwindow.settings

		# Config Main Window
		self.config_main_window()

		# Main Frame
		self.main_frame = main_frame = Gtk.Frame()
		main_frame.set_name('PrefrerenceFrame_' + self.settings.get_option('preferences/theme'))
		self.add(main_frame)

		# Main VBox
		self.main_vbox = main_vbox = Gtk.VBox(homogeneous=False, spacing=5)
		main_frame.add(main_vbox)
		
		# Top Label
		self.label_frame = label_frame = Gtk.Frame()
		label_frame.set_name('LabelFrame_' + self.settings.get_option('preferences/theme'))
		main_vbox.pack_start(label_frame, False, True, 5)
		# main_vbox.add(label_frame)

		self.label = label = Gtk.Label(label='')
		label_frame.add(label)

		# Main HBox with tables
		self.main_hbox = main_hbox = Gtk.HBox(homogeneous=False, spacing=20)
		main_vbox.pack_start(main_hbox, True, True, 5)
		# main_vbox.add(main_hbox)

		widgets.create_frames(self, self.settings)

		# List with settings
		self.ControlPanelFrame = widgets.widgets.ControlPanelFrame
		main_hbox.add(self.ControlPanelFrame)
		# main_hbox.pack_start(self.ControlPanelFrame, True, True, 20)

		# List with values
		self.ValuesFrame = widgets.widgets.ValuesFrame
		main_hbox.add(self.ValuesFrame)
		# main_hbox.pack_start(self.ValuesFrame, True, True, 20)

		# Statistic vbox
		stat_vbox = Gtk.HBox(homogeneous=False, spacing=3)
		stat_vbox.set_name('StatVBox')
		self.stat_label11 = Gtk.Label(label=_('All orders:'))
		self.stat_label11.set_halign(1)
		# stat_vbox.pack_start(self.stat_label1, False, True, 5)
		self.stat_label12 = Gtk.Label(label=_('Date started:'))
		self.stat_label12.set_halign(1)
		# stat_vbox.pack_start(self.stat_label2, False, True, 5)
		stat_hbox1 = Gtk.VBox(homogeneous=False, spacing=3)
		stat_hbox1.pack_start(self.stat_label11, False, True, 0)
		stat_hbox1.pack_start(self.stat_label12, False, True, 0)
		stat_vbox.pack_start(stat_hbox1, False, True, 0)

		stat_hbox2 = Gtk.VBox(homogeneous=False, spacing=3)
		stat_alignment1 = Gtk.Alignment(xalign=0, yalign=0.5, xscale=0.5, yscale=0.5)
		stat_alignment1.set_padding(0,0,0,0)
		stat_hbox2.pack_start(stat_alignment1, True, True, 0)
		stat_alignment2 = Gtk.Alignment(xalign=0, yalign=0.5, xscale=0.5, yscale=0.5)
		stat_alignment2.set_padding(0,0,0,0)	
		stat_hbox2.pack_start(stat_alignment2, True, True, 0)
		self.stat_label21 = Gtk.Label(label=str(self.settings.get_option('statistic/orders')))
		self.stat_label22 = Gtk.Label(label=self.settings.get_option('statistic/start_date'))
		stat_alignment1.add(self.stat_label21)
		stat_alignment2.add(self.stat_label22)
		stat_vbox.pack_start(stat_hbox2, False, True, 3)

		main_vbox.pack_start(stat_vbox, False, True, 3)

		self.setup_hotkeys()

		css.add_css(self, '/home/user/musicbox/css/preferences.css')
		self.show_all()
Пример #9
0
	def rewrite_css(self, widget, value, css_class):
		# print(widget.get_name())
		# print(widget.get_name().split('_')[0] + '_' + value)
		widget.set_name( widget.get_name().split('_')[0] + '_' + value )
		css.add_css(widget, css_class)