From 2a2b7ad2b3467b9a512670cefdb7cce3281cc66a Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Fri, 28 Aug 2015 17:02:32 +0700 Subject: [PATCH 1/8] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BA=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B3=D1=83;=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20pygtk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rackman.py | 29 ++++++++++++++++++----------- setup.py | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/rackman.py b/rackman.py index d34d374..f87839a 100644 --- a/rackman.py +++ b/rackman.py @@ -7,7 +7,7 @@ #import pygtk -#pygtk.require('2.0') +#pygtk.require('2.4') import gtk import cairo import math @@ -17,12 +17,15 @@ -__version__ = '1.7.0' +__version__ = '1.8.0' def initial(): - global window, screen, _, COLORS, icon + global window, screen, _, COLORS, icon, config + + config = {} + execfile("rackman.conf", config) # чтение предустановок из файла конфигурации window = gtk.Window() screen = window.get_screen() @@ -72,8 +75,9 @@ def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_opacity(1) self.window.set_resizable(False) - self.window.set_title("Rackman [Master]") + self.window.set_title( config['master_title'] ) self.window.set_icon(icon) + self.window.set_keep_above(config['master_above']) self.window.connect("destroy", lambda w: gtk.main_quit()) @@ -237,11 +241,14 @@ class Slave: def __init__(self, parent): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_decorated(False) - self.window.set_title("Rackman [Slave]") + self.window.set_title( config['slave_title'] ) self.window.set_icon(icon) self.window.set_resizable(True) - self.window.set_keep_above(True) - #self.window.set_transient_for(parent.window) + self.window.set_keep_above(config['slave_above']) + if config['transient'] == True: + self.window.set_transient_for(parent.window) + else: + self.window.set_transient_for(None) self.window.set_opacity(0.5) self.parent = parent @@ -249,8 +256,8 @@ def __init__(self, parent): self.area = gtk.DrawingArea() - self.background = COLORS[ _('White') ] - self.foreground = COLORS[ _('Red') ] + self.background = COLORS[ _( config['background_color'] ) ] + self.foreground = COLORS[ _( config['foreground_color'] ) ] self.window.add(self.area) @@ -269,10 +276,10 @@ def __init__(self, parent): def resizing(self, widget, event): x, y = widget.get_size() ox, oy = widget.get_position() - + acc = 1 if event.state & gtk.gdk.SHIFT_MASK: - acc = 50 + acc = config['fast_mode_speed'] if event.state & gtk.gdk.CONTROL_MASK: if event.hardware_keycode == 114: # right diff --git a/setup.py b/setup.py index 661ab2b..269fb6e 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ 'Rackman', ], requires = [ - 'PyGTK (>=2.0)', + 'PyGTK (>=2.4)', ], scripts = [ 'rackman' From 852a02b180a45bc03fc6076aa2eba5734be95b6d Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Fri, 28 Aug 2015 17:53:38 +0700 Subject: [PATCH 2/8] =?UTF-8?q?=D1=87=D1=82=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BD=D1=8B=D1=85=20=D0=BC=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rackman.py | 16 +++++++++++++++- setup.py | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rackman.py b/rackman.py index f87839a..e993a7f 100644 --- a/rackman.py +++ b/rackman.py @@ -24,8 +24,22 @@ def initial(): global window, screen, _, COLORS, icon, config + + config = {} - execfile("rackman.conf", config) # чтение предустановок из файла конфигурации + + conf_file_name = "rackman.conf" + conf_path_curdir = os.path.join('./', conf_file_name) + conf_path_share = os.path.join('/usr/share/rackman/', conf_file_name) + conf_path_home = os.path.join('~/.config/rackman/', conf_file_name) + + conf_paths = (conf_path_share, conf_path_home, conf_path_curdir) + for conf_path in conf_paths: + if os.path.isfile( conf_path ): + print "Read config {}".format(conf_path) + execfile(conf_path, config) # чтение предустановок из файла конфигурации + + window = gtk.Window() screen = window.get_screen() diff --git a/setup.py b/setup.py index 269fb6e..02cd6e1 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ data_files = [ ('/usr/share/icons/hicolor/scalable/apps/', ['rackman.svg']), ('/usr/share/applications', ['rackman.desktop']), + ('/usr/share/rackman', ['rackman.conf']), ('/usr/share/locale/ru/LC_MESSAGES', ['./locale/ru/LC_MESSAGES/rackman.mo']), ('/usr/share/locale/en/LC_MESSAGES', ['./locale/en/LC_MESSAGES/rackman.mo']), ], From 6accdd5633ee1bb7ab2671b4be000e6b31192a37 Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Fri, 28 Aug 2015 17:54:15 +0700 Subject: [PATCH 3/8] add conf file --- rackman.conf | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 rackman.conf diff --git a/rackman.conf b/rackman.conf new file mode 100644 index 0000000..3b98975 --- /dev/null +++ b/rackman.conf @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +# Держать главное окно поверх всех остальных +# Менеджер окон может игнорировать эти установки +# True -- да +# False -- нет +master_above = True + +# Держать измеритель поверх всех остальных окон +# Менеджер окон может игнорировать эти установки +# True -- да +# False -- нет +slave_above = True + +# Заголовок главного окна +# <строка> +master_title = "Rackman [Master]" + +# Заголовок измерителя +# <строка> +slave_title = "Rackman [Slave]" + +# Перекрывать главное окно измерителем +# True -- да +# False -- нет +transient = False + +# Цвет фона и линий измерителя по-умолчанию +# 'Black' -- чёрный +# 'White' -- белый +# 'Green' -- зелёный +# 'Blue' -- синий +# 'Red' -- красный +# 'Orange' -- оранжевый +# 'Violet' -- фиолетовый +# 'Pink' -- розовый +background_color = 'White' +foreground_color = 'Red' + +# Скорость перемещения и изменения размеров окна измерителя в Fast Mode +# <число> (в пикселях) +fast_mode_speed = 50 \ No newline at end of file From e9b338a1786a681e4a9ee5b7ff436b9db87f6620 Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Fri, 28 Aug 2015 19:22:49 +0700 Subject: [PATCH 4/8] =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=D0=BE=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rackman.py | 165 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 111 insertions(+), 54 deletions(-) diff --git a/rackman.py b/rackman.py index e993a7f..d53f53f 100644 --- a/rackman.py +++ b/rackman.py @@ -59,14 +59,54 @@ def initial(): COLORS = { - _('Black'): (0, 0, 0), - _('White'): (1, 1, 1), - _('Green'): (0, 1, 0), - _('Blue'): (0, 0, 1), - _('Red'): (1, 0, 0), - _('Orange'): (1, 0.5, 0), - _('Violet'): (0.5, 0, 0.5), - _('Pink'): (1, 0.5, 1), + _('Black'): { + 'rgb': (0, 0, 0), + 'key': 'K', + 'marker': 'Blac_k', + 'eng_name': 'Black', + }, + _('White'): { + 'rgb': (1, 1, 1), + 'key': 'W', + 'marker': '_White', + 'eng_name': 'White', + }, + _('Green'): { + 'rgb': (0, 1, 0), + 'key': 'G', + 'marker': '_Green', + 'eng_name': 'Green', + }, + _('Blue'): { + 'rgb': (0, 0, 1), + 'key': 'B', + 'marker': '_Blue', + 'eng_name': 'Blue', + }, + _('Red'): { + 'rgb': (1, 0, 0), + 'key': 'R', + 'marker': '_Red', + 'eng_name': 'Red', + }, + _('Orange'): { + 'rgb': (1, 0.5, 0), + 'key': 'O', + 'marker': '_Orange', + 'eng_name': 'Orange', + }, + _('Violet'): { + 'rgb': (0.5, 0, 0.5), + 'key': 'V', + 'marker': '_Violet', + 'eng_name': 'Violet', + }, + _('Pink'): { + 'rgb': (1, 0.5, 1), + 'key': 'P', + 'marker': '_Pink', + 'eng_name': 'Pink', + }, } @@ -84,6 +124,64 @@ def initial(): + + + +def generate_menu(self): + items = [] + + # backgrounds + items.append( ('/{}'.format( _('_Background') ), None, None, 0, '') ) + + for i in COLORS: + C = COLORS[i] + if C['eng_name'] == config['background_color']: + items.append( ('/{}/{}'.format( _('Background'), _(C['marker']) ), '{}'.format(C['key']), self.color_change, 1, '') ) + for i in COLORS: + C = COLORS[i] + if C['eng_name'] is not config['background_color']: + items.append( ('/{}/{}'.format( _('Background'), _(C['marker']) ), '{}'.format(C['key']), self.color_change, 2, '/{}/{}'.format( _('Background'), _(config['background_color']))) ) + + # foregrounds + items.append( ('/{}'.format( _('_Foreground') ), None, None, 0, '') ) + + for i in COLORS: + C = COLORS[i] + if C['eng_name'] == config['foreground_color']: + items.append( ('/{}/{}'.format( _('Foreground'), _(C['marker']) ), '{}'.format(C['key']), self.color_change, 1, '') ) + for i in COLORS: + C = COLORS[i] + if C['eng_name'] is not config['foreground_color']: + items.append( ('/{}/{}'.format( _('Foreground'), _(C['marker']) ), '{}'.format(C['key']), self.color_change, 2, '/{}/{}'.format( _('Foreground'), _(config['foreground_color']))) ) + + items.append( ('/{}'.format( _('_Opacity') ), None, None, 0, '') ) + items.append( ('/{}/_50'.format( _('Opacity') ), '5', self.opacity_change, 50, '') ) + items.append( ('/{}/_10'.format( _('Opacity') ), '1', self.opacity_change, 10, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_20'.format( _('Opacity') ), '2', self.opacity_change, 20, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_30'.format( _('Opacity') ), '3', self.opacity_change, 30, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_40'.format( _('Opacity') ), '4', self.opacity_change, 40, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_60'.format( _('Opacity') ), '6', self.opacity_change, 60, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_70'.format( _('Opacity') ), '7', self.opacity_change, 70, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_80'.format( _('Opacity') ), '8', self.opacity_change, 80, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/_90'.format( _('Opacity') ), '9', self.opacity_change, 90, '/{}/50'.format( _('Opacity') )) ) + items.append( ('/{}/10_0'.format( _('Opacity') ), '0', self.opacity_change, 100,'/{}/50'.format( _('Opacity') )) ) + + items.append( ('/{}'.format( _('_Metric') ), None, None, 0, '') ) + items.append( ('/{}/p_x'.format(_('Metric') ), None, self.metric_change, 1, '') ) + items.append( ('/{}/_mm'.format(_('Metric') ), None, self.metric_change, 2, '/{}/px'.format( _('Metric') )) ) + items.append( ('/{}/_in'.format(_('Metric') ), None, self.metric_change, 3, '/{}/px'.format( _('Metric') )) ) + items.append( ('/{}/_pt (Adobe)'.format( _('Metric') ), None, self.metric_change, 4, '/{}/px'.format( _('Metric') )) ) + + items.append( ('/{}'.format( _('_Tools') ), None, None, 0, '') ) + items.append( ('/{}/{}'.format( _('Tools'), _('Rotate') ), 'R', self.size_change, 1, '') ) + + return items + + + + + + class Master: def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) @@ -149,48 +247,7 @@ def __init__(self): tableH.attach(va, 3,4, *value_row) - self.menu_items = ( - ('/{}'.format( _('_Background') ), None, None, 0, ''), - ('/{}/{}'.format( _('Background'), _('_White') ), 'W', self.color_change, 1, ''), - ('/{}/{}'.format( _('Background'), _('Blac_k') ), 'K', self.color_change, 2, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Green') ), 'G', self.color_change, 3, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Blue') ), 'B', self.color_change, 4, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Red') ), 'R', self.color_change, 5, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Orange') ), 'O', self.color_change, 6, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Violet') ), 'V', self.color_change, 7, '/{}/{}'.format( _('Background'), _('White') )), - ('/{}/{}'.format( _('Background'), _('_Pink') ), 'P', self.color_change, 8, '/{}/{}'.format( _('Background'), _('White') )), - - ('/{}'.format( _('_Foreground') ), None, None, 0, ''), - ('/{}/{}'.format( _('Foreground'), _('_Red') ), 'R', self.color_change, 5, ''), - ('/{}/{}'.format( _('Foreground'), _('_White') ), 'W', self.color_change, 1, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('Blac_k') ), 'K', self.color_change, 2, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('_Green') ), 'G', self.color_change, 3, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('_Blue') ), 'B', self.color_change, 4, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('_Orange') ), 'O', self.color_change, 6, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('_Violet') ), 'V', self.color_change, 7, '/{}/{}'.format( _('Foreground'), _('Red') )), - ('/{}/{}'.format( _('Foreground'), _('_Pink') ), 'P', self.color_change, 8, '/{}/{}'.format( _('Foreground'), _('Red') )), - - ('/{}'.format( _('_Opacity') ), None, None, 0, ''), - ('/{}/_50'.format( _('Opacity') ), '5', self.opacity_change, 50, ''), - ('/{}/_10'.format( _('Opacity') ), '1', self.opacity_change, 10, '/{}/50'.format( _('Opacity') )), - ('/{}/_20'.format( _('Opacity') ), '2', self.opacity_change, 20, '/{}/50'.format( _('Opacity') )), - ('/{}/_30'.format( _('Opacity') ), '3', self.opacity_change, 30, '/{}/50'.format( _('Opacity') )), - ('/{}/_40'.format( _('Opacity') ), '4', self.opacity_change, 40, '/{}/50'.format( _('Opacity') )), - ('/{}/_60'.format( _('Opacity') ), '6', self.opacity_change, 60, '/{}/50'.format( _('Opacity') )), - ('/{}/_70'.format( _('Opacity') ), '7', self.opacity_change, 70, '/{}/50'.format( _('Opacity') )), - ('/{}/_80'.format( _('Opacity') ), '8', self.opacity_change, 80, '/{}/50'.format( _('Opacity') )), - ('/{}/_90'.format( _('Opacity') ), '9', self.opacity_change, 90, '/{}/50'.format( _('Opacity') )), - ('/{}/10_0'.format( _('Opacity') ), '0', self.opacity_change, 100,'/{}/50'.format( _('Opacity') )), - - ('/{}'.format( _('_Metric') ), None, None, 0, ''), - ('/{}/p_x'.format(_('Metric') ), None, self.metric_change, 1, ''), - ('/{}/_mm'.format(_('Metric') ), None, self.metric_change, 2, '/{}/px'.format( _('Metric') )), - ('/{}/_in'.format(_('Metric') ), None, self.metric_change, 3, '/{}/px'.format( _('Metric') )), - ('/{}/_pt (Adobe)'.format( _('Metric') ), None, self.metric_change, 4, '/{}/px'.format( _('Metric') )), - - ('/{}'.format( _('_Tools') ), None, None, 0, ''), - ('/{}/{}'.format( _('Tools'), _('Rotate') ), 'R', self.size_change, 1, ''), - ) + self.menu_items = ( generate_menu(self) ) menubar = self.get_main_menu() tableH.attach(menubar, 0,4, *menu_row) @@ -207,9 +264,9 @@ def color_change(self, ret, widget): color_context = widget.name.split('/')[-2] if color_context == _('Background'): - slave.background = COLORS[ _(color_name) ] + slave.background = COLORS[ _(color_name) ]['rgb'] elif color_context == _('Foreground'): - slave.foreground = COLORS[ _(color_name) ] + slave.foreground = COLORS[ _(color_name) ]['rgb'] else: raise ValueError( "Unknown color_context: {}".format(color_context) ) @@ -270,8 +327,8 @@ def __init__(self, parent): self.area = gtk.DrawingArea() - self.background = COLORS[ _( config['background_color'] ) ] - self.foreground = COLORS[ _( config['foreground_color'] ) ] + self.background = COLORS[ _( config['background_color'] ) ]['rgb'] + self.foreground = COLORS[ _( config['foreground_color'] ) ]['rgb'] self.window.add(self.area) From 3304daadd374f6a1354dfe19edb01036adbd3a13 Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Fri, 28 Aug 2015 19:30:18 +0700 Subject: [PATCH 5/8] add slave window opacity option in config --- rackman.conf | 4 ++++ rackman.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rackman.conf b/rackman.conf index 3b98975..6e16db4 100644 --- a/rackman.conf +++ b/rackman.conf @@ -20,6 +20,10 @@ master_title = "Rackman [Master]" # <строка> slave_title = "Rackman [Slave]" +# Прозрачность измерителя +# <число> (от 0 до 1) +slave_opacity = 0.5 + # Перекрывать главное окно измерителем # True -- да # False -- нет diff --git a/rackman.py b/rackman.py index d53f53f..10384fa 100644 --- a/rackman.py +++ b/rackman.py @@ -320,7 +320,7 @@ def __init__(self, parent): self.window.set_transient_for(parent.window) else: self.window.set_transient_for(None) - self.window.set_opacity(0.5) + self.window.set_opacity( config['slave_opacity'] ) self.parent = parent self.metric = ('px', 1, 0, 2) From cdf33bfabc8fac66a06f1db55380c9ef5409637c Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Sat, 29 Aug 2015 01:59:16 +0700 Subject: [PATCH 6/8] =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D1=85=20=D0=BC=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rackman.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rackman.py b/rackman.py index 10384fa..791d7a4 100644 --- a/rackman.py +++ b/rackman.py @@ -17,7 +17,7 @@ -__version__ = '1.8.0' +__version__ = '1.8.1' @@ -31,7 +31,7 @@ def initial(): conf_file_name = "rackman.conf" conf_path_curdir = os.path.join('./', conf_file_name) conf_path_share = os.path.join('/usr/share/rackman/', conf_file_name) - conf_path_home = os.path.join('~/.config/rackman/', conf_file_name) + conf_path_home = os.path.join(os.path.expanduser('~'),'.config/rackman/', conf_file_name) conf_paths = (conf_path_share, conf_path_home, conf_path_curdir) for conf_path in conf_paths: From f3ca1f0f61dfb4717ef37e712c2089ef476ba69e Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Sat, 29 Aug 2015 02:20:48 +0700 Subject: [PATCH 7/8] fix menu items --- rackman.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/rackman.py b/rackman.py index 791d7a4..cee50e7 100644 --- a/rackman.py +++ b/rackman.py @@ -154,17 +154,19 @@ def generate_menu(self): if C['eng_name'] is not config['foreground_color']: items.append( ('/{}/{}'.format( _('Foreground'), _(C['marker']) ), '{}'.format(C['key']), self.color_change, 2, '/{}/{}'.format( _('Foreground'), _(config['foreground_color']))) ) - items.append( ('/{}'.format( _('_Opacity') ), None, None, 0, '') ) - items.append( ('/{}/_50'.format( _('Opacity') ), '5', self.opacity_change, 50, '') ) - items.append( ('/{}/_10'.format( _('Opacity') ), '1', self.opacity_change, 10, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_20'.format( _('Opacity') ), '2', self.opacity_change, 20, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_30'.format( _('Opacity') ), '3', self.opacity_change, 30, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_40'.format( _('Opacity') ), '4', self.opacity_change, 40, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_60'.format( _('Opacity') ), '6', self.opacity_change, 60, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_70'.format( _('Opacity') ), '7', self.opacity_change, 70, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_80'.format( _('Opacity') ), '8', self.opacity_change, 80, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/_90'.format( _('Opacity') ), '9', self.opacity_change, 90, '/{}/50'.format( _('Opacity') )) ) - items.append( ('/{}/10_0'.format( _('Opacity') ), '0', self.opacity_change, 100,'/{}/50'.format( _('Opacity') )) ) + # opacity + items.append( ('/{}'.format( _('_Opacity') ), None, None, 0, '') ) + + opacitys = range(10, 101, 10) + for i in opacitys: + if i == config['slave_opacity'] * 100: + items.append( ('/{}/_{}'.format( _('Opacity'), i ), '{}'.format(str(i)[-2]), self.opacity_change, i, '') ) + for i in opacitys: + if i != config['slave_opacity'] * 100: + if i == 100: + items.append( ('/{}/10_0'.format( _('Opacity') ), '{}'.format(str(i)[-2]), self.opacity_change, i, '/{}/{}'.format( _('Opacity'), int(config['slave_opacity'] * 100) )) ) + else: + items.append( ('/{}/_{}'.format( _('Opacity'), i ), '{}'.format(str(i)[-2]), self.opacity_change, i, '/{}/{}'.format( _('Opacity'), int(config['slave_opacity'] * 100) )) ) items.append( ('/{}'.format( _('_Metric') ), None, None, 0, '') ) items.append( ('/{}/p_x'.format(_('Metric') ), None, self.metric_change, 1, '') ) From 826a7127b6d00239f1497c70a3e0ec9e88c19d97 Mon Sep 17 00:00:00 2001 From: Nik Volkov Date: Sat, 29 Aug 2015 17:41:16 +0700 Subject: [PATCH 8/8] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rackman.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rackman.py b/rackman.py index cee50e7..d386d56 100644 --- a/rackman.py +++ b/rackman.py @@ -17,7 +17,7 @@ -__version__ = '1.8.1' +__version__ = '1.8.2'