Skip to content

Commit

Permalink
Added save_widget_scale key
Browse files Browse the repository at this point in the history
  • Loading branch information
RingOV committed Feb 10, 2021
1 parent df00ea7 commit b1f78e6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gis-weather.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#
# gis_weather.py
v = '0.8.4.16'
v = '0.8.4.17'
# Copyright (C) 2013-2021 Alexander Koltsov <ringov@mail.ru>
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -196,6 +196,7 @@ def make_dirs(path):
'save_weather_path': '',
'save_widget': False,
'save_widget_path': '',
'save_widget_scale': False,
'type_hint':0,
'always_on_top': False,
'tooltip_show': True,
Expand Down Expand Up @@ -1555,11 +1556,15 @@ def save_widget_bg(self):


def save_widget_screenshot(self, path_to_save=None):
if save_widget_scale:
_scale = save_widget_scale
else:
_scale = scale
if not path_to_save:
path_to_save = os.path.join(os.path.expanduser('~'), "gis-weather %s.png"%time.strftime('%d-%m-%y %T', time.localtime()))
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width*scale), int(height*scale))
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width*_scale), int(height*_scale))
ctx = cairo.Context(surface)
ctx.scale(scale, scale)
ctx.scale(_scale, _scale)
self.Draw_Weather(ctx)
print(_('Screenshot saved to')+' '+path_to_save)
surface.write_to_png(path_to_save)
Expand Down

0 comments on commit b1f78e6

Please sign in to comment.