Merge lp:~mikefender/terminator/terminator into lp:terminator/trunk

Proposed by MikeFender
Status: Rejected
Rejected by: Stephen Boddy
Proposed branch: lp:~mikefender/terminator/terminator
Merge into: lp:terminator/trunk
Diff against target: 12 lines (+1/-1)
1 file modified
terminatorlib/terminal.py (+1/-1)
To merge this branch: bzr merge lp:~mikefender/terminator/terminator
Reviewer Review Type Date Requested Status
Stephen Boddy Needs Information
Review via email: mp+200080@code.launchpad.net
To post a comment you must log in.
Revision history for this message
MikeFender (mikefender) wrote :

My config file...

[global_config]
background_color = "#000000"
foreground_color = "#FFFFFF"
background_type = transparent
enable_real_transparency = true
background_darkness=0.9
[keybindings]
[profiles]
  [[default]]
    background_image = None
[layouts]
  [[default]]
    [[[child1]]]
      type = Terminal
      parent = window0
    [[[window0]]]
      type = Window
      parent = ""
[plugins]

When i got the exception i had background_darkness=1.0 but the bug is replicable with every value.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Hi Mike, I know it's only a one-liner, but I'm puzzled how you ran into this. The background_darkness value is a profile based setting, but you have it under the global config. Perhaps this was done in a very old version of Terminator, but you don't mention which version you are using, so I can't be sure. Or perhaps you created this config by hand?

By copying your invalid config and testing, I see the exception. I think you're hitting a similar issue to Bug #1222107, where a value in the wrong place causes bad things to happen. But if this is a hand edited config file, then it'll need some thought as to how to protect from misplaced instructions causing exceptions/crashes.

review: Needs Information
Revision history for this message
MikeFender (mikefender) wrote :

> Hi Mike, I know it's only a one-liner, but I'm puzzled how you ran into this.
> The background_darkness value is a profile based setting, but you have it
> under the global config. Perhaps this was done in a very old version of
> Terminator, but you don't mention which version you are using, so I can't be
> sure. Or perhaps you created this config by hand?
>
> By copying your invalid config and testing, I see the exception. I think
> you're hitting a similar issue to Bug #1222107, where a value in the wrong
> place causes bad things to happen. But if this is a hand edited config file,
> then it'll need some thought as to how to protect from misplaced instructions
> causing exceptions/crashes.

Hi there, well... i'm guilty, i created that config by hand. In fact i noticed now that settings were for the profile section and not for global section.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Rejected because error was dur to an invalid hand-edited config file.

Unmerged revisions

1485. By MikeFender

Fixed background_darkness bug

Casted opacity from string to float to avoid program crash.

Exception related to the bug: File "/usr/lib/python2.7/site-packages/terminatorlib/terminal.py", line 667, in reconfigure
opacity = int(self.config['background_darkness'] * 65536)
ValueError: invalid literal for int() with base 10: '1.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.01.'

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/terminal.py'
2--- terminatorlib/terminal.py 2013-10-25 14:57:14 +0000
3+++ terminatorlib/terminal.py 2013-12-26 21:21:05 +0000
4@@ -674,7 +674,7 @@
5 if background_type in ('image', 'transparent'):
6 self.vte.set_background_tint_color(gtk.gdk.color_parse(
7 self.config['background_color']))
8- opacity = int(self.config['background_darkness'] * 65536)
9+ opacity = int(float(self.config['background_darkness']) * 65536)
10 saturation = 1.0 - float(self.config['background_darkness'])
11 dbg('setting background saturation: %f' % saturation)
12 self.vte.set_background_saturation(saturation)