Linux Lite Forums
Development => Linux Lite Software Development => Topic started by: Jerry on October 16, 2018, 04:06:10 PM
-
I'm thinking in Series 5.x of having a replacement for llver.
When you type in llver, a simple dialogue box will appear with some basic information about Linux Lite. Think 'winver' in Windows.
(https://thewindowsclub-thewindowsclubco.netdna-ssl.com/wp-content/uploads/2015/11/winver-windows-10.jpg)
A linux example:
(https://lh3.googleusercontent.com/-vcWOpZOQtAU/Wkq7YMpEETI/AAAAAAAAACU/RXr8JJoIqhkJsQaZinmEsul8h8l775B9QCLcBGAs/s320/yad40-about.jpg)
The yad box is about perfect as an example of layout, information etc.
Our About box needs to have:
- Latest version of Linux Lite
- License (GPLv2) button
- Close button
- Credits button
- Linux Lite logo
- Linux to our website
- Copyright 2012 - 2018
You can write this in any language you like. I would suggest Python, but it's up to you. The finished product needs to be one, executable file. eg. llver.py
Happy hacking!
-
Hello,
is there a url for the credits button ?
Edit -Linked to the Team page on main site
-
(https://preview.ibb.co/c8dKML/Screenshot-2018-10-17-02-57-56.png)
I cannot get an image to embed directly in to, as I haven't done that before and not having much luck with it, maybe someone else can do that, if you like it that is.
The image just as an example goes between the LL 5.0 and Simple Fast Free, line of text, it can go above like in the example if you wanted.
The button for Linux Lite website, detects and opens the default browser (tested with Firefox and Opera) and displays the Main LL website.
Credits button opens a browser and loads the #Team page on the Main LL website.
License button opens the GPLv2 license webpage.
Close button kills/closes the window, with zero errors (tested), also the X button will close the window (tested) with no errors.
I wrote this in Python, using Gedit, (on Linux Lite) it runs from 1 file "llver.py" from the command line.
It can be run from a desktop icon or menu item, and the silent tag used so it displays only the gui and not the terminal.
If you like it I can add the Python code to a reply.
-
That's excellent bitsnpcs, we are on the right track :)
You can point to an existing logo icon location in your code. If you could embed your code into this thread each time you make a change, that would be great.
-
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=10, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=11, column=0, sticky=W)
# define title, nym, year
l1 = Label(window, text=" Linux Lite 5.0", font="bold")
l1.grid(row=1, column=0, sticky=W)
l2 = Label(window, text=u"\u00a9 Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=13, column=0)
l3 = Label(window, text=" ")
l3.grid(row=4, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=6, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=7, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l4 = Label(window, text=" Simple Fast Free")
l4.grid(row=8, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=9, column=0, sticky=W)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=19, command=OpenUrl3).grid(row=10, column=1, sticky=W)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=11, column=0, sticky=W)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=11, column=1, sticky=W)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=11, column=2, sticky=W)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=11, column=3, sticky=W)
window.mainloop()
Here is the code for as it is above.
I will look in to how to link to the icon.
-
(https://preview.ibb.co/cFpvff/llver2.png)
I was not able to find this banner on my computer, so I borrowed it from the main website and edited it in GIMP to make it smaller.
As you can see it is not top quality resolution image like the main site, if this is the banner wanted I would need the image in better quality resolution, or a location of one on the hard drive, so I can add the Path to it in the code.
The banner can be bigger or it can be centred better.
I was unsure of how you want the Version text placement or wording ?
Do you want the Copyright line moved to centre in width or left aligned as it is.
I need to center the bottom three buttons in the next version, as they look slightly to the right.
Here is the updated code.
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Label(image=photo)
l1.grid(row=4, column=0)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=10, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=11, column=0, sticky=W)
# define title, nym, year
l2 = Label(window, text=u"\u00a9 Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=13, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=7, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=8, column=0)
l3 = Label(window, text=" ")
l3.grid(row=9, column=0, sticky=W)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=19, command=OpenUrl3).grid(row=10, column=1, sticky=W)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=11, column=0, sticky=W)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=11, column=1, sticky=W)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=11, column=2, sticky=W)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=11, column=3, sticky=W)
window.mainloop()
-
In it's current state it looks damn good! We can collab more on this on the weekend if that suits you. Excellent job!
Sent from my Mobile phone using Tapatalk
-
Can you get rid of the maximize and minimise buttons on the title bar, and make the window non-resizeable please.
Sent from my Mobile phone using Tapatalk
-
Yes that would be good :) Saturday is okay.
Sunday I only go online on the evening.
I'll look in to how it is done.
-
Removed maximize and minimize joint button.
Made the window non resizable by dragging the window edges.
I have to look in to how to remove the minimize button without losing the X to close the window.
(https://preview.ibb.co/ftCR30/llver3.png)
updated code -
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Label(image=photo)
l1.grid(row=4, column=0)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=10, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=11, column=0, sticky=W)
# define title, nym, year
l2 = Label(window, text=u"\u00a9 Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=13, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=7, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=8, column=0)
l3 = Label(window, text=" ")
l3.grid(row=9, column=0, sticky=W)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=19, command=OpenUrl3).grid(row=10, column=1, sticky=W)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=11, column=0, sticky=W)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=11, column=1, sticky=W)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=11, column=2, sticky=W)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=11, column=3, sticky=W)
window.mainloop()
-
Awesome :)
Sent from my Mobile phone using Tapatalk
-
Looking good @bitsnpcs
;D ;D ;D ;D
-
Looking good @bitsnpcs
Thank You @Jerry :) and @firenice03 :)
@Jerry I cannot find a way to remove the minimize button that reduces the window to the panel.
-
Small changes -
aligned last row of buttons a little better.
Altered Copyright line to bring the C logo and word Copyright closer/spaced correctly.
(https://preview.ibb.co/jOEhBL/llver5.png)
Updated code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Label(image=photo)
l1.grid(row=4, column=0)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=10, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=11, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=13, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=7, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=8, column=0)
l3 = Label(window, text=" ")
l3.grid(row=9, column=0, sticky=W)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=19, command=OpenUrl3).grid(row=10, column=1, sticky=W)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=11, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=11, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=11, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=11, column=3)
window.mainloop()
Edited -
further edited code for button aligned image is new screenshot after this
-
code in Gedit, (Gedit theme monokai extended) -
(https://preview.ibb.co/fOeXBL/prettyv1.png)(https://preview.ibb.co/hhuAy0/prettyv2.png)(https://preview.ibb.co/mvXDJ0/prettyv3.png)
-
(https://preview.ibb.co/b7yCBL/Screenshot-2018-10-18-00-18-11.png)
Edits -
aligned current version row
resized visit main site button
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Label(image=photo)
l1.grid(row=4, column=0)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=10, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=11, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=13, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=7, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=8, column=0)
l3 = Label(window, text=" ")
l3.grid(row=9, column=0, sticky=W)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=10, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=11, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=11, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=11, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=11, column=3)
window.mainloop()
-
Edits -
added code for x and y coordinates for aligning the logo image more exactly.
Completely redone spacing, and row numbering used.
I thought x,y is a good option for future proofing, as logo sizes and designs may change over time and this allows for exact positioning of the logo in the gui, as it is not relying upon the grid (rows and columns alone) to position the logo, so providing accuracy and ease of changing in an efficient way.
(https://preview.ibb.co/nofaWL/llver9.png)
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Label(image=photo)
l1.grid(row=4, column=0)
l1.place(x=45, y=15)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
Edit -
I realized I didn't state the logo image size I used, this is 150x49 pixels
-
@bitsnpcs it looks nice :)
-
Thank You @Shanti
-
Looks like this needs the python-tk package for tkinter. I'll add it as a dependency in 5.x
- Top logo also links to main website.
- Add button somewhere logical that links to internal Help Manual. /usr/share/doc/litemanual/index.html
- Could you please add our logo as a taskbar icon, points to in Series 4.x+: /usr/share/icons/Papirus/48x48/apps/liteicon.png (or whatever size suits)
- Rename app to llabout.py and pull and display the current LL version from /etc/llver file.
Hope you're enjoying the challenges. :)
-
I'll have a try at these :)
-
Don't sweat if you can't do something, you've already achieved so much. I will fill in the gaps :) Just let me know.
-
Okay thank you
-
#1 - Top logo also links to main website.
#2 - Add button somewhere logical that links to internal Help Manual. /usr/share/doc/litemanual/index.html
#3 - Could you please add our logo as a taskbar icon, points to in Series 4.x+: /usr/share/icons/Papirus/48x48/apps/liteicon.png (or whatever size suits)
#4 - Rename app to llabout.py
#5- pull and display the current LL version from /etc/llver file.Hope you're enjoying the challenges. :)
#1 - completed
#4 - completed
#1 Changed this to a button so a command to open the browser and go to main site can be added, this also lets the viewer know it is a button.
Resized the button so there is a border around the image icon.Change coordinates of x and y to align the button.
(https://preview.ibb.co/hKWPVf/llabout1.png)
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
# open browser and display url at line 7 thru 9
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
#1 - Top logo also links to main website.
#2 - Add button somewhere logical that links to internal Help Manual. /usr/share/doc/litemanual/index.html
#3 - Could you please add our logo as a taskbar icon, points to in Series 4.x+: /usr/share/icons/Papirus/48x48/apps/liteicon.png (or whatever size suits)#4 - Rename app to llabout.py
#5 - pull and display the current LL version from /etc/llver file.
Hope you're enjoying the challenges. :)
#1 - completed
#2 - completed***
#4 - completed
#3 - I was not able to do this, :-[ the various code I tried didn't display gif, png or ico, unsure where I was going wrong with it.
#5 - I am unable to do this, I know an idea of it (a thought) but not how to do it.
One way could be the text of current version to be made into a button, to its right add an output box, it somehow (the stuck point) needs to read the /etc/llver file, specifically the line stating the version, it then needs a variable defined that stores this version parameter , then the variable is output to the box when the button is clicked.
eg; in the donation builder app I made it runs a number generating script I wrote then stores these in a variable and outputs them to the output box on each click, I had help from an Open Source programmer in India on Stack Overflow of how to achieve the output as I could'nt get it to display.
So the user doesn't need to press the button it would need a way of doing an automated click, eg; so the app clicks the version button itself such as when the user clicks/executes to open the app, it also executes an automated click on the version button and so displays the version in the output box.That would occur so fast before the app is on screen and not be seen by the person opening the app, it would appear like the version number was already wrote there etc.
In a few years of practice I might be able to do #5 :) but likely only in this type of way rather than a tidy more advanced way.
*** #2 in 2017 I wrote a post on the forum about how the local help manual for me, displays as a leafpad file of code rather than the actual manual.
On completing #2 for me this is how it displays, not the actual manual, it will need someone with a working local manual to test it and see if the manual appears or the leafpad file.
*** #2 I done some extra learning for this.
I put a menubar on the app for the help manual.
I then decided to make 2 cascading menus.
The menu named Help has -
Help Manual (local) - clicking this opens the manual offline on a users computer, using the default browser.
Help Manual (online) - clicking this opens the default browser and displays the online manual.
Ask community - clicking this opens the forum main page.
The Menu named Support has -
Donate and Shop, clicking either of these opens the main site page for Donating to LL, or the main page LL Shop, in the users default browser.
Additionally @ line #74 I have added and commented out a menu separator, to use this people just delete the # you place this line of code between which ever menu items in the cascades where you want to have a horizontal divider line in the menu, separating the Menu options.
More cascading menus can be added all the way along the menu bar for future needs.
(https://preview.ibb.co/eEDuwL/llabout1.png)
(https://preview.ibb.co/knGmAf/llabout2.png)
(https://preview.ibb.co/gsJYqf/llabout3.png)
The code -
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window)
window.config(menu=menubar)
helpmenu = Menu(menubar)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar)
menubar.add_cascade(label='Support', menu=supportmenu)
def doPrint( ): print 'doPrint'
def doSave( ): print 'doSave'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doPrint( ): print 'doPrint'
def doSave( ): print 'doSave'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
App no visual change, same as above.
Improved code, nomenclature, removed x2 excess lines.
#!/usr/bin/env python# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window)
window.config(menu=menubar)
helpmenu = Menu(menubar)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Just an experimental change, for opinions/ideas.
The idea is, the menu bar and the title bar are similarly grey but don't match, to break this effect and that of the gui background and title bar, I thought to try a third colour as a highlight.
Here I opened the LL Logo in GIMP and took a colour sampling of the feather, got the hex number and used this for the menu bar background colour.
The menus when dropped down are still grey.
(https://preview.ibb.co/jsDdqf/Screenshot-2018-10-20-21-21-58.png)
Edit -
I forgot to say, when moving the mouse over the Help or Support menus, each changes colour to grey individually, the rest of the menu bar stays the feather colour.
The drop down menus can also have the colour changed, I've just checked it, and also each menu item changes colour to grey when moused over, but it might be too much as the intention is just to break up the title bar menu bar/gui difference.
Also the button background the LL logo is on can have its colour changed, plus any of the other buttons, the button fonts, colours and sizes can be changed.
The gui background cannot change at this time as I made using a spacing hack, I made it up by trial and error when making the donation builder app, by using labels, so these do not colour when the gui background is coloured, it may be possible to colour each spacing block/label, and so then colour the entire gui background I'd have to try, if it is wanted.
-
Have a look in this file, there are some great clues there on how to pull info from LL.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Distributed under terms of the GPL2 license.
import os
import sys
import urllib.request
import webbrowser
import subprocess
import fcntl
import tkinter
from configparser import ConfigParser
import gi
gi.require_version('WebKit', '3.0')
from gi.repository import WebKit as webkit
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository.GdkPixbuf import Pixbuf
from os import stat as os_stat
import datetime
import apt
def run_once():
global fh
fh = open(os.path.realpath(__file__), 'r')
try:
fcntl.flock(fh, fcntl.LOCK_EX | fcntl.LOCK_NB)
except:
run_once_dialog()
def run_once_dialog():
window = gtk.Window()
dialog = gtk.MessageDialog(None, 0, gtk.MessageType.WARNING,
gtk.ButtonsType.OK, appname + ' - Error')
dialog.set_default_size(400, 250)
dialog.set_transient_for(window)
dialog.format_secondary_text("There is another instance of " + appname +
" already running.")
response = dialog.run()
if response == gtk.ResponseType.OK:
dialog.destroy()
sys.exit()
dialog.destroy()
def execute(command, ret=True):
if ret is True:
p = os.popen(command)
return p.readline()
else:
p = subprocess.Popen(command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return p.stdout
def functions(view, frame, req, data=None):
uri = req.get_uri()
lllink, path = uri.split('://', 1)
path = path.replace("%20", " ")
if lllink == "file":
return False
elif lllink == "about":
about = gtk.AboutDialog()
about.set_program_name(appname)
about.set_version(appver)
about.set_license(
'''This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. ''')
about.set_authors([
"Johnathan 'ShaggyTwoDope'" +
" Jenkins\n<[email protected]>\n",
"Jerry Bezencon\n<[email protected]>\n",
"Milos Pavlovic\n<[email protected]>\n",
"Brian 'DarthLukan' Tomlinson\n<[email protected]>\n",
"Josh Erickson\n<[email protected]>"
])
about.set_comments("Designed for Linux Lite")
about.set_website("http://www.linuxliteos.com")
about.set_logo(Pixbuf.new_from_file(app_icon))
about.set_transient_for(window)
about.run()
about.destroy()
elif lllink == "admin":
subprocess.Popen(path, shell=True, executable='/bin/bash')
elif lllink == "script":
execute("{0}/scripts/{1}".format(app_dir, path))
elif lllink == "help":
webbrowser.open('file:///usr/share/doc/litemanual/index.html')
elif lllink == "forum":
webbrowser.open('http://www.linuxliteos.com/forums/')
elif lllink == "website":
webbrowser.open('http://www.linuxliteos.com/')
elif lllink == "facebook":
webbrowser.open('https://www.facebook.com/linuxliteos')
elif lllink == "twitter":
webbrowser.open('http://www.twitter.com/linuxlite/')
elif lllink == "google":
webbrowser.open('https://plus.google.com/+linuxliteos/')
elif lllink == "linkedin":
webbrowser.open('http://www.linkedin.com/in/jerrybezencon')
elif lllink == "screenshot":
os.system("/bin/bash -c 'scrot -u $HOME/liteccshot.png'")
subprocess.Popen(['/bin/bash', '-c',
'/usr/share/litecc/scripts/screenshot'])
elif lllink == "report":
subprocess.Popen(['/bin/bash', '-c', 'gksudo /usr/scripts/systemreport'
])
elif lllink == "update":
subprocess.Popen(['/bin/bash', '-c', 'gksudo /usr/scripts/updates-gui'
])
elif lllink == "refresh":
reload()
return True
def reload():
info = ""
get_info(info)
frontend = frontend_fill()
browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
return True
def connected(host='http://google.com'):
try:
urllib.request.urlopen(host)
return True
except:
return False
def mem_info():
f = open('/proc/meminfo')
for line in f:
if line.startswith('MemTotal:'):
mem_total = (int(line.split()[1]) * 1024.0)
elif line.startswith('Active:'):
mem_active = (int(line.split()[1]) * 1024.0)
elif line.startswith('Inactive:'):
mem_inactive = (int(line.split()[1]) * 1024.0)
elif line.startswith('MemFree:'):
mem_free = (int(line.split()[1]) * 1024.0)
elif line.startswith('Cached:'):
mem_cached = (int(line.split()[1]) * 1024.0)
elif line.startswith('Buffers:'):
mem_buffers = (int(line.split()[1]) * 1024.0)
f.close()
return (mem_total, mem_active, mem_inactive, mem_free, mem_cached,
mem_buffers)
def apt_info():
cache = apt.Cache()
cache.close()
cache.open()
upgrades = 0
cache.upgrade(dist_upgrade=False)
changes = cache.get_changes()
if changes:
counter = [change.name for change in changes]
upgrades = (len(counter))
return upgrades
def get_info(info):
try:
if info == "os":
try:
osin = open('/etc/llver', 'r').read().split('\\n')[0]
except:
infocmd = "lsb_release -d | sed 's/Description:[\t]//g'"
osin = execute(infocmd).split('\\n')[0]
return osin
if info == "desk":
desk_ses = os.environ.get("XDG_SESSION_DESKTOP")
if desk_ses is None:
desk_ses = os.environ.get("XDG_CURRENT_DESKTOP")
if "XFCE" in desk_ses or desk_ses.startswith("xfce"):
xfcev = "xfce4-session -V | grep xfce4-session"
return execute(xfcev).split('(')[1].split(')')[0].split(',')[0]
elif "ubuntu" in desk_ses:
return "Unity"
else:
return desk_ses
if desk_ses is None:
desk_ses = "Desktop Unknown"
return desk_ses
if info == "arc":
return os.uname()[4]
if info == "host":
return os.uname()[1]
if info == "kernel":
return "{0} {1}".format(os.uname()[0], os.uname()[2])
if info == "updates":
pkgcache = '/var/cache/apt/pkgcache.bin'
aptcount = apt_info()
if aptcount == 0:
count = ''
elif aptcount == 1:
count = ' (<font style=\"color: red;\">{0}</font> update available)'.format(
aptcount)
else:
count = ' (<font style=\"color: red;\">{0}</font> updates available)'.format(
aptcount)
if os.path.isfile(pkgcache):
mtime = os_stat(pkgcache).st_mtime
modtime = datetime.datetime.fromtimestamp(mtime).strftime(
'%Y-%m-%d %H:%M')
modday = datetime.datetime.fromtimestamp(mtime).strftime(
'%Y-%m-%d')
today = datetime.datetime.today().strftime('%Y-%m-%d')
if modday == today:
updaters = '''<section class="gradient">Last checked on <font style=\"color: green;\">{0}</font>{1} <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''.format(
modtime, count)
else:
updaters = '''<section class="gradient">Last checked on <font style=\"color: red;\">{0}</font>{1} <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''.format(
modtime, count)
else:
updaters = '''<section class="gradient">No Update History <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''
return updaters
if info == "processor":
proc = execute("grep 'model name' /proc/cpuinfo").split(':')[1]
return proc
if info == "mem":
total, active, inactive, free, cached, buffers, = mem_info()
pie = ((int(total) - int(free)) - (int(buffers) + int(cached)))
mem_usage = float(pie) * 100 / float(total)
ramdis = "%14dMB (Used: %8dMB %7.2f%%)" % (
int(total) / 1048576, pie / 1024 / 1024, mem_usage)
return ramdis
if info == "gfx":
return execute("lspci | grep VGA").split('controller:')[1].split(
'(rev')[0].split(',')[0]
if info == "audio":
audio = execute("lspci | grep 'Audio device:'")
if len(audio) == 0:
return execute("lspci | grep audio").split('controller:')[
1].split('(rev')[0].split(',')[0]
else:
return execute("lspci | grep Audio").split('device:')[1].split(
'(rev')[0].split(',')[0]
if info == "disk":
p1 = subprocess.Popen(
['df', '-Tlh', '--total', '-t', 'ext4', '-t', 'ext3', '-t',
'ext2', '-t', 'reiserfs', '-t'
'jfs', '-t', 'ntfs', '-t', 'fat32', '-t', 'btrfs', '-t',
'fuseblk', '-t', 'xfs'],
stdout=subprocess.PIPE).communicate()[0].decode("Utf-8")
total = p1.splitlines()[-1]
used = total.split()[3].replace(total.split()[3][-1:],
" " + total.split()[3][-1:] + "B")
size = total.split()[2].replace(total.split()[2][-1:],
" " + total.split()[2][-1:] + "B")
disk = "{0} (Used: {1})".format(size, used)
return disk
if info == "netstatus":
if connected():
status = '<font color=green>Active</font>'
else:
status = '<font color=red>Not connected</font>'
return status
if info == "netip":
ip = execute("hostname -I").split(' ')
if len(ip) > 1:
ip = ip[0]
elif ip == "":
ip = 'None'
else:
ip = 'None'
return ip
if info == "gateway":
gateway = execute("route -n | grep 'UG[ \t]' | awk '{print $2}'")
if len(gateway) == 0:
gateway = 'None'
return gateway
except (OSError, TypeError, Exception) as e:
print(e)
return " "
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
def get_modules(section):
window = gtk.Window()
try:
mod_dir = os.listdir("{0}/modules/{1}/".format(app_dir, section))
mod_dir.sort()
except Exception:
dialog = gtk.MessageDialog(None, 0, gtk.MessageType.WARNING,
gtk.ButtonsType.OK,
'Error Importing Module Data')
dialog.set_default_size(400, 250)
dialog.format_secondary_text("No modules could be found." +
" Please reinstall " + appname)
dialog.set_transient_for(window)
response = dialog.run()
if response == gtk.ResponseType.OK:
dialog.destroy()
sys.exit()
dialog.destroy()
if isinstance(mod_dir, list) and len(mod_dir) < 1:
return "<p>\"no modules found!\"</p>"
else:
parser = ConfigParser()
admin = ""
mod_dir.sort()
for i in mod_dir:
parser.read("{0}/modules/{1}/{2}".format(app_dir, section, i))
command = parser.get('module', 'command')
chk = command.split(' ')[0]
if chk == "gksudo":
chk = command.split(' ')[1]
elif chk == "gksu":
chk = command.split(' ')[1]
checking = which(chk)
if checking is not None:
ico = parser.get('module', 'ico')
ico = "{0}/frontend/icons/modules/{1}".format(app_dir, ico)
name = parser.get('module', 'name')
desc = parser.get('module', 'desc')
command = command.replace("'", ''' \\' ''')
admin += '''<div class="launcher" onclick="location.href='admin://{0}'" >
<img src="{1}" onerror='this.src = "/usr/share/litecc/frontend/icons/modules/notfound.png"'/>
<h3>{2}</h3>
<span>{3}</span>
</div>'''.format(command, ico, name, desc)
return admin
def frontend_fill():
filee = open("{0}/frontend/default.html".format(app_dir), "r")
page = filee.read()
for i in ['os', 'desk', 'arc', 'processor', 'mem', 'gfx', 'audio', 'disk',
'kernel', 'updates', 'host', 'netstatus', 'netip', 'gateway']:
page = page.replace("{%s}" % i, str(get_info(i)))
sections = ['software', 'system', 'desktop', 'hardware', 'networking']
sections.sort()
for i in sections:
page = page.replace("{%s_list}" % i, get_modules(i))
filee.close()
return page
def main():
global browser
global window
frontend = frontend_fill()
window = gtk.Window()
window.connect('destroy', gtk.main_quit)
window.set_title(appname)
window.set_icon(Pixbuf.new_from_file(app_icon))
rootsize = tkinter.Tk()
if rootsize.winfo_screenheight() > 700:
window.set_resizable(False)
window.set_size_request(880, 660)
else:
window.set_resizable(True)
window.set_size_request(880, 500)
window.set_position(gtk.WindowPosition.CENTER),
browser = webkit.WebView()
swindow = gtk.ScrolledWindow()
window.add(swindow)
swindow.add(browser)
window.show_all()
browser.connect("navigation-requested", functions)
browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
settings = browser.get_settings()
settings.set_property('enable-default-context-menu', False)
browser.set_settings(settings)
gtk.main()
if __name__ == '__main__':
appname = 'Linux Lite Control Center'
appver = '1.0-0310'
app_dir = '/usr/share/litecc'
app_icon = "/usr/share/pixmaps/lite-controlcenter.png"
fh = 0
try:
run_once()
main()
except (Exception, AttributeError) as e:
print("Exiting due to error: {0}".format(e))
sys.exit(1)
-
Let's try the title bar for now. I'll see how it fits into the final product. Thank you.
-
Have a look in this file, there are some great clues there on how to pull info from LL.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Distributed under terms of the GPL2 license.
import os
import sys
import urllib.request
import webbrowser
import subprocess
import fcntl
import tkinter
from configparser import ConfigParser
import gi
gi.require_version('WebKit', '3.0')
from gi.repository import WebKit as webkit
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository.GdkPixbuf import Pixbuf
from os import stat as os_stat
import datetime
import apt
def run_once():
global fh
fh = open(os.path.realpath(__file__), 'r')
try:
fcntl.flock(fh, fcntl.LOCK_EX | fcntl.LOCK_NB)
except:
run_once_dialog()
def run_once_dialog():
window = gtk.Window()
dialog = gtk.MessageDialog(None, 0, gtk.MessageType.WARNING,
gtk.ButtonsType.OK, appname + ' - Error')
dialog.set_default_size(400, 250)
dialog.set_transient_for(window)
dialog.format_secondary_text("There is another instance of " + appname +
" already running.")
response = dialog.run()
if response == gtk.ResponseType.OK:
dialog.destroy()
sys.exit()
dialog.destroy()
def execute(command, ret=True):
if ret is True:
p = os.popen(command)
return p.readline()
else:
p = subprocess.Popen(command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return p.stdout
def functions(view, frame, req, data=None):
uri = req.get_uri()
lllink, path = uri.split('://', 1)
path = path.replace("%20", " ")
if lllink == "file":
return False
elif lllink == "about":
about = gtk.AboutDialog()
about.set_program_name(appname)
about.set_version(appver)
about.set_license(
'''This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. ''')
about.set_authors([
"Johnathan 'ShaggyTwoDope'" +
" Jenkins\n<[email protected]>\n",
"Jerry Bezencon\n<[email protected]>\n",
"Milos Pavlovic\n<[email protected]>\n",
"Brian 'DarthLukan' Tomlinson\n<[email protected]>\n",
"Josh Erickson\n<[email protected]>"
])
about.set_comments("Designed for Linux Lite")
about.set_website("http://www.linuxliteos.com")
about.set_logo(Pixbuf.new_from_file(app_icon))
about.set_transient_for(window)
about.run()
about.destroy()
elif lllink == "admin":
subprocess.Popen(path, shell=True, executable='/bin/bash')
elif lllink == "script":
execute("{0}/scripts/{1}".format(app_dir, path))
elif lllink == "help":
webbrowser.open('file:///usr/share/doc/litemanual/index.html')
elif lllink == "forum":
webbrowser.open('http://www.linuxliteos.com/forums/')
elif lllink == "website":
webbrowser.open('http://www.linuxliteos.com/')
elif lllink == "facebook":
webbrowser.open('https://www.facebook.com/linuxliteos')
elif lllink == "twitter":
webbrowser.open('http://www.twitter.com/linuxlite/')
elif lllink == "google":
webbrowser.open('https://plus.google.com/+linuxliteos/')
elif lllink == "linkedin":
webbrowser.open('http://www.linkedin.com/in/jerrybezencon')
elif lllink == "screenshot":
os.system("/bin/bash -c 'scrot -u $HOME/liteccshot.png'")
subprocess.Popen(['/bin/bash', '-c',
'/usr/share/litecc/scripts/screenshot'])
elif lllink == "report":
subprocess.Popen(['/bin/bash', '-c', 'gksudo /usr/scripts/systemreport'
])
elif lllink == "update":
subprocess.Popen(['/bin/bash', '-c', 'gksudo /usr/scripts/updates-gui'
])
elif lllink == "refresh":
reload()
return True
def reload():
info = ""
get_info(info)
frontend = frontend_fill()
browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
return True
def connected(host='http://google.com'):
try:
urllib.request.urlopen(host)
return True
except:
return False
def mem_info():
f = open('/proc/meminfo')
for line in f:
if line.startswith('MemTotal:'):
mem_total = (int(line.split()[1]) * 1024.0)
elif line.startswith('Active:'):
mem_active = (int(line.split()[1]) * 1024.0)
elif line.startswith('Inactive:'):
mem_inactive = (int(line.split()[1]) * 1024.0)
elif line.startswith('MemFree:'):
mem_free = (int(line.split()[1]) * 1024.0)
elif line.startswith('Cached:'):
mem_cached = (int(line.split()[1]) * 1024.0)
elif line.startswith('Buffers:'):
mem_buffers = (int(line.split()[1]) * 1024.0)
f.close()
return (mem_total, mem_active, mem_inactive, mem_free, mem_cached,
mem_buffers)
def apt_info():
cache = apt.Cache()
cache.close()
cache.open()
upgrades = 0
cache.upgrade(dist_upgrade=False)
changes = cache.get_changes()
if changes:
counter = [change.name for change in changes]
upgrades = (len(counter))
return upgrades
def get_info(info):
try:
if info == "os":
try:
osin = open('/etc/llver', 'r').read().split('\\n')[0]
except:
infocmd = "lsb_release -d | sed 's/Description:[\t]//g'"
osin = execute(infocmd).split('\\n')[0]
return osin
if info == "desk":
desk_ses = os.environ.get("XDG_SESSION_DESKTOP")
if desk_ses is None:
desk_ses = os.environ.get("XDG_CURRENT_DESKTOP")
if "XFCE" in desk_ses or desk_ses.startswith("xfce"):
xfcev = "xfce4-session -V | grep xfce4-session"
return execute(xfcev).split('(')[1].split(')')[0].split(',')[0]
elif "ubuntu" in desk_ses:
return "Unity"
else:
return desk_ses
if desk_ses is None:
desk_ses = "Desktop Unknown"
return desk_ses
if info == "arc":
return os.uname()[4]
if info == "host":
return os.uname()[1]
if info == "kernel":
return "{0} {1}".format(os.uname()[0], os.uname()[2])
if info == "updates":
pkgcache = '/var/cache/apt/pkgcache.bin'
aptcount = apt_info()
if aptcount == 0:
count = ''
elif aptcount == 1:
count = ' (<font style=\"color: red;\">{0}</font> update available)'.format(
aptcount)
else:
count = ' (<font style=\"color: red;\">{0}</font> updates available)'.format(
aptcount)
if os.path.isfile(pkgcache):
mtime = os_stat(pkgcache).st_mtime
modtime = datetime.datetime.fromtimestamp(mtime).strftime(
'%Y-%m-%d %H:%M')
modday = datetime.datetime.fromtimestamp(mtime).strftime(
'%Y-%m-%d')
today = datetime.datetime.today().strftime('%Y-%m-%d')
if modday == today:
updaters = '''<section class="gradient">Last checked on <font style=\"color: green;\">{0}</font>{1} <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''.format(
modtime, count)
else:
updaters = '''<section class="gradient">Last checked on <font style=\"color: red;\">{0}</font>{1} <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''.format(
modtime, count)
else:
updaters = '''<section class="gradient">No Update History <button style=\"padding-bottom:0px;padding-left:50pxi\" onclick=\"location.href=('update://')\">Run Updates</button></section>'''
return updaters
if info == "processor":
proc = execute("grep 'model name' /proc/cpuinfo").split(':')[1]
return proc
if info == "mem":
total, active, inactive, free, cached, buffers, = mem_info()
pie = ((int(total) - int(free)) - (int(buffers) + int(cached)))
mem_usage = float(pie) * 100 / float(total)
ramdis = "%14dMB (Used: %8dMB %7.2f%%)" % (
int(total) / 1048576, pie / 1024 / 1024, mem_usage)
return ramdis
if info == "gfx":
return execute("lspci | grep VGA").split('controller:')[1].split(
'(rev')[0].split(',')[0]
if info == "audio":
audio = execute("lspci | grep 'Audio device:'")
if len(audio) == 0:
return execute("lspci | grep audio").split('controller:')[
1].split('(rev')[0].split(',')[0]
else:
return execute("lspci | grep Audio").split('device:')[1].split(
'(rev')[0].split(',')[0]
if info == "disk":
p1 = subprocess.Popen(
['df', '-Tlh', '--total', '-t', 'ext4', '-t', 'ext3', '-t',
'ext2', '-t', 'reiserfs', '-t'
'jfs', '-t', 'ntfs', '-t', 'fat32', '-t', 'btrfs', '-t',
'fuseblk', '-t', 'xfs'],
stdout=subprocess.PIPE).communicate()[0].decode("Utf-8")
total = p1.splitlines()[-1]
used = total.split()[3].replace(total.split()[3][-1:],
" " + total.split()[3][-1:] + "B")
size = total.split()[2].replace(total.split()[2][-1:],
" " + total.split()[2][-1:] + "B")
disk = "{0} (Used: {1})".format(size, used)
return disk
if info == "netstatus":
if connected():
status = '<font color=green>Active</font>'
else:
status = '<font color=red>Not connected</font>'
return status
if info == "netip":
ip = execute("hostname -I").split(' ')
if len(ip) > 1:
ip = ip[0]
elif ip == "":
ip = 'None'
else:
ip = 'None'
return ip
if info == "gateway":
gateway = execute("route -n | grep 'UG[ \t]' | awk '{print $2}'")
if len(gateway) == 0:
gateway = 'None'
return gateway
except (OSError, TypeError, Exception) as e:
print(e)
return " "
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
def get_modules(section):
window = gtk.Window()
try:
mod_dir = os.listdir("{0}/modules/{1}/".format(app_dir, section))
mod_dir.sort()
except Exception:
dialog = gtk.MessageDialog(None, 0, gtk.MessageType.WARNING,
gtk.ButtonsType.OK,
'Error Importing Module Data')
dialog.set_default_size(400, 250)
dialog.format_secondary_text("No modules could be found." +
" Please reinstall " + appname)
dialog.set_transient_for(window)
response = dialog.run()
if response == gtk.ResponseType.OK:
dialog.destroy()
sys.exit()
dialog.destroy()
if isinstance(mod_dir, list) and len(mod_dir) < 1:
return "<p>\"no modules found!\"</p>"
else:
parser = ConfigParser()
admin = ""
mod_dir.sort()
for i in mod_dir:
parser.read("{0}/modules/{1}/{2}".format(app_dir, section, i))
command = parser.get('module', 'command')
chk = command.split(' ')[0]
if chk == "gksudo":
chk = command.split(' ')[1]
elif chk == "gksu":
chk = command.split(' ')[1]
checking = which(chk)
if checking is not None:
ico = parser.get('module', 'ico')
ico = "{0}/frontend/icons/modules/{1}".format(app_dir, ico)
name = parser.get('module', 'name')
desc = parser.get('module', 'desc')
command = command.replace("'", ''' \\' ''')
admin += '''<div class="launcher" onclick="location.href='admin://{0}'" >
<img src="{1}" onerror='this.src = "/usr/share/litecc/frontend/icons/modules/notfound.png"'/>
<h3>{2}</h3>
<span>{3}</span>
</div>'''.format(command, ico, name, desc)
return admin
def frontend_fill():
filee = open("{0}/frontend/default.html".format(app_dir), "r")
page = filee.read()
for i in ['os', 'desk', 'arc', 'processor', 'mem', 'gfx', 'audio', 'disk',
'kernel', 'updates', 'host', 'netstatus', 'netip', 'gateway']:
page = page.replace("{%s}" % i, str(get_info(i)))
sections = ['software', 'system', 'desktop', 'hardware', 'networking']
sections.sort()
for i in sections:
page = page.replace("{%s_list}" % i, get_modules(i))
filee.close()
return page
def main():
global browser
global window
frontend = frontend_fill()
window = gtk.Window()
window.connect('destroy', gtk.main_quit)
window.set_title(appname)
window.set_icon(Pixbuf.new_from_file(app_icon))
rootsize = tkinter.Tk()
if rootsize.winfo_screenheight() > 700:
window.set_resizable(False)
window.set_size_request(880, 660)
else:
window.set_resizable(True)
window.set_size_request(880, 500)
window.set_position(gtk.WindowPosition.CENTER),
browser = webkit.WebView()
swindow = gtk.ScrolledWindow()
window.add(swindow)
swindow.add(browser)
window.show_all()
browser.connect("navigation-requested", functions)
browser.load_html_string(frontend, "file://{0}/frontend/".format(app_dir))
settings = browser.get_settings()
settings.set_property('enable-default-context-menu', False)
browser.set_settings(settings)
gtk.main()
if __name__ == '__main__':
appname = 'Linux Lite Control Center'
appver = '1.0-0310'
app_dir = '/usr/share/litecc'
app_icon = "/usr/share/pixmaps/lite-controlcenter.png"
fh = 0
try:
run_once()
main()
except (Exception, AttributeError) as e:
print("Exiting due to error: {0}".format(e))
sys.exit(1)
Thanks for showing the code. It is too complex for me, I understand <1% of it.
It is only useful to let me know, I shouldn't have wasted the time on my efforts, and could have put it to a better use lol, and so I will pass and not embarrass myself further :)
-
Thanks for showing the code. It is too complex for me, I understand <1% of it.
It is only useful to let me know, I shouldn't have wasted the time on my efforts, and could have put it to a better use lol, and so I will pass and not embarrass myself further :)
I'm not 100% on what I'm seeing - but your doing a great job @bitsnpcs !! - I'm more of a steal a line of code when I can see what it does kinda coder ;) ... What Jerry's code is (looks like) the Lite Control Center from the 2 series - I was having that feeling perusing the code then saw the name and png extension.. Perhaps knowing/seeing the codes finished product will allow help understand what the lines are doing??
If you don't recall...
https://www.linuxliteos.com/forums/linux-lite-software-development/lite-control-center-beta/msg17031/#msg17031 (https://www.linuxliteos.com/forums/linux-lite-software-development/lite-control-center-beta/msg17031/#msg17031)
-
@firenice03 thank you :) for explaining what it is.
-
Do you have the code for the colored menu version?
-
#1 - done
#2 - done
#3 - now done ***
#4 - done
#5 - not done
Asked additional tasks - all done
#3*** I don't have the 4 series icon, I borrowed this icon from the forum banner (which displays before login in but not after), to resize it to 24x24 in GIMP and crop, I had to untick the chain to get the size, so it then does not maintain aspect ratio and becomes distorted. A properly made icon appears with the correct aspect ratio, I checked this using one of the Gnome icons.
Additionals -
removed dashy lines from menus so they look better, image 2 below.
(https://preview.ibb.co/etWuY0/about8.png)
(https://preview.ibb.co/novMD0/about9.png)
Code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
window.overrideredirect(True)
window.eval('tk::PlaceWindow %s center' % window.winfo_pathname(window.winfo_id()))
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
helpmenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Coloured menus task. Mouse over of menu title or any item in the menu makes it change colour to grey.
(https://preview.ibb.co/fSBObL/about10.png)
(https://preview.ibb.co/diGmVf/about11.png)
Code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
window.overrideredirect(True)
window.eval('tk::PlaceWindow %s center' % window.winfo_pathname(window.winfo_id()))
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
helpmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Looking terrific @bitsnpcs FYI - on 2 or more monitors, the About window appears right in the middle of each screens bezel, so it is effectively cut in half. Can we have it so that the window appears in the middle of the main screen? Thank you.
-
Example. Tying in Logo, Menu and main site.
(https://preview.ibb.co/hpjei0/about12.png)
-
I don't understand the code, and will pass on this as well as #5 (as stated earlier) but here it is to use multiple monitors -
"Tkinter doesn't see if there are 2 or more monitors extended horizontal or vertical. So, you 'll get the total resolution of all screens together and your window will end-up somewhere in the middle of the screens.
PyQt from the other hand, doesn't see multi-monitors environment either, but it will get only the resolution of the Top-Left monitor (Imagine 4 monitors, 2 up and 2 down making a square). So, it does the work by putting the window on center of that screen. If you don't want to use both, PyQt and Tkinter, maybe it would be better to go with PyQt from start." - quoted from Stack Overflow.
Multiple Monitors using tkinter AND PyQT4 -https://stackoverflow.com/questions/3352918/how-to-center-a-window-on-the-screen-in-tkinter (https://stackoverflow.com/questions/3352918/how-to-center-a-window-on-the-screen-in-tkinter)
I have re-added the titlebar.
Do you want the colour of menu drop down changed back to grey or left as is ?
(https://preview.ibb.co/bDb6Fq/about14.png)
code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x242")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
helpmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=10, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version: 5.0")
l4.grid(row=9, column=0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
There's no hurry here and keep in mind, you're not obligated to do anything you don't want to :) Series 5.x is a long way off.
You've already made tremendous progress, I'm very proud of you.
-
Shall I remove the centering, and re-add the titlebar to the code so it works for users with multiple monitors too ? - Yes please.
-
Shall I remove the centering, and re-add the titlebar to the code so it works for users with multiple monitors too ? - Yes please.
Done this it appears above x3 posts in thread.
-
Some thoughts -
- adding a menu on menubar named "Themes" (or something else), to the About app.
- contained inside would be titles such as Red, Yellow, Orange, Green, Flags
The graphic designer members would be needed to -- make transparent banners of Linux lite, one with each of the Official feather colours , red having a red feather, yellow a yellow feather, as an example of this see the About app current main website banner logo to give an idea.
- make logos for the menu bar to match each.
- make feathers wrapped in a flag, every flag of the nations in the community, maybe also feathers with, a cross , a rainbow one. It wouldn't be complete without a ganja leaf feather on a caduceus.
Programmers would then -
attach a script to each menu title so when for example blue is clicked, it changes the menu bar to blue, the main website banner logo feather to blue and the menubar icon feather to blue .
Clicking Flags would open a Gui window (as there would be too many option for inside a menu), in this window would be the icon of each nations flag and the universal use flags like ganja leaf, rainbow, or cross.
Clicking any of these would change the menu bar to the base colour hex code, eg; such as ganja leaf green menubar, ganja leaf on the menubar icon, and on the main website banner icon.
Clicking the flag would also close the flag selection window at the end of its script.
Or an okay button to confirm, apply and close the flag window.
Furthering on that would be
- when clicking a colour or flag, this applies the users choice throughout all Lite Software Apps on their system, and the XFCE Main Menu icon, in 1 click of okay, so they match.
- That would be Lite Themes an internal theme system for Lite Apps, potential new in LL 5.0?
Lite themes once made for the About App could be integrated in to every Lite App, by adding a button that links to and runs it through the About app, code file.
This could also be made to allow it to do things like VLC Player does, such as apply a santa hat, on everyone's feather for Christmas done during a Lite Install Updates, that is removed at the appropriate time during a future/date specific Lite Install Updates, done via install updates as this maintains security, and doesn't slow or present future problems with bandwidth or security of an open port.
It also actively encourages users to update their system in a regular fashion, which is also About Linux Lite.
-
#1 - done
#2 - done
#3 - done
#4 - done
#5 - now done* - the code reads the /etc/llver file stores its text and writes this to the gui.
* - it reads version as LL 3.0 on this computer which is what it also says inside the file if browsed to, and it is LL 3.2.
I need to adjust the spacing, of current version and version # lines, til it is a bit better.
Added a space row, a new row, renumbered some rows.
Increased the app size by 8 pixels in height so the copyright line was in the gui.
(https://preview.ibb.co/jBMQaq/about15.png)
Code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
helpmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text=" Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Spacing done.
(https://preview.ibb.co/cyPydA/about1.png)
code
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
helpmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Help', menu=helpmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
def doHelp( ): print 'doHelp'
helpmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
helpmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
helpmenu.add_command(label='Ask Community', command=OpenUrl5)
helpmenu = Menu(menubar)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Donate', command=OpenUrl6)
supportmenu.add_command(label='Shop', command=OpenUrl7)
supportmenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Menu changes:
(https://i.imgur.com/c8pfFKq.gif)
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def close_window():
window.destroy()
def OpenUrl8():
webbrowser.open(url8)
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
contributemenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Contribute', menu=contributemenu)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
supportmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
supportmenu.add_command(label='Forums', command=OpenUrl5)
supportmenu = Menu(menubar)
def doContribute( ): print 'doContribute'
contributemenu.add_command(label='Donate', command=OpenUrl6)
contributemenu.add_command(label='Shop', command=OpenUrl7)
contributemenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
#5 - reads my /etc/llver file perfectly, no matter what I put in it. Nice job :)
-
In regards to Themes - Id like to keep the app as simple as possible for the moment. What I did have an idea about is 'Send Logs' from the Menu.
This would make a tar.gz and upload all relevant logs that devs need to see in order to fix a problem. This is already an About box on steroids, so we may need to just concentrate on refinement for now.
-
I have changed the code at my end to match now.Your changes make it clear as to what each menu is for :)
I have also made code changes -
I duplicated a label "l3" and did not add a grid below it so it was not in use anyhow, but the line needed deleting as if a grid is added at a future check it would change the spacing.Look for two of this line one below another, around line 108
l3 = Label(window, text=" ")
The other changes were tidying, in the define area, lines 38 and lines 41 are now switched with each others line.So that all the define of the Open Url are together and tidy.Rather than 1-7 of Open Url, then a def close window, then def open url 8.
(https://preview.ibb.co/g0DVQq/Screenshot-2018-10-23-04-18-40.png)
Code with the edits above done, and also with all of your edits done, so I have it all up to date now.
#!/usr/bin/env python
# code by bitsnpcs
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def OpenUrl8():
webbrowser.open(url8)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
contributemenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Contribute', menu=contributemenu)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
supportmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
supportmenu.add_command(label='Forums', command=OpenUrl5)
supportmenu = Menu(menubar)
def doContribute( ): print 'doContribute'
contributemenu.add_command(label='Donate', command=OpenUrl6)
contributemenu.add_command(label='Shop', command=OpenUrl7)
contributemenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Awesome :)
-
#5 - reads my /etc/llver file perfectly, no matter what I put in it. Nice job :)
:)
In regards to Themes - Id like to keep the app as simple as possible for the moment. What I did have an idea about is 'Send Logs' from the Menu.
This would make a tar.gz and upload all relevant logs that devs need to see in order to fix a problem. This is already an About box on steroids, so we may need to just concentrate on refinement for now.
The "Send Logs" sounds like it would be a useful app for both members and devs.
Concentrating on refinement sounds good.
When does LL 5.0 get released ?
Do you have a list of apps, or a poll of apps for LL 5.0 and beyond ?
-
When does LL 5.0 get released ? - There's no official Roadmap until the end of Series 4.x, but you can assume around 1st June 2020.
Do you have a list of apps, or a poll of apps for LL 5.0 and beyond ? Not yet, to early. I'm still considering what if much at all, I can introduce to 4.x We are pretty complete now.
-
I understand now when you wrote earlier about it is quite a long way away.
-
updated info line
#!/usr/bin/env python
# code by - bitsnpcs & Jerry Bezencon (2018)
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def OpenUrl8():
webbrowser.open(url8)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
photovar1 = PhotoImage(file='mlogo.png')
llmenu = Menubutton(menubar, image=photovar1)
menubar.add_cascade(image=photovar1, menu=llmenu)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
contributemenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Contribute', menu=contributemenu)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
supportmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
supportmenu.add_command(label='Forums', command=OpenUrl5)
supportmenu = Menu(menubar)
def doContribute( ): print 'doContribute'
contributemenu.add_command(label='Donate', command=OpenUrl6)
contributemenu.add_command(label='Shop', command=OpenUrl7)
contributemenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Looks like there has been a slight misunderstanding with the small LL logo in the top left hand corner of the app. That icon is supposed to be on the taskbar. Sorry for any confusion.
-
Shall I remove it from the menubar ?
I cannot get it on the taskbar.
-
Shall I remove it from the menubar ?
Yes please.
-
icon removed
Here you can see what I had wrote previously from the image, how the menubar shrinks to fit the font size of the menus, if an icon was used there at the same size it would be this size, whereas it expanded to produce the same space above the icon rather than above the fonts, as the icon was too big, so it made it too big a space above the fonts.It might help someone else if they weren't sure about it. Last icon was 24x24 ,so it might work with 16x16 icon instead.
(https://preview.ibb.co/fmpDLq/Screenshot-2018-10-26-08-57-48.png)
#!/usr/bin/env python
# code by - bitsnpcs & Jerry Bezencon (2018)
from Tkinter import *
import webbrowser
url1 = 'https://www.linuxliteos.com/development.html#team'
url2 = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
url3 = 'https://www.linuxliteos.com/'
url4 = 'https://www.linuxliteos.com/manual/'
url5 = 'https://www.linuxliteos.com/forums/index.php'
url6 = 'https://www.linuxliteos.com/donate.html'
url7 = 'https://www.linuxliteos.com/shop.html'
url8 = '/usr/share/doc/litemanual/index.html'
# open browser and display url at line 7 thru 13
def OpenUrl1():
webbrowser.open(url1)
def OpenUrl2():
webbrowser.open(url2)
def OpenUrl3():
webbrowser.open(url3)
def OpenUrl4():
webbrowser.open(url4)
def OpenUrl5():
webbrowser.open(url5)
def OpenUrl6():
webbrowser.open(url6)
def OpenUrl7():
webbrowser.open(url7)
def OpenUrl8():
webbrowser.open(url8)
def close_window():
window.destroy()
# Make window
window = Tk()
window.title("About Linux Lite")
window.geometry("242x250")
window.resizable(0,0)
# adding a menubar
menubar = Menu(window, bg='#ffe082')
window.config(menu=menubar)
supportmenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Support', menu=supportmenu)
contributemenu = Menu(menubar, bg='#ffe082', tearoff=0)
menubar.add_cascade(label='Contribute', menu=contributemenu)
def doSupport( ): print 'doSupport'
supportmenu.add_command(label='Help Manual (local)', command=OpenUrl8)
supportmenu.add_command(label='Help Manual (online)', command=OpenUrl4)
supportmenu.add_command(label='Forums', command=OpenUrl5)
supportmenu = Menu(menubar)
def doContribute( ): print 'doContribute'
contributemenu.add_command(label='Donate', command=OpenUrl6)
contributemenu.add_command(label='Shop', command=OpenUrl7)
contributemenu = Menu(menubar)
# uncomment below to add separator in menu, place code where seperator is wanted
# filemenu.add_separator( )
# adding a logo
photo=PhotoImage(file="logo.png")
l1 = Button(image=photo,width=160, height=59, command=OpenUrl3)
l1.grid(row=4, column=0)
l1.place(x=36.3, y=12)
l1 = Label(window, text=" ")
l1.grid(row=5, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=6, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=7, column=0, sticky=W)
l1 = Label(window, text=" ")
l1.grid(row=8, column=0, sticky=W)
# adding a frame for ll website button
GUIFrame1=Frame(window)
GUIFrame1.grid(row=11, column=0)
#adding a frame for last row of buttons
GUIFrame2=Frame(window)
GUIFrame2.grid(row=13, column=0)
# define title, nym, year
l2 = Label(window, text=u"\u00a9Copyright 2012-2018 Jerry Bezencon", fg="grey", font="none 8")
l2.grid(row=15, column=0)
l3 = Label(window, text=" ")
l3.grid(row=0, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=12, column=0, sticky=W)
l3 = Label(window, text=" ")
l3.grid(row=14, column=0, sticky=W)
l4 = Label(window, text="Current Version:")
l4.grid(row=9, column=0)
# r/w file to gui background
file = open("/etc/llver")
data = file.read()
file.close()
Results = Label(window, text = data)
Results.grid(row = 10, column = 0)
# ll website button
l5 = Label(GUIFrame1, text=" ")
l5.grid(row=11, column=0, sticky=W)
Button(GUIFrame1, text="Visit Linux Lite website", width=16, command=OpenUrl3).grid(row=11, column=0)
# last row of buttons
l6 = Label(GUIFrame2, text=" ")
l6.grid(row=13, column=0)
Button(GUIFrame2, text="Credits", width=6, command=OpenUrl1).grid(row=13, column=1)
Button(GUIFrame2, text="License", width=6, command=OpenUrl2).grid(row=13, column=2)
Button(GUIFrame2, text="Close", width=6, command=window.destroy).grid(row=13, column=3)
window.mainloop()
-
Thank you :)