diff options
Diffstat (limited to '')
-rwxr-xr-x | src/__main__.py | 30 | ||||
-rw-r--r-- | src/blueshift_randr.pyx | 34 | ||||
-rw-r--r-- | src/monitor.py | 3 |
3 files changed, 43 insertions, 24 deletions
diff --git a/src/__main__.py b/src/__main__.py index 45ba7db..6a58054 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -37,30 +37,6 @@ from monitor import * config_file = None -def periodically(year, month, day, hour, minute, second, weekday, fade): - fadein_time = None - fadeout_time = None - fadein_steps = 100 - fadeout_steps = 100 - start_over() - if fade is None: - negative(False, False, False) - temperature(6500, lambda T : divide_by_maximum(series_d(T))) - temperature(6500, lambda T : clip_whitepoint(simple_whitepoint(T))) - temperature(6500, cmf_2deg) - temperature(6500, cmf_10deg) - rgb_contrast(1.0, 1.0, 1.0) - cie_contrast(1.0) - rgb_brightness(1.0, 1.0, 1.0) - cie_brightness(1.0) - gamma(1.0, 1.0, 1.0) - sigmoid(None, None, None) - manipulate(lambda r : r, lambda g : g, lambda b : b) - clip() - randr(1, 2) - - - periodically = None ''' :(int, int, int, int, int, int, int, float?)?→void Place holder for periodically invoked function @@ -134,6 +110,12 @@ running = True def signal_SIGTERM(signum, frame): + ''' + Signal handler for SIGTERM + + @param signum The signal number, 0 if called from the program itself + @param frame Ignore, it will probably be `None` + ''' global running if not running: running = False diff --git a/src/blueshift_randr.pyx b/src/blueshift_randr.pyx index d5e13b6..8d2909a 100644 --- a/src/blueshift_randr.pyx +++ b/src/blueshift_randr.pyx @@ -1,4 +1,20 @@ # -*- python -*- + +# Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + cimport cython from libc.stdlib cimport malloc, free @@ -12,10 +28,25 @@ cdef extern void blueshift_randr_close() def randr_open(int use_screen): + ''' + Start stage of colour curve control + + @param use_screen The screen to use + @return Zero on success + ''' return blueshift_randr_open(use_screen) def randr_apply(unsigned long long use_crtcs, r_curve, g_curve, b_curve): + ''' + Apply stage of colour curve control + + @param use_crtcs Mask of CRTC:s to use + @param r_curve:list<unsigned short int> The red colour curve + @param g_curve:list<unsigned short int> The green colour curve + @param b_curve:list<unsigned short int> The blue colour curve + @return Zero on success + ''' cdef unsigned short int* r cdef unsigned short int* g cdef unsigned short int* b @@ -36,5 +67,8 @@ def randr_apply(unsigned long long use_crtcs, r_curve, g_curve, b_curve): def randr_close(): + ''' + Resource freeing stage of colour curve control + ''' blueshift_randr_close() diff --git a/src/monitor.py b/src/monitor.py index 52bc220..7df4336 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -43,6 +43,9 @@ def translate_to_integers(): def close_c_bindings(): + ''' + Close all C bindings and let them free resources and close connections + ''' global randr_opened if randr_opened: randr_opened = False |