├── src
├── modules
│ ├── __init__.py
│ ├── gallium_os.py
│ ├── sound.py
│ ├── linux.py
│ └── network.py
├── tools.py
├── gr8bar.py
└── ui.py
├── .vscode
└── settings.json
├── res
├── md
│ ├── example-bar.png
│ ├── example-bar2.png
│ └── example-bar3.png
├── slant-ld.svg
├── slant-lu.svg
├── slant-rd.svg
├── slant-lui.svg
├── slant-ru.svg
├── test
│ └── nmcli-output.txt
├── ubuntu-logo.svg
├── ubuntu-logo-sm.svg
└── arch-logo.svg
├── README.md
├── test
├── bluebird
│ ├── bottom.py
│ └── top.py
├── surreal
│ ├── workspace-complete.py
│ └── config-complete.py
└── config.py
├── .pylintrc
├── .gitignore
└── LICENSE
/src/modules/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "python.pythonPath": "C:/Python36/python.exe"
3 | }
--------------------------------------------------------------------------------
/res/md/example-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TSedlar/gr8bar/HEAD/res/md/example-bar.png
--------------------------------------------------------------------------------
/res/md/example-bar2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TSedlar/gr8bar/HEAD/res/md/example-bar2.png
--------------------------------------------------------------------------------
/res/md/example-bar3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TSedlar/gr8bar/HEAD/res/md/example-bar3.png
--------------------------------------------------------------------------------
/res/slant-ld.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/slant-lu.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/slant-rd.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/slant-lui.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/slant-ru.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # gr8bar
2 | A cross-platform status bar made with Qt5
3 |
4 | 
5 | 
6 | 
7 |
8 | ## Prerequisites
9 |
10 | ### PyQt5
11 | ```
12 | pip3 install PyQt5
13 | ```
14 |
15 | ## Trying it out
16 | You can try out by running:
17 |
18 | ```
19 | python3 ./src/gr8bar.by ./test/config.py
20 | ```
21 |
22 | ## TODO
23 | - Allow layout to be changed (QVBoxLayout vs QHBoxLayout)
24 |
--------------------------------------------------------------------------------
/test/bluebird/bottom.py:
--------------------------------------------------------------------------------
1 | panel_bg = '#1a2740'
2 | panel_border = 'none'
3 | real_panel_bg = '#232631'
4 | icon_color = '#e6e6e6'
5 |
6 | text_css = {
7 | 'css': {
8 | 'color': icon_color,
9 | 'background-color': real_panel_bg,
10 | 'font-size': '14px',
11 | 'font-family': 'Hack, FontAwesome'
12 | }
13 | }
14 |
15 |
16 | def bounds():
17 | return {'x': 0, 'y': 1054, 'w': 1920, 'h': 26}
18 |
19 |
20 | def render_loop_delay():
21 | return 1000
22 |
23 |
24 | def init_prop_updaters():
25 | return []
26 |
27 |
28 | def config(data):
29 | data.ui.set_bg(data.panel, panel_bg)
30 | data.ui.set_border(data.panel, panel_border)
31 |
--------------------------------------------------------------------------------
/.pylintrc:
--------------------------------------------------------------------------------
1 | [MASTER]
2 |
3 | extension-pkg-whitelist=PyQt5
4 |
5 | [MESSAGES CONTROL]
6 |
7 | # Enable the message, report, category or checker with the given id(s). You can
8 | # either give multiple identifier separated by comma (,) or put this option
9 | # multiple time.
10 | #enable=
11 |
12 | # Disable the message, report, category or checker with the given id(s). You
13 | # can either give multiple identifier separated by comma (,) or put this option
14 | # multiple time (only on the command line, not in the configuration file where
15 | # it should appear only once).
16 | disable=W0102,C0103,C0111,C1801,W0621,W0622,W0106,W0613,W1401
17 |
18 | # Good variable names which should always be accepted, separated by a comma
19 | good-names=i,j,k,ex,Run,_,pk,x,y,ui
--------------------------------------------------------------------------------
/res/test/nmcli-output.txt:
--------------------------------------------------------------------------------
1 | * SSID MODE CHAN RATE SIGNAL BARS SECURITY
2 | CentHub Infra 1 54 Mbit/s 100 ▂▄▆█ WPA2
3 | AndroidAP Infra 165 54 Mbit/s 75 ▂▄▆_
4 | CentHub Infra 36 54 Mbit/s 70 ▂▄▆_ WPA2
5 | IWATCHYOUSLEEP Infra 11 54 Mbit/s 47 ▂▄__ WPA1 WPA2
6 | IWATCHYOUSLEEP_5G Infra 44 54 Mbit/s 39 ▂▄__ WPA1 WPA2
7 | ASUS Infra 6 54 Mbit/s 37 ▂▄__ WPA2
8 | DIRECT-55-HP OfficeJet 4650 Infra 6 54 Mbit/s 35 ▂▄__ WPA2
9 | The Main Nerve Infra 11 54 Mbit/s 35 ▂▄__ WPA2
10 | BIRDNEST Infra 1 54 Mbit/s 20 ▂___ WPA1 WPA2
11 | The Main Nerve Infra 149 54 Mbit/s 14 ▂___ WPA2
12 | ASUS_5G-2 Infra 153 54 Mbit/s 14 ▂___ WPA2
--------------------------------------------------------------------------------
/src/modules/gallium_os.py:
--------------------------------------------------------------------------------
1 | import tools
2 |
3 |
4 | def get_volume_level():
5 | '''
6 | Gets the current volume level
7 | '''
8 | txt = tools.term('amixer sget DAC1 | egrep -o "[0-9]+%" | head -1')
9 | txt = txt.replace('%', '')
10 | return int(txt)
11 |
12 |
13 | def set_volume(percent):
14 | '''
15 | Sets the volume level to the given percent
16 | :param percent: The volume percent to set to
17 | '''
18 | return tools.term('amixer -q sset DAC1 %s%%' % (percent))
19 |
20 |
21 | def increment_volume(percent):
22 | '''
23 | Increments the volume level by the given percent
24 | :param percent: The amount of percent to increment by
25 | '''
26 | return tools.term('amixer -q sset DAC1 %s%%+' % (percent))
27 |
28 |
29 | def decrement_volume(percent):
30 | '''
31 | Decrements the volume level by the given percent
32 | :param percent: The amount of percent to decrement by
33 | '''
34 | return tools.term('amixer -q sset DAC1 %s%%-' % (percent))
35 |
36 |
37 | def toggle_volume():
38 | '''
39 | Toggles the volume (mute/unmute)
40 | '''
41 | return tools.term('amixer -q sset DAC1 toggle')
42 |
--------------------------------------------------------------------------------
/res/ubuntu-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/ubuntu-logo-sm.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/modules/sound.py:
--------------------------------------------------------------------------------
1 | from PyQt5 import QtCore, QtWidgets
2 |
3 |
4 | default_bg = '#343f5a'
5 | default_bg_hover = '#232a3d'
6 |
7 |
8 | def create_popup(data, props, vol_key, set_vol):
9 | width = props['item_width'] if 'item_width' in props else 45
10 | height = props['item_height'] if 'item_height' in props else 130
11 | bg = props['bg'] if 'bg' in props else default_bg
12 | popup = data.ui.create_popup(width, 0, bg)
13 | popup_layout = data.ui.vbox_layout(popup)
14 | popup_layout.setContentsMargins(0, 10, 0, 10)
15 |
16 | data.ui.add_label(popup_layout, '100', props).setFixedHeight(25)
17 |
18 | slider_frame = QtWidgets.QFrame()
19 | slider_layout = data.ui.hbox_layout(slider_frame)
20 | slider_layout.setContentsMargins(10, 10, 10, 10)
21 | slider = QtWidgets.QSlider(QtCore.Qt.Vertical)
22 | slider.setMinimum(0)
23 | slider.setMaximum(100)
24 | slider.setFixedSize(10, height)
25 | slider_layout.addWidget(slider)
26 | popup_layout.addWidget(slider_frame)
27 |
28 | data.ui.add_label(popup_layout, '0', props).setFixedHeight(25)
29 |
30 | data.ui.add_show_event(popup, lambda _: slider.setValue(data.props[vol_key]))
31 |
32 | def handle_slider(_):
33 | data.props[vol_key] = slider.value()
34 | set_vol(data.props[vol_key])
35 |
36 | slider.mouseReleaseEvent = handle_slider
37 |
38 | return popup
39 |
--------------------------------------------------------------------------------
/src/tools.py:
--------------------------------------------------------------------------------
1 | from subprocess import PIPE, run
2 | import json
3 | import time
4 |
5 |
6 | def time_fmt(fmt):
7 | '''
8 | Formats the current time with the given format
9 | :param fmt: The format to use
10 | '''
11 | return time.strftime(fmt)
12 |
13 |
14 | def get_weather(zip_code):
15 | '''
16 | Gets the current weather temperature for the given zip code
17 | :param zip_code: The zip code of the area to query at
18 | '''
19 | yql_api = 'https://query.yahooapis.com/v1/public/yql?'
20 | query = 'q=select wind.chill from weather.forecast where woeid in ' \
21 | '(select woeid from geo.places(1) where text="%s")&format=json'
22 | query_url = yql_api + (query % (zip_code)).replace(' ', '%20')
23 | json = load_json(term('curl "%s"' % (query_url)))
24 | return json['query']['results']['channel']['wind']['chill']
25 |
26 |
27 | def load_json(json_data):
28 | '''
29 | A json.loads alias
30 | :param json_data: The json string to load
31 | '''
32 | return json.loads(json_data)
33 |
34 |
35 | def term(command):
36 | '''
37 | Executes the given command and returns its output
38 | :param command: The command to run
39 | '''
40 | result = run(command, stdout=PIPE, stderr=PIPE,
41 | universal_newlines=True, shell=True)
42 | return result.stdout.strip()
43 |
44 |
45 | def multi_apply(func, args):
46 | '''
47 | Applies the given function over a tuple of arguments
48 | :param func: The function/lambda to execute
49 | :param args: The tuple of arguments to execute the function over
50 | '''
51 | for arg in args:
52 | func(arg)
53 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 | local_settings.py
56 |
57 | # Flask stuff:
58 | instance/
59 | .webassets-cache
60 |
61 | # Scrapy stuff:
62 | .scrapy
63 |
64 | # Sphinx documentation
65 | docs/_build/
66 |
67 | # PyBuilder
68 | target/
69 |
70 | # Jupyter Notebook
71 | .ipynb_checkpoints
72 |
73 | # pyenv
74 | .python-version
75 |
76 | # celery beat schedule file
77 | celerybeat-schedule
78 |
79 | # SageMath parsed files
80 | *.sage.py
81 |
82 | # dotenv
83 | .env
84 |
85 | # virtualenv
86 | .venv
87 | venv/
88 | ENV/
89 |
90 | # Spyder project settings
91 | .spyderproject
92 | .spyproject
93 |
94 | # Rope project settings
95 | .ropeproject
96 |
97 | # mkdocs documentation
98 | /site
99 |
100 | # mypy
101 | .mypy_cache/
102 |
103 | # custom
104 | *.swp
105 |
--------------------------------------------------------------------------------
/res/arch-logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/src/modules/linux.py:
--------------------------------------------------------------------------------
1 | import tools
2 |
3 |
4 | def logout():
5 | '''
6 | Logs out of the current user
7 | '''
8 | return tools.term('pkill -u $USER')
9 |
10 |
11 | def get_cpu_percent():
12 | '''
13 | Gets the current CPU percent
14 | '''
15 | return tools.term("vmstat 1 2 | tail -1 | awk '{print 100-$15}'")
16 |
17 |
18 | def get_cpu_temp():
19 | '''
20 | Gets the current CPU temperature
21 | '''
22 | temp_str = tools.term('cat /sys/class/thermal/thermal_zone0/temp')
23 | return int((int(temp_str) if len(temp_str) else -1000) / 1000)
24 |
25 |
26 | def get_mem_used():
27 | '''
28 | Gets the current amount of memory being used
29 | '''
30 | txt = tools.term('vmstat -s | egrep -m2 -o "[0-9]+" | tail -1')
31 | return int(int(txt) / 1000)
32 |
33 |
34 | def get_network_ssid():
35 | '''
36 | Gets the currently connected network SSID
37 | '''
38 | return tools.term('iwgetid -r')
39 |
40 |
41 | def get_battery_capacity():
42 | '''
43 | Gets the current battery capacity
44 | '''
45 | cap_str = tools.term('cat /sys/class/power_supply/BAT0/capacity')
46 | return int(cap_str) if len(cap_str) else -1
47 |
48 |
49 | def get_battery_state():
50 | '''
51 | Gets the battery state (Charging, Not Charging)
52 | '''
53 | return tools.term('cat /sys/class/power_supply/BAT0/status')
54 |
55 |
56 | def get_active_window_name():
57 | '''
58 | Gets the active window name/title
59 | '''
60 | return tools.term('xdotool getwindowfocus getwindowname')
61 |
62 |
63 | def get_workspace():
64 | '''
65 | Gets the current workspace number
66 | '''
67 | workspace = tools.term('xprop -root _NET_CURRENT_DESKTOP | grep -o "[0-9]*"')
68 | return int(workspace) if len(workspace) else 0
69 |
70 |
71 | def get_user():
72 | '''
73 | Gets the currently logged in user's username
74 | '''
75 | return tools.term('id -u -n')
76 |
77 |
78 | def get_alsa_volume():
79 | '''
80 | Gets the volume level reported by alsamixer
81 | '''
82 | txt = tools.term('amixer sget Master | egrep -o "[0-9]+%" | head -1')
83 | txt = txt.replace('%', '')
84 | return int(txt)
85 |
86 |
87 | def set_alsa_volume(percent):
88 | '''
89 | Sets the volume level using alsamixer
90 | :param percent: The volume percent to set to
91 | '''
92 | return tools.term("amixer sset 'Master' %s%%" % (percent))
93 |
--------------------------------------------------------------------------------
/src/gr8bar.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import threading
4 | import time
5 | import types
6 |
7 | from PyQt5 import QtCore, QtWidgets
8 |
9 | from modules import sound, network, linux, gallium_os
10 | import ui
11 | import tools
12 |
13 |
14 | sys.path.append(os.path.dirname(sys.argv[1]))
15 | cfg = __import__(os.path.basename(sys.argv[1].replace('.py', '')))
16 |
17 | app = QtWidgets.QApplication([])
18 |
19 | window = QtWidgets.QWidget()
20 | window.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint |
21 | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool |
22 | QtCore.Qt.X11BypassWindowManagerHint)
23 |
24 | bounds = cfg.bounds()
25 | window.move(bounds['x'], bounds['y'])
26 | window.setFixedSize(bounds['w'] if 'w' in bounds else bounds['width'],
27 | bounds['h'] if 'h' in bounds else bounds['height'])
28 |
29 | window_layout = ui.hbox_layout(window)
30 |
31 | properties = {}
32 |
33 | modules = types.SimpleNamespace(sound=sound, network=network, linux=linux,
34 | gallium_os=gallium_os)
35 |
36 | data = types.SimpleNamespace(app=app, panel=window, layout=window_layout,
37 | ui=ui, os=os, tools=tools, props=properties,
38 | modules=modules)
39 |
40 |
41 | def render():
42 | '''
43 | Renders the bar from the given configuration file
44 | '''
45 | ui.clear_layout(window_layout)
46 | cfg.config(data)
47 |
48 | window.ensurePolished()
49 |
50 | bg = window.palette().color(window.backgroundRole())
51 | if bg == QtCore.Qt.transparent:
52 | window.setAttribute(QtCore.Qt.WA_TranslucentBackground)
53 | window.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
54 |
55 |
56 | def run_updater(updater, tools, modules, properties):
57 | '''
58 | Runs an updater with the fed tools and properties
59 | :param updater: The updater to run
60 | :param tools: The tools api wrapper
61 | :param properties: The properties that the updater maintains
62 | '''
63 | while True:
64 | updater[0](tools, modules, properties)
65 | time.sleep(updater[1])
66 |
67 |
68 | if __name__ == "__main__":
69 | updaters = cfg.init_prop_updaters()
70 | for updater in updaters:
71 | threading.Thread(target=run_updater,
72 | args=(updater, tools, modules, properties,)).start()
73 | timer = QtCore.QTimer()
74 | timer.timeout.connect(render)
75 | timer.start(cfg.render_loop_delay())
76 | render()
77 | window.show()
78 | app.exec_()
79 |
--------------------------------------------------------------------------------
/test/surreal/workspace-complete.py:
--------------------------------------------------------------------------------
1 | panel_bg = 'transparent'
2 | panel_border = 'none'
3 |
4 | real_panel_bg = '#383c4a'
5 | active_panel_bg = '#626777'
6 |
7 | icon_color = '#e6e6e6'
8 |
9 | text_css = {
10 | 'css': {
11 | 'color': icon_color,
12 | 'background-color': real_panel_bg,
13 | 'font-size': '14px',
14 | 'font-family': 'Hack, FontAwesome'
15 | }
16 | }
17 |
18 | key_workspace = 'workspace_number'
19 | key_window_title = 'window_title'
20 | key_user = 'sys_user'
21 |
22 | def bounds():
23 | return {'x': 65, 'y': 1032, 'w': 1791, 'h': 34}
24 |
25 |
26 | def render_loop_delay():
27 | return 1000
28 |
29 |
30 | def init_prop_updaters():
31 | return [(update_workspace, 0.05), (update_window_title, 1.5),
32 | (update_welcome, 60)]
33 |
34 |
35 | def config(data):
36 | data.ui.set_bg(data.panel, panel_bg)
37 | data.ui.set_border(data.panel, panel_border)
38 | render_workspace(data)
39 | data.layout.addStretch(1)
40 | render_window_title(data)
41 | data.layout.addStretch(1)
42 | render_welcome(data)
43 |
44 |
45 | def render_workspace(data):
46 | workspace = data.props.get(key_workspace, 0)
47 | # code term notes busy
48 | workspace_labels = ['', '', '', '']
49 | # render all workspaces with their respective labels
50 | for idx, lbl in enumerate(workspace_labels):
51 | first_type = None
52 | last_type = None
53 | if idx == 0:
54 | first_type = 'lui'
55 | last_type = 'rd'
56 | elif idx == len(workspace_labels) - 1:
57 | first_type = 'lui'
58 | last_type = 'rd'
59 | elif idx % 2 == 0:
60 | first_type = 'lu'
61 | last_type = 'rd'
62 | else:
63 | first_type = 'lui'
64 | last_type = 'ru'
65 | bg_color = active_panel_bg if idx == workspace else real_panel_bg
66 | data.ui.add_slant(data.layout, first_type, bg_color)
67 | label = data.ui.add_label(data.layout, ' %s ' % (lbl), text_css)
68 | data.ui.set_bg(label, bg_color)
69 | data.ui.add_slant(data.layout, last_type, bg_color)
70 |
71 |
72 | def render_window_title(data):
73 | window_title = data.props.get(key_window_title, data.os.name)
74 | if len(window_title) > 130:
75 | window_title = window_title[:130] + '...'
76 |
77 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
78 | data.ui.add_label(data.layout, ' %s ' % (window_title), text_css)
79 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
80 |
81 |
82 | def render_welcome(data):
83 | user = data.props.get(key_user, '?')
84 |
85 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
86 | data.ui.add_label(data.layout, '', text_css)
87 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
88 |
89 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
90 | data.ui.add_label(data.layout, ' %s ' % (user), text_css)
91 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
92 |
93 | # Update functions below
94 |
95 | def update_workspace(tools, modules, props):
96 | props[key_workspace] = modules.linux.get_workspace()
97 |
98 |
99 | def update_window_title(tools, modules, props):
100 | props[key_window_title] = modules.linux.get_active_window_name()
101 |
102 |
103 | def update_welcome(tools, modules, props):
104 | props[key_user] = modules.linux.get_user()
105 |
--------------------------------------------------------------------------------
/src/modules/network.py:
--------------------------------------------------------------------------------
1 | import re
2 | from collections import namedtuple
3 |
4 | from PyQt5 import QtWidgets
5 |
6 | import tools
7 |
8 | Network = namedtuple('Network', ['ssid', 'signal', 'security'])
9 | NetPopup = namedtuple('NetPopup', ['window', 'layout', 'prompt'])
10 |
11 | default_bg = '#343f5a'
12 | default_bg_hover = '#232a3d'
13 |
14 | nmcli_table_regex = str.join('', (
15 | '(.*)\s+(\w+)\s+([0-9]+)\s+([0-9]+)\s+Mbit\/s',
16 | '\s+([0-9]+)\s+[^a-zA-Z0-9\s:]+\s+([\w\s]+)'
17 | ))
18 |
19 |
20 | def connect(ssid, pswd):
21 | return tools.term("nmcli device wifi connect '%s' password '%s'" % (ssid, pswd))
22 |
23 |
24 | def listing():
25 | return parse_listing(tools.term('nmcli dev wifi'))
26 |
27 |
28 | def parse_listing(output):
29 | listing = []
30 | if len(output):
31 | lines = output.split('\n') # non-secure networks end with lines..
32 | # don't #strip() it, #strip() matches.
33 | for line in lines:
34 | if not line.strip().startswith('*'):
35 | matches = re.match(nmcli_table_regex, line)
36 | if matches:
37 | ssid = matches.group(1).strip()
38 | signal = matches.group(5).strip()
39 | security = matches.group(6).strip()
40 | if not len(security):
41 | security = None
42 | listing.append(Network(ssid, signal, security))
43 | return listing
44 |
45 |
46 | def create_prompt(data, props, on_connect):
47 | width = props['item_width'] if 'item_width' in props else 300
48 | bg = props['bg_hover'] if 'bg_hover' in props else default_bg_hover
49 | popup = data.ui.create_popup(width, 0, bg)
50 | popup_layout = data.ui.vbox_layout(popup)
51 |
52 | frame = QtWidgets.QFrame()
53 | f_layout = data.ui.hbox_layout(frame)
54 | f_layout.setContentsMargins(10, 10, 10, 10)
55 |
56 | label = props['chosen_ssid'] if 'chosen_ssid' in props else 'Password'
57 |
58 | data.ui.add_label(f_layout, '%s: ' % (label), {
59 | **props, **{'alignment': 'left'}
60 | })
61 |
62 | pass_input = QtWidgets.QLineEdit()
63 | pass_input.setStyleSheet(data.ui.dict_to_sheet(props['css']))
64 |
65 | def handle_pass_input(e):
66 | code = e.key()
67 | if code == 16777220: # enter
68 | connect(props['chosen_ssid'], pass_input.text())
69 | popup.hide()
70 | if on_connect:
71 | on_connect()
72 | elif code == 16777216: # escape
73 | popup.hide()
74 |
75 | pass_input.keyReleaseEvent = handle_pass_input
76 |
77 | data.ui.apply_tree_callback(frame, lambda x: data.ui.set_bg(x, bg))
78 |
79 | def reset_input(_):
80 | pass_input.setText('')
81 | pass_input.setFocus()
82 |
83 | data.ui.add_show_event(popup, reset_input)
84 |
85 | f_layout.addWidget(pass_input)
86 | popup_layout.addWidget(frame)
87 | return popup
88 |
89 | def create_popup(data, props):
90 | width = props['item_width'] if 'item_width' in props else 300
91 | bg = props['bg'] if 'bg' in props else default_bg
92 | popup = data.ui.create_popup(width, 0, bg)
93 | popup_layout = data.ui.vbox_layout(popup)
94 | prompt = create_prompt(data, props, lambda: popup.hide())
95 | data.ui.add_show_event(prompt, lambda _: prompt.activateWindow())
96 | data.ui.add_hide_event(popup, lambda _: prompt.hide())
97 | data.ui.add_show_event(popup, lambda _: update_popup_layout(data, props,
98 | popup_layout, prompt))
99 | return NetPopup(popup, popup_layout, prompt)
100 |
101 |
102 | def update_popup_layout(data, props, popup_layout, prompt):
103 | data.ui.clear_layout(popup_layout)
104 | # output_file = data.ui.res(__file__, '../../res/test/nmcli-output.txt')
105 | # output_text = data.tools.term('cat ' + output_file)
106 | # networks = data.modules.network.parse_listing(output_text)
107 | networks = listing()
108 | for network in networks:
109 | _add_network_entry(data.ui, network, popup_layout, prompt, props)
110 |
111 |
112 | def _add_network_entry(ui, network, popup_layout, prompt, props):
113 | frame = QtWidgets.QFrame()
114 | width = props['item_width'] if 'item_width' in props else 300
115 | height = props['item_height'] if 'item_height' in props else 34
116 | bg = props['bg'] if 'bg' in props else default_bg
117 | bg_hover = props['bg_hover'] if 'bg_hover' in props else default_bg_hover
118 | frame.setFixedSize(width, height)
119 | f_layout = ui.hbox_layout(frame)
120 | f_layout.setContentsMargins(10, 10, 10, 10)
121 | ui.add_label(f_layout, network.ssid, {
122 | **props, **{'alignment': 'left'}
123 | })
124 | f_layout.addStretch(1)
125 | lock = '' if network.security is not None else ''
126 | ui.add_label(f_layout, ' ', props)
127 | ui.add_label(f_layout, ' %s' % (lock), props)
128 | def handle_enter(_):
129 | props['chosen_ssid'] = network.ssid
130 | ui.apply_tree_callback(frame, lambda x: ui.set_bg(x, bg_hover))
131 | def handle_exit(_):
132 | ui.apply_tree_callback(frame, lambda x: ui.set_bg(x, bg))
133 | ui.add_hover_event(frame, handle_enter, handle_exit)
134 | ui.add_click_popup(frame, prompt, 'right', (0, -height))
135 | popup_layout.addWidget(frame)
136 |
--------------------------------------------------------------------------------
/test/bluebird/top.py:
--------------------------------------------------------------------------------
1 | from PyQt5 import QtCore, QtGui, QtWidgets
2 |
3 | panel_bg = '#1a2740'
4 | panel_border = 'none'
5 | item_bg = '#343f5a'
6 | item_bg_hover = '#232a3d'
7 | icon_color = '#c1d281'
8 | text_color = '#34a764'
9 |
10 | icon_css = {
11 | 'css': {
12 | 'color': icon_color,
13 | 'background-color': item_bg,
14 | 'font-size': '14px',
15 | 'font-family': 'Hack, FontAwesome'
16 | }
17 | }
18 |
19 | text_css = {
20 | 'css': {
21 | 'color': text_color,
22 | 'background-color': item_bg,
23 | 'font-size': '14px',
24 | 'font-family': 'Hack, FontAwesome'
25 | }
26 | }
27 |
28 | popup_props = {
29 | 'bg': item_bg,
30 | 'bg_hover': item_bg_hover,
31 | 'css': {
32 | 'color': '#c1c1c1',
33 | 'background-color': item_bg,
34 | 'font-size': '14px',
35 | 'font-family': 'Hack, FontAwesome'
36 | }
37 | }
38 |
39 | network_popup_props = {
40 | 'item_width': 300,
41 | 'item_height': 34,
42 | **popup_props
43 | }
44 |
45 | volume_popup_props = {
46 | 'item_width': 45,
47 | 'item_height': 130,
48 | **popup_props
49 | }
50 |
51 |
52 | def bounds():
53 | return {'x': 0, 'y': 0, 'w': 1920, 'h': 26}
54 |
55 |
56 | def render_loop_delay():
57 | return 1000
58 |
59 |
60 | def init_prop_updaters():
61 | return []
62 |
63 |
64 | def config(data):
65 | data.ui.set_bg(data.panel, panel_bg)
66 | data.ui.set_border(data.panel, panel_border)
67 | render_logo(data, data.tools, data.ui)
68 | render_cpu(data, data.tools, data.ui)
69 | render_mem(data, data.tools, data.ui)
70 | data.layout.addStretch(1)
71 | render_time(data, data.tools, data.ui)
72 | render_weather(data, data.tools, data.ui)
73 | data.layout.addStretch(1)
74 | render_network(data, data.tools, data.ui)
75 | render_battery(data, data.tools, data.ui)
76 | render_volume(data, data.tools, data.ui)
77 | render_power(data, data.tools, data.ui)
78 |
79 |
80 | def show_hover(data, item, key):
81 | data.ui.show_hover(item, item_bg, item_bg_hover, data.props, key)
82 |
83 |
84 | def render_logo(data, tools, ui):
85 | logo_path = '../../res/ubuntu-logo-sm.svg'
86 | logo = ui.add_image(data.layout, __file__, logo_path, 10, icon_color)
87 | ui.set_bg(logo, item_bg)
88 | ui.add_border_line(logo, '#ea822c', 2)
89 |
90 |
91 | def render_cpu(data, tools, ui):
92 | tools.multi_apply(lambda x: ui.add_border_line(x, '#c9e3d3', 2), (
93 | ui.add_label(data.layout, ' ', icon_css),
94 | ui.add_label(data.layout, ' 6%', text_css),
95 | ))
96 | tools.multi_apply(lambda x: ui.add_border_line(x, '#9579c6', 2), (
97 | ui.add_label(data.layout, ' ', icon_css),
98 | ui.add_label(data.layout, ' 23° C', text_css),
99 | ))
100 |
101 |
102 | def render_mem(data, tools, ui):
103 | tools.multi_apply(lambda x: ui.add_border_line(x, '#50a05b', 2), (
104 | ui.add_label(data.layout, ' ', icon_css),
105 | ui.add_label(data.layout, ' 419MB ', text_css),
106 | ))
107 |
108 | def render_time(data, tools, ui):
109 | tools.multi_apply(lambda x: ui.add_border_line(x, '#228b97', 2), (
110 | ui.add_label(data.layout, ' ', icon_css),
111 | ui.add_label(data.layout, ' 10/6/2017', text_css),
112 | ))
113 | tools.multi_apply(lambda x: ui.add_border_line(x, '#228b97', 2), (
114 | ui.add_label(data.layout, ' ', icon_css),
115 | ui.add_label(data.layout, ' 5:12 AM', text_css),
116 | ))
117 |
118 |
119 | def render_weather(data, tools, ui):
120 | tools.multi_apply(lambda x: ui.add_border_line(x, '#228b97', 2), (
121 | ui.add_label(data.layout, ' ', icon_css),
122 | ui.add_label(data.layout, ' 84° F ', text_css),
123 | ))
124 |
125 |
126 | def render_network(data, tools, ui):
127 | # connected =
128 | # disconnected =
129 | comps = (
130 | ui.add_label(data.layout, ' ', icon_css),
131 | ui.add_label(data.layout, ' CentHub ', text_css)
132 | )
133 | tools.multi_apply(lambda x: ui.add_border_line(x, '#50a05b', 2), comps)
134 | if not 'network_popup' in data.props:
135 | popup = data.modules.network.create_popup(data, network_popup_props)
136 | data.props['network_popup'] = popup
137 | popup = data.props['network_popup']
138 | ui.add_click_popup(comps[1], popup.window, 'right', (0, 0))
139 |
140 |
141 | def render_battery(data, tools, ui):
142 | tools.multi_apply(lambda x: ui.add_border_line(x, '#9579c6', 2), (
143 | ui.add_label(data.layout, ' ', icon_css),
144 | ui.add_label(data.layout, ' 100% ', text_css),
145 | ))
146 |
147 |
148 | def render_volume(data, tools, ui):
149 | # high =
150 | # low-mid =
151 | # muted =
152 | volume = ui.add_label(data.layout, ' ', icon_css)
153 | ui.add_border_line(volume, '#c9e3d3', 2)
154 | show_hover(data, volume, 'vol_hover_bg')
155 | if not 'volume_popup' in data.props:
156 | popup = data.modules.sound.create_popup(data, volume_popup_props)
157 | data.props['volume_popup'] = popup
158 | popup = data.props['volume_popup']
159 | ui.add_click_popup(volume, popup, 'center', (0, 0))
160 |
161 |
162 | def render_power(data, tools, ui):
163 | power = ui.add_label(data.layout, ' ', icon_css)
164 | ui.add_border_line(power, '#ea822c', 2)
165 | show_hover(data, power, 'power_hover_bg')
166 |
--------------------------------------------------------------------------------
/test/config.py:
--------------------------------------------------------------------------------
1 | panel_bg = 'transparent'
2 | panel_border = 'none'
3 | real_panel_bg = '#232631'
4 | icon_color = '#e6e6e6'
5 |
6 | text_css = {
7 | 'css': {
8 | 'color': icon_color,
9 | 'background-color': real_panel_bg,
10 | 'font-size': '14px',
11 | 'font-family': 'Hack, FontAwesome'
12 | }
13 | }
14 |
15 |
16 | def bounds():
17 | return {'x': 65, 'y': 15, 'w': 1791, 'h': 34}
18 |
19 |
20 | def render_loop_delay():
21 | return 1000
22 |
23 |
24 | def init_prop_updaters():
25 | return []
26 |
27 |
28 | def config(data):
29 | data.ui.set_bg(data.panel, panel_bg)
30 | data.ui.set_border(data.panel, panel_border)
31 | render_logo(data)
32 | data.layout.addStretch(1)
33 | render_cpu(data)
34 | render_mem(data)
35 | data.layout.addStretch(1)
36 | render_time(data)
37 | render_weather(data)
38 | data.layout.addStretch(1)
39 | render_network(data)
40 | render_volume(data)
41 | render_battery(data)
42 | data.layout.addStretch(1)
43 | render_power(data)
44 |
45 |
46 | def render_logo(data):
47 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
48 | lbl = data.ui.add_image(data.layout, __file__, '../res/ubuntu-logo.svg', 4)
49 | data.ui.recolor_pixmap(lbl.pixmap(), icon_color)
50 | data.ui.set_bg(lbl, real_panel_bg)
51 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
52 |
53 |
54 | def render_cpu(data):
55 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
56 | data.ui.add_label(data.layout, '', text_css) # cpu
57 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
58 |
59 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
60 | data.ui.add_label(data.layout, ' 3% ', text_css)
61 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
62 |
63 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
64 | data.ui.add_label(data.layout, '', text_css) # temp
65 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
66 |
67 | data.ui.add_slant(data.layout, 'lu', real_panel_bg)
68 | data.ui.add_label(data.layout, ' 20C ', text_css)
69 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
70 |
71 |
72 |
73 | def render_mem(data):
74 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
75 | data.ui.add_label(data.layout, '', text_css) # mem
76 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
77 |
78 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
79 | data.ui.add_label(data.layout, ' 786mb ', text_css)
80 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
81 |
82 | def render_time(data):
83 | # if not 'cal_window' in data.props:
84 | # window = data.ui.create_popup(300, 100, '#ff0000')
85 | # data.props['cal_window'] = window
86 | # data.tools.multi_apply(lambda x: data.ui.add_border_line(x, '#FFFFFF', 4), (
87 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
88 | cal = data.ui.add_label(data.layout, '', text_css) # calendar
89 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
90 | # data.ui.add_click_popup(cal, data.props['cal_window'], 'right')
91 | # ))
92 |
93 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
94 | data.ui.add_label(data.layout, ' 9/23/2017 ', text_css)
95 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
96 |
97 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
98 | data.ui.add_label(data.layout, '', text_css) # clock
99 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
100 |
101 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
102 | data.ui.add_label(data.layout, ' 12:33 AM ', text_css)
103 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
104 |
105 |
106 | def render_weather(data):
107 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
108 | data.ui.add_label(data.layout, '', text_css) # wifi
109 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
110 |
111 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
112 | data.ui.add_label(data.layout, ' 82° F ', text_css)
113 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
114 |
115 |
116 | def render_network(data):
117 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
118 | data.ui.add_label(data.layout, '', text_css) # wifi
119 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
120 |
121 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
122 | data.ui.add_label(data.layout, ' CentHub ', text_css)
123 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
124 |
125 |
126 | def render_volume(data):
127 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
128 | data.ui.add_label(data.layout, '', text_css) # volume
129 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
130 |
131 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
132 | data.ui.add_label(data.layout, ' 100% ', text_css)
133 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
134 |
135 |
136 | def render_battery(data):
137 | battery_text = '100%'
138 |
139 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
140 | data.ui.add_label(data.layout, '', text_css) # battery
141 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
142 |
143 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
144 | data.ui.add_label(data.layout, battery_text, text_css)
145 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
146 |
147 | if True: #charging
148 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
149 | data.ui.add_label(data.layout, '', text_css) # bolt
150 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
151 |
152 |
153 | def render_power(data):
154 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
155 | data.ui.add_label(data.layout, ' ', text_css) # power
156 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
157 |
--------------------------------------------------------------------------------
/test/surreal/config-complete.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 | zip_code = 85224
4 |
5 | panel_bg = 'transparent'
6 | panel_border = 'none'
7 |
8 | real_panel_bg = '#383c4a'
9 | real_panel_bg_hover = '#555a6d'
10 |
11 | icon_color = '#e6e6e6'
12 |
13 | text_css = {
14 | 'css': {
15 | 'color': icon_color,
16 | 'background-color': real_panel_bg,
17 | 'font-size': '14px',
18 | 'font-family': 'Hack, FontAwesome'
19 | }
20 | }
21 |
22 | popup_props = {
23 | 'bg': real_panel_bg,
24 | 'bg_hover': real_panel_bg_hover,
25 | **text_css
26 | }
27 |
28 | net_popup_props = {
29 | 'item_width': 300,
30 | 'item_height': 34,
31 | **popup_props
32 | }
33 |
34 | vol_popup_props = {
35 | 'item_width': 40,
36 | 'item_height': 130,
37 | **popup_props
38 | }
39 |
40 |
41 | key_date_text = 'date_text'
42 | key_weather_temp = 'weather_temp'
43 | key_cpu_percent = 'cpu_percent'
44 | key_cpu_temp = 'cpu_temp'
45 | key_mem_used = 'mem_used'
46 | key_network_ssid = 'network_ssid'
47 | key_volume = 'volume'
48 | key_battery_cap = 'battery_cap'
49 | key_battery_state = 'battery_state'
50 | key_battery1_cap = 'battery1_cap'
51 | key_battery1_state = 'battery1_state'
52 | key_net_popup = 'net_popup'
53 | key_vol_popup = 'vol_popup'
54 |
55 | def bounds():
56 | return {'x': 65, 'y': 15, 'w': 1791, 'h': 34}
57 |
58 |
59 | def render_loop_delay():
60 | return 1000
61 |
62 |
63 | def init_prop_updaters():
64 | return [(update_cpu, 5), (update_mem, 5), (update_battery, 30),
65 | (update_weather, 60 * 10), (update_network, 30), (update_volume, 1)]
66 |
67 |
68 | def config(data):
69 | data.ui.set_bg(data.panel, panel_bg)
70 | data.ui.set_border(data.panel, panel_border)
71 | render_logo(data)
72 | data.layout.addStretch(1)
73 | render_cpu(data)
74 | render_mem(data)
75 | data.layout.addStretch(1)
76 | render_time(data)
77 | render_weather(data)
78 | data.layout.addStretch(1)
79 | render_network(data)
80 | render_volume(data)
81 | render_battery(data)
82 | data.layout.addStretch(1)
83 | render_power(data)
84 |
85 |
86 | def render_logo(data):
87 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
88 | lbl = data.ui.add_image(data.layout, __file__, '../../res/arch-logo.svg', 10)
89 | data.ui.recolor_pixmap(lbl.pixmap(), icon_color)
90 | data.ui.set_bg(lbl, real_panel_bg)
91 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
92 |
93 |
94 | def render_cpu(data):
95 | cpu_percent = data.props.get(key_cpu_percent, '*')
96 | cpu_temp = data.props.get(key_cpu_temp, '*')
97 |
98 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
99 | data.ui.add_label(data.layout, '', text_css) # cpu
100 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
101 |
102 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
103 | data.ui.add_label(data.layout, ' %s%% ' % (cpu_percent), text_css)
104 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
105 |
106 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
107 | data.ui.add_label(data.layout, '', text_css) # temp
108 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
109 |
110 | data.ui.add_slant(data.layout, 'lu', real_panel_bg)
111 | data.ui.add_label(data.layout, ' %s° C ' % (cpu_temp), text_css)
112 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
113 |
114 |
115 | def render_mem(data):
116 | mem = data.props.get(key_mem_used, '*')
117 |
118 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
119 | data.ui.add_label(data.layout, '', text_css) # mem
120 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
121 |
122 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
123 | data.ui.add_label(data.layout, ' %sMB ' % (mem), text_css)
124 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
125 |
126 |
127 | def render_time(data):
128 | _date = data.tools.time_fmt('%m/%d/%Y')
129 | _time = data.tools.time_fmt('%I:%M %p')
130 | date_txt = ' %s ' % (_date)
131 | def date_hov_txt():
132 | return ' %s ' % (data.tools.time_fmt('%A'))
133 |
134 | data.ui.add_slant(data.layout, 'lui', real_panel_bg),
135 | data.ui.add_label(data.layout, '', text_css), # calendar
136 | data.ui.add_slant(data.layout, 'ru', real_panel_bg),
137 |
138 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
139 | date_label = data.ui.add_label(data.layout, None, text_css)
140 | data.ui.add_label_hover(date_label, date_txt, date_hov_txt,
141 | data.props, key_date_text)
142 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
143 |
144 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
145 | data.ui.add_label(data.layout, '', text_css) # clock
146 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
147 |
148 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
149 | data.ui.add_label(data.layout, ' %s ' % (_time), text_css)
150 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
151 |
152 |
153 | def render_weather(data):
154 | temp = data.props.get(key_weather_temp, '*')
155 |
156 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
157 | data.ui.add_label(data.layout, '', text_css) # cloud
158 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
159 |
160 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
161 | data.ui.add_label(data.layout, ' %s° F ' % (temp), text_css)
162 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
163 |
164 |
165 | def render_network(data):
166 | ssid = data.props.get(key_network_ssid, '?')
167 |
168 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
169 | data.ui.add_label(data.layout, '', text_css) # wifi
170 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
171 |
172 | ssl = data.ui.add_slant(data.layout, 'ld', real_panel_bg)
173 | ssid_label = data.ui.add_label(data.layout, ' %s ' % (ssid), text_css)
174 | slr = data.ui.add_slant(data.layout, 'rd', real_panel_bg)
175 |
176 | comps = (ssl, ssid_label, slr)
177 |
178 | if not key_net_popup in data.props:
179 | popup = data.modules.network.create_popup(data, net_popup_props)
180 | data.props[key_net_popup] = popup
181 |
182 | popup = data.props[key_net_popup]
183 | data.ui.add_click_popup(ssid_label, popup.window, 'center', (0, 0))
184 |
185 |
186 |
187 | def render_volume(data):
188 | volume = data.props.get(key_volume, '0%')
189 |
190 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
191 | data.ui.add_label(data.layout, '', text_css) # volume
192 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
193 |
194 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
195 | vol_label = data.ui.add_label(data.layout, ' %s%% ' % (volume), text_css)
196 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
197 |
198 | if not key_vol_popup in data.props:
199 | set_vol = lambda v: data.modules.linux.set_alsa_volume(v)
200 | popup = data.modules.sound.create_popup(data, vol_popup_props,
201 | key_volume, set_vol)
202 | data.props[key_vol_popup] = popup
203 |
204 | popup = data.props[key_vol_popup]
205 | data.ui.add_click_popup(vol_label, popup, 'center', (0, 0))
206 |
207 |
208 | def render_battery(data):
209 | cap = data.props.get(key_battery_cap, -1)
210 | cap1 = data.props.get(key_battery1_cap, -1)
211 | state = data.props.get(key_battery_state, 'Invalid')
212 | state1 = data.props.get(key_battery1_state, 'Invalid')
213 |
214 | # 0% 1-25% 26-50% 51-75% 76-100%
215 | battery_icons = ['', '', '', '', '']
216 | battery_icon = battery_icons[int(math.ceil(float(cap) / 25))]
217 | battery1_icon = battery_icons[int(math.ceil(float(cap1) / 25))]
218 |
219 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
220 | data.ui.add_label(data.layout, battery_icon, text_css) # battery
221 | data.ui.add_slant(data.layout, 'ru', real_panel_bg)
222 |
223 | data.ui.add_slant(data.layout, 'ld', real_panel_bg)
224 | data.ui.add_label(data.layout, 'E:%s%%' % (cap1), text_css)
225 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
226 |
227 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
228 | data.ui.add_label(data.layout, 'I:%s%%' % (cap), text_css)
229 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
230 |
231 | if state == 'Charging' or state1 == 'Charging':
232 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
233 | data.ui.add_label(data.layout, '', text_css) # bolt
234 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
235 |
236 |
237 | def render_power(data):
238 | data.ui.add_slant(data.layout, 'lui', real_panel_bg)
239 | lbl = data.ui.add_label(data.layout, ' ', text_css) # power
240 | data.ui.add_click_event(lbl, lambda _: data.modules.linux.logout())
241 | data.ui.add_slant(data.layout, 'rd', real_panel_bg)
242 |
243 | # Update functions below
244 |
245 | def update_cpu(tools, modules, props):
246 | props[key_cpu_percent] = modules.linux.get_cpu_percent()
247 | props[key_cpu_temp] = modules.linux.get_cpu_temp()
248 |
249 |
250 | def update_mem(tools, modules, props):
251 | props[key_mem_used] = modules.linux.get_mem_used()
252 |
253 |
254 | def update_weather(tools, modules, props):
255 | props[key_weather_temp] = tools.get_weather(zip_code)
256 |
257 |
258 | def update_network(tools, modules, props):
259 | props[key_network_ssid] = modules.linux.get_network_ssid()
260 |
261 |
262 | def update_volume(tools, modules, props):
263 | props[key_volume] = modules.linux.get_alsa_volume()
264 |
265 |
266 | def update_battery(tools, modules, props):
267 | bat1 = tools.term('cat /sys/class/power_supply/BAT1/capacity')
268 | bat1_state = tools.term('cat /sys/class/power_supply/BAT1/status')
269 | props[key_battery_cap] = modules.linux.get_battery_capacity()
270 | props[key_battery_state] = modules.linux.get_battery_state()
271 | props[key_battery1_cap] = int(bat1)
272 | props[key_battery1_state] = bat1_state
273 |
--------------------------------------------------------------------------------
/src/ui.py:
--------------------------------------------------------------------------------
1 | import os
2 | import html
3 |
4 | from PyQt5 import QtCore, QtGui, QtWidgets
5 |
6 | def res(py_file, file):
7 | '''
8 | Fetches a resource relative to the given file path
9 | :param py_file: The relative path file, usually __file__
10 | :param file: The resource file to obtain
11 | '''
12 | return os.path.join(os.path.dirname(py_file), file)
13 |
14 |
15 | def toggle(widget):
16 | '''
17 | Toggles widget visibilitiy
18 | :param widget: The widget to hide or show
19 | '''
20 | if widget.isVisible():
21 | widget.hide()
22 | else:
23 | widget.show()
24 |
25 |
26 | def clear_layout(layout):
27 | '''
28 | Removes the children from the given layout
29 | :param layout: The layout to remove from
30 | '''
31 | while layout.count():
32 | child = layout.takeAt(0)
33 | if child.widget():
34 | child.widget().deleteLater()
35 |
36 |
37 | def apply_tree_callback(widget, callback):
38 | '''
39 | Applies the given callback to every widget in the hierarchy
40 | :param widget: The parent widget to start application at
41 | '''
42 | callback(widget)
43 | children = widget.children()
44 | for child in children:
45 | if isinstance(child, QtWidgets.QWidget):
46 | callback(child)
47 |
48 |
49 | def hbox_layout(window):
50 | '''
51 | Creates the deafult QHBoxLayout
52 | :param window: The window to create a layout for
53 | '''
54 | window_layout = QtWidgets.QHBoxLayout(window)
55 | window_layout.setContentsMargins(0, 0, 0, 0)
56 | window_layout.setSpacing(0)
57 | return window_layout
58 |
59 |
60 | def vbox_layout(window):
61 | '''
62 | Creates the deafult QHBoxLayout
63 | :param window: The window to create a layout for
64 | '''
65 | window_layout = QtWidgets.QVBoxLayout(window)
66 | window_layout.setContentsMargins(0, 0, 0, 0)
67 | window_layout.setSpacing(0)
68 | return window_layout
69 |
70 |
71 | def create_popup(width, height, hex_bg):
72 | '''
73 | Creates a blank popup window with the given arguments
74 | :param width: The width of the popup
75 | :param height: The height of the popup
76 | :param hex_bg: The background color of the popup
77 | '''
78 | window = QtWidgets.QWidget()
79 | window.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint |
80 | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool |
81 | QtCore.Qt.X11BypassWindowManagerHint)
82 | window.setFixedSize(width, height)
83 |
84 | set_bg(window, hex_bg)
85 | set_border(window, hex_bg)
86 | if hex_bg == 'transparent':
87 | window.setAttribute(QtCore.Qt.WA_TranslucentBackground)
88 | window.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
89 | return window
90 |
91 |
92 | def add_click_popup(parent, popup, alignment='center', offset=(0, 15)):
93 | '''
94 | Makes the given popup appear near the parent when the parent is clicked
95 | :param parent: The parent widget that the popup should be paired with
96 | :param popup: The popup to use
97 | :param alignment: The alignment of the popup (left, center, right)
98 | :param offset: An (x, y) tuple used for popup offset -- (0, 30) default
99 | '''
100 | def callback(_):
101 | toggle(popup)
102 | pt = parent.mapToGlobal(QtCore.QPoint(0, 0)) # absolute position
103 | x = pt.x()
104 | if alignment == 'center':
105 | x += (parent.width() / 2) - (popup.width() / 2)
106 | elif alignment == 'right':
107 | x -= (popup.width() - parent.width())
108 | x += offset[0]
109 | y = (pt.y() + parent.height() + offset[1])
110 | popup.move(x, y)
111 | add_click_event(parent, callback)
112 |
113 |
114 | def add_image(layout, file_path, image_path, padding_width=0, overlay=None):
115 | '''
116 | Appends an image to the layout
117 | :param layout: The layout to append to
118 | :param file_path: The path to the file dir
119 | :param image_path: The path to the image
120 | :param padding_width: The amount of extra space on each side of the image
121 | '''
122 | label = QtWidgets.QLabel()
123 | pixmap = QtGui.QPixmap(res(file_path, image_path))
124 | if overlay is not None:
125 | recolor_pixmap(pixmap, overlay)
126 | label.setPixmap(pixmap)
127 | label.setFixedWidth(pixmap.width() + padding_width)
128 | label.setAlignment(QtCore.Qt.AlignCenter)
129 | layout.addWidget(label)
130 | return label
131 |
132 |
133 | def add_slant(layout, slant_type, color):
134 | '''
135 | Appends a slant to the bar
136 | :param layout: The layout to append to
137 | :param slant_type: The type of slant (lu = left-up, ld = left-down,
138 | lui = left-up-inverted, ru = right-up, etc.)
139 | :param color: The hex-color that this slant should render as
140 | '''
141 | label = QtWidgets.QLabel()
142 | pixmap = QtGui.QPixmap(res(__file__, '../res/slant-%s.svg') % (slant_type))
143 | recolor_pixmap(pixmap, color)
144 | label.setPixmap(pixmap)
145 | label.setFixedWidth(pixmap.width())
146 | label.setAlignment(QtCore.Qt.AlignCenter)
147 | layout.addWidget(label)
148 | return label
149 |
150 |
151 | def add_label(layout, text, props={}):
152 | '''
153 | Appends a label with centered text to the bar
154 | :param layout: The layout to append to
155 | :param text: The text to render
156 | :param props: The properties or css values to use while rendering
157 | '''
158 | txt = QtWidgets.QLabel()
159 | set_text(txt, text)
160 | if 'width' in props:
161 | txt.setFixedWidth(props['width'])
162 | if 'css' in props:
163 | txt.setStyleSheet(dict_to_sheet(props['css']))
164 | if 'font-family' in props['css'] and 'font-size' in props['css']:
165 | family = props['css']['font-family']
166 | size = int(props['css']['font-size'].replace('px', ''))
167 | txt.setFont(QtGui.QFont(family, size))
168 | txt.setAlignment(QtCore.Qt.AlignCenter)
169 | if 'alignment' in props:
170 | if props['alignment'] == 'center':
171 | txt.setAlignment(QtCore.Qt.AlignCenter)
172 | elif props['alignment'] == 'left':
173 | txt.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft)
174 | elif props['alignment'] == 'right':
175 | txt.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignRight)
176 | layout.addWidget(txt)
177 | return txt
178 |
179 |
180 | def add_click_event(widget, callback):
181 | '''
182 | Adds a click event to the given widget
183 | :param widget: The widget to add a click event to
184 | :param callback: The callback to execute upon the event firing
185 | '''
186 | widget.mousePressEvent = callback
187 |
188 |
189 | def add_mouse_move_event(widget, move_callback):
190 | '''
191 | Adds a mouse move event to the given widget
192 | :param widget: The widget to add a click event to
193 | :param move_callback: The callback to execute upon the mouse moving
194 | '''
195 | widget.setMouseTracking(True)
196 | old_move = widget.mouseMoveEvent
197 | def override_move_event(evt):
198 | old_move(evt)
199 | if move_callback:
200 | move_callback(evt)
201 | widget.mouseMoveEvent = override_move_event
202 |
203 |
204 | def add_hover_event(widget, enter_callback, leave_callback):
205 | '''
206 | Adds a hover event to the given widget
207 | :param widget: The widget to add a click event to
208 | :param enter_callback: The callback to execute upon the hover start
209 | :param leave_callback: The callback to execute upon the hover end
210 | '''
211 | widget.setMouseTracking(True)
212 | old_enter = widget.enterEvent
213 | old_leave = widget.leaveEvent
214 | def override_enter_event(evt):
215 | old_enter(evt)
216 | if enter_callback:
217 | enter_callback(evt)
218 | def override_leave_event(evt):
219 | old_leave(evt)
220 | if leave_callback:
221 | leave_callback(evt)
222 | widget.enterEvent = override_enter_event
223 | widget.leaveEvent = override_leave_event
224 |
225 |
226 | def add_hide_event(widget, callback):
227 | '''
228 | Adds an event listener for when the given widget is hidden
229 | :param widget: The widget to listen for
230 | :param callback: The callback to execute when the widget is hidden
231 | '''
232 | old_event = widget.hideEvent
233 | def override_event(evt):
234 | old_event(evt)
235 | if callback:
236 | callback(evt)
237 | widget.hideEvent = override_event
238 |
239 |
240 | def add_show_event(widget, callback):
241 | '''
242 | Adds an event listener for when the given widget is hidden
243 | :param widget: The widget to listen for
244 | :param callback: The callback to execute when the widget is hidden
245 | '''
246 | old_event = widget.showEvent
247 | def override_event(evt):
248 | old_event(evt)
249 | if callback:
250 | callback(evt)
251 | widget.showEvent = override_event
252 |
253 |
254 | def show_hover(label, off_bg, on_bg, props, key):
255 | '''
256 | Displays the given label's background as the respective color when hovered
257 | :param label: The label to set the background of
258 | :param off_bg: The background color when not hovered
259 | :param on_bg: The background color when hovered
260 | :param props: The properties of the label
261 | :param key: A unique key for the given label
262 | '''
263 | if key in props:
264 | set_bg(label, props[key])
265 | def enter_func(_):
266 | set_bg(label, on_bg)
267 | props[key] = on_bg
268 | def exit_func(_):
269 | set_bg(label, off_bg)
270 | props[key] = off_bg
271 | add_hover_event(label, enter_func, exit_func)
272 |
273 |
274 | def add_label_hover(label, text, hover_callable, props, key):
275 | '''
276 | Adds a label hover event to the given label
277 | :param label: The label to add an event to
278 | :param hover_callable: A function/lambda that returns the text to use
279 | upon hovering the label
280 | :param props: The properties associated with this label
281 | :param key: The key associated with the label text
282 | '''
283 | set_text(label, props[key] if key in props else text)
284 | def enter_func(_):
285 | hover_text = hover_callable()
286 | set_text(label, hover_text)
287 | props[key] = hover_text
288 | def exit_func(_):
289 | set_text(label, text)
290 | props[key] = text
291 | add_hover_event(label, enter_func, exit_func)
292 |
293 |
294 | def set_text(label, text):
295 | '''
296 | Sets the text of the given label
297 | :param label: The label to use
298 | :param text: The text to use
299 | '''
300 | if text is None:
301 | text = ''
302 | label.setText(html.unescape(text))
303 |
304 |
305 | def set_bg(widget, hex):
306 | '''
307 | Sets the background color of the given widget
308 | :param widget: The widget to use
309 | :param hex: The hex color to use
310 | '''
311 | append_css(widget, 'background-color: %s;' % hex)
312 |
313 |
314 | def set_border(widget, border):
315 | '''
316 | Sets the border color of the given widget
317 | :param widget: The widget to use
318 | :param border: The hex color to use (or css value)
319 | '''
320 | append_css(widget, 'border: %s;' % border)
321 |
322 |
323 | def recolor_pixmap(pixmap, hex):
324 | '''
325 | Recolors a pixmap to a hex color
326 | :param pixmap: The pixmap to recolor
327 | :param hex: The hex color to use
328 | '''
329 | painter = QtGui.QPainter(pixmap)
330 | painter.setCompositionMode(painter.CompositionMode_SourceIn)
331 | painter.fillRect(pixmap.rect(), _to_qcol(hex))
332 | painter.end()
333 |
334 |
335 | def add_paint_event(widget, new_event, include_old=True):
336 | '''
337 | Overrides the QWidget#paintEvent method to append the given event
338 | :param widget: The widget to paint on
339 | :param new_event: The new event to render, includes one event parameter
340 | :param include_old: Also pre-render the old paintEvent, true by default
341 | '''
342 | old_event = widget.paintEvent
343 | def override_paint_event(evt):
344 | if include_old:
345 | old_event(evt)
346 | new_event(evt)
347 | widget.paintEvent = override_paint_event
348 |
349 |
350 | def add_border_line(widget, hex, height, bottom=True):
351 | '''
352 | Renders a border with the given arguments
353 | :param widget: The widget to add a border to
354 | :param hex: The color to render the border as
355 | :param height: The height of the border
356 | :param bottom: True to render at the bottom, False to render at the top.
357 | '''
358 | def paint_border_line(_):
359 | y_pos = widget.height() - height if bottom else 0
360 | painter = QtGui.QPainter(widget)
361 | painter.setCompositionMode(painter.CompositionMode_SourceIn)
362 | painter.fillRect(0, y_pos, widget.width(), height, _to_qcol(hex))
363 | add_paint_event(widget, paint_border_line)
364 |
365 |
366 | def append_css(widget, css):
367 | '''
368 | Appends css to the given widget
369 | :param widget: The widget to style
370 | :param css: The css to append
371 | '''
372 | widget.setStyleSheet(widget.styleSheet() + css)
373 |
374 |
375 | def dict_to_sheet(dictionary):
376 | '''
377 | Converts the given dictionary to a style sheet
378 | :param dictionary: The python dict object to use
379 | '''
380 | src = ''
381 | for key, value in dictionary.items():
382 | if len(src):
383 | src += '\n'
384 | src += '%s: %s;' % (key, value)
385 | return src
386 |
387 |
388 | def _to_qcol(hex):
389 | '''
390 | Converts the given hex color to a Qt QColor object
391 | :param hex: The hex color to use
392 | '''
393 | rgb = _hex_to_rgb(hex)
394 | return QtGui.QColor(rgb[0], rgb[1], rgb[2])
395 |
396 |
397 | def _hex_to_rgb(hex):
398 | '''
399 | Converts the given hex value to an rgb tuple
400 | :param hex: The hex color to convert
401 | '''
402 | hex = hex.lstrip('#')
403 | return tuple(int(hex[i:i + 2], 16) for i in (0, 2, 4))
404 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------