Skip to content

Commit

Permalink
Move the hdmi mode translation intot the rpiconf class
Browse files Browse the repository at this point in the history
  • Loading branch information
Huulivoide committed May 14, 2012
1 parent f40b036 commit 2652cc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gtk3.py
Expand Up @@ -205,7 +205,7 @@ def on_save(self, menu):
global generated_config
config.overscan_state()

config.hdmi_mode = rpiconf.translate_hdmi_mode(raw_hdmi_mode)
config.translate_hdmi_mode(raw_hdmi_mode)
for option in rpiconf.options:
generated_config += (rpiconf.include_option(
option, getattr(config, option)))
Expand Down
21 changes: 10 additions & 11 deletions rpiconf.py
Expand Up @@ -72,6 +72,16 @@ def overscan_state(self):
self.disable_overscan = 1
else:
self.disable_overscan = 0

def translate_hdmi_mode(self, raw_mode):
if raw_mode[0] == "AUTO":
self.hdmi_mode = 0
elif raw_mode[0] == "VGA":
self.hdmi_mode = 1
elif raw_mode[0] == "":
self.hdmi_mode = 0
elif raw_mode[0] != "":
self.hdmi_mode = hdtv_modes[raw_mode[0]+raw_mode[1]]
####End functions#####################################################

#Some lists of options
Expand Down Expand Up @@ -143,17 +153,6 @@ def get_configfile(_file):
configfile = "config.txt"
return configfile

def translate_hdmi_mode(raw_mode):
if raw_mode[0] == "AUTO":
return 0
elif raw_mode[0] == "VGA":
return 1
elif raw_mode[0] == "":
return 0
elif raw_mode[0] != "":
mode = hdtv_modes[raw_mode[0]+raw_mode[1]]
return mode

def include_option(option, value):
#Make 100% sure we get the value in string format
value = str(value)
Expand Down

0 comments on commit 2652cc2

Please sign in to comment.