def __init__(self, *args, **kwargs): """initializes the add songs window so that it has same properties as the main window""" super(add_window,self).__init__() # super returns parent object in this case, the QMainWindow deskW, deskH = background.Background(self) self.setWindowTitle("Geoff's Jukebox - Add Song") self.backbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\back.png"), self) self.backbtn.dimens(deskW/10) self.show()
def __init__(self, *args, **kwargs): """initializes the settings window so that it has same properties as the main window""" super(settings_window,self).__init__() # super returns parent object in this case, the QMainWindow deskW, deskH = background.Background(self) self.setWindowTitle("Geoff's Jukebox - Settings") maxwidth = deskW/3 self.backbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\back.png"), self) self.wifibtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\configure_wifi.png"), self) self.lightbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\light.png"), self) btn_order = [self.wifibtn, self.lightbtn, self.backbtn] set_layout = QtGui.QVBoxLayout() for btn in btn_order: btn.dimens(maxwidth) #btn.setMaximumWidth(maxwidth) #set_layout.addStretch(2) set_layout.addWidget(btn, 0, QtCore.Qt.AlignCenter) #set_layout.addWidget(btn) #set_layout.addStretch(0) self.setLayout(set_layout) self.show()
def __init__(self, *args, **kwargs): """initializes the wifi window so that it has same properties as the main window""" super(wifi_window,self).__init__() # super returns parent object in this case, the QMainWindow deskW, deskH = background.Background(self) width = deskW/5 height = deskH/5 self.setGeometry(0,0,width,height) self.setWindowTitle("Geoff's Jukebox - WiFi Configuration") self.backbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\cancel.png"), self) self.backbtn.dimens(width/3) self.applybtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\apply.png"), self) self.applybtn.dimens(width/3) self.applybtn.clicked.connect(self.apply_wifi) # -------- acquiring wifi names + combo box----------------------------------------------------------------- wifi_output = Wifi_Configure.WifiConfig() wifi_names = wifi_output.wifi_name if wifi_names == []: wifi_names = ["No WiFi Detected!"] self.wifi_combo = QtGui.QComboBox(self) #wifi_combo.setSizePolicy(QtGui.QSizePolicy.Expand, QtGui.QSizePolicy.Expanding) for names in wifi_names: self.wifi_combo.addItem(names) # -------------- setting up checkbox ------------------------------------------------------------------- ''' sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) ''' save_cb = QtGui.QCheckBox('Leave Checked To Save WiFi', self) save_cb.setFont(QtGui.QFont(self.Small_Font[0],self.Small_Font[1])) save_cb.setPalette(self.font_color) save_cb.toggle() save_cb.stateChanged.connect(self.save_wifi) # -----------------setting up password line edit --------------------------------------------------------- instr = QtGui.QLabel("Choose your WiFi name and enter password!") instr.setFont(QtGui.QFont(self.Small_Font[0],self.Small_Font[1])) instr.setPalette(self.font_color) self.passw = QtGui.QLineEdit(self) pass_text = QtGui.QLabel('Password:'******'wificonfig.json' for order in layout_order: if 'Layout' in order.__str__(): wifi_layout.addLayout(order) else: wifi_layout.addWidget(order, 0, QtCore.Qt.AlignCenter) #wifi_layout.addWidget(order) self.setLayout(wifi_layout) center(self) self.show()
def home(self): # Specific to the home page """ creates the main window (home window)""" # Make the Jukebox Logo ---------------------------------------------------------------------------------- juke_logo = QtGui.QLabel(self) # defining the logo image logo_fname = os.getcwd() + "\\Images\\Jukebox_logo.png" # defining logo pathname im2 = Image.open(logo_fname) # opening the logo with PIL #im2 = im2.resize((self.deskW,self.deskH), PIL.Image.ANTIALIAS) #im2 = im2.resize((100,100), Image.ANTIALIAS) logowidth, logoheight = im2.size # acquiring the logo width/height logo_pix = QtGui.QPixmap(logo_fname) # getting the pixmap juke_logo.setPixmap(logo_pix) # setting the pixmap juke_logo.setGeometry(0,0,logowidth,logoheight) # setting the geometry #juke_logo.move(0,(deskW-logowidth)/2) # Make a section where it shows the Current Song ---------------------------------------------------------- ''' # Make a section where it shows the Playlist name and within it a list of the qeued songs ------------------ song_list = ['hello', 'hi'] qeued_songs = QtGui.QListWidget() for i in range(10): song = QtGui.QListWidgetItem("Item %i" % i) qeued_songs.addItem(song) qeued_songs.show() ''' # make a play/pause button -------------------------------------------------------------------------------- playbtn = buttons.PlayButton(QtGui.QPixmap(os.getcwd() + "\\Images\\play_button.png"), self) # added a button for adding songs # make a skip forward butotn ------------------------------------------------------------------------------ sfward_btn = buttons.circleButton(QtGui.QPixmap(os.getcwd() + "\\Images\\skip_forward.png"), self) # added a button for adding songs # make a skip backward button ---------------------------------------------------------------------------- sbward_btn = buttons.circleButton(QtGui.QPixmap(os.getcwd() + "\\Images\\skip_backward.png")) # added a button for adding songs # Make an Add Song button ---------------------------------------------------------------------------------- self.add_song = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\add_song.png"), self) # Make a Edit Playlist button ------------------------------------------------------------------------------- self.edit_play = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\edit_playlist.png"), self) # Make a Settings button ----------------------------------------------------------------------------------- self.settingsbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\Settings.png"), self) #self.settingsbtn.dimens(deskW/8) # Make a quit button ----------------------------------------------------------------------------------------- quitbtn = buttons.imgButton(QtGui.QPixmap(os.getcwd() + "\\Images\\quit.png"), self) quitbtn.dimens(self.deskW/8) quitbtn.clicked.connect(self.close_application) quitbtn.setShortcut("Ctrl+Q") quitbtn.setToolTip('Click to quit!') # make label explaining version number and last date updated -------------------------------------------- mod_date = time.ctime(os.path.getmtime(os.getcwd() + "\\Jukebox_V2.py")) vers_label = QtGui.QLabel("Geoff's Jukebox V1.0 - Last Updated: " + mod_date) vers_label.setFont(QtGui.QFont(self.Large_Font[0],self.Large_Font[1])) vers_label.setPalette(self.font_color) # making the layout -------------------------------------------- butn_order = [sbward_btn, playbtn, sfward_btn, self.add_song, self.edit_play, self.settingsbtn, quitbtn] #butn_order = [sbward_btn, playbtn, sfward_btn, self.add_song, self.edit_play, quitbtn] layout = QtGui.QVBoxLayout() # setting the layout layout.addStretch(1) butn_layout = QtGui.QHBoxLayout() butn_layout.addStretch(1) for butn in butn_order: butn.dimens(self.deskW/8) butn_layout.addWidget(butn) butn_layout.addStretch(1) lay_order = [juke_logo, butn_layout, self.settingsbtn] for lay in lay_order: if 'Layout' in lay.__str__(): layout.addLayout(lay) layout.addStretch(1) else: layout.addWidget(lay, 0, QtCore.Qt.AlignCenter) layout.addStretch(1) layout.addStretch(1) layout.addWidget(vers_label) self.setLayout(layout) # showing the layout self.show()