Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed a few things in the settins system. Fixes #24

  • Loading branch information...
commit 317be6fa952d01c6538f34b04267f1f18dec7314 1 parent fc44361
@stocyr authored
View
3  .gitignore
@@ -1,3 +1,4 @@
*.project
*.pydevproject
-*.pyc
+*.pyc
+touchcontinuum.ini
View
34 src/main.py
@@ -137,7 +137,7 @@ def __init__(self, **kwargs):
self.keyboard = Keyboard(
source=self.app.config.get('Graphics', 'Keyboard'),
pos=(-540, 366),
- size=(12*5*my_key_width, 468), # optimisation for small screens (e.g. smartphones): 468 if self.get_parent_window().height > (468 + self.get_parent_window().height * 0.3) else self.get_parent_window().height * 0.7
+ size=(12*5*my_key_width, 468), # optimization for small screens (e.g. smartphones): 468 if self.get_parent_window().height > (468 + self.get_parent_window().height * 0.3) else self.get_parent_window().height * 0.7
border_width=BORDER_WIDTH,
key_width=my_key_width)
self.add_widget(self.keyboard)
@@ -421,18 +421,27 @@ def open_my_settings_panel(self):
# bind the background images to function
for child in self.my_settings_panel.background_scroll_view_grid.children:
- child.bind(on_press=self.background_image_change)
+ child.bind(on_press=self.background_image_change_request)
# bind the keyboard images to function
for child in self.my_settings_panel.keyboard_scroll_view_box.children:
- child.bind(on_press=self.keyboard_image_change)
+ child.bind(on_press=self.keyboard_image_change_request)
self.my_settings_panel.is_open = True
- def background_image_change(self, dispatcher):
+ def background_image_change_request(self, dispatcher):
+ self.background_image_change(dispatcher.background_normal)
+
+
+ def keyboard_image_change_request(self, dispatcher):
+ self.keyboard_image_change(dispatcher.background_normal)
+
+
+ def background_image_change(self, value):
# first set the new background into the application settings:
- self.app.config.set('Graphics', 'Background', dispatcher.background_normal)
+ self.app.config.set('Graphics', 'Background', value)
+ print 'set the background to %s' % value
old_background_instance = self.background
@@ -447,7 +456,7 @@ def background_image_change(self, dispatcher):
# create the new image instance
old_background_instance.new_background_instance = Background(
- source=dispatcher.background_normal,
+ source=value,
color=(1, 1, 1, 0))
# add the new instance to the root widget. BUT add it on the bottom (therefore I set the index myself)
self.float_layout.add_widget(old_background_instance.new_background_instance, index=len(self.float_layout.children))
@@ -477,9 +486,10 @@ def background_change_complete(self, animation, widget):
self.background.background_is_animated = False
- def keyboard_image_change(self, dispatcher):
+ def keyboard_image_change(self, value):
# first set the new keyboard into the application settings:
- self.app.config.set('Graphics', 'Keyboard', dispatcher.background_normal)
+ self.app.config.set('Graphics', 'Keyboard', value)
+ print 'set the keyboard to %s' % value
win = self.get_parent_window()
old_keyboard_instance = self.keyboard
@@ -495,7 +505,7 @@ def keyboard_image_change(self, dispatcher):
# create the new image instance
old_keyboard_instance.new_keyboard_instance = Keyboard(
- source=dispatcher.background_normal,
+ source=value,
pos=(old_keyboard_instance.x, win.height + BORDER_WIDTH),
size=(self.keyboard.width, old_keyboard_instance.height),
key_width=old_keyboard_instance.key_width,
@@ -566,8 +576,8 @@ def build_config(self, config):
# create the various section for the .ini settings file:
config.add_section('General')
- config.set('General', 'YAxis', 'Aftertouch')
config.set('General', 'PitchLock', 'Off')
+ config.set('General', 'YAxis', 'Aftertouch')
config.set('General', 'MonoMode', 'Legato') # inactive if voice mode is 'polyphonic'
@@ -599,6 +609,8 @@ def build_config(self, config):
config.set('Advanced', 'MovementDecay', '0.2')
config.set('Advanced', 'ShowPitchLine', 'Off')
+
+
def build_settings(self, settings):
@@ -685,7 +697,7 @@ def on_config_change(self, config, section, key, value):
elif token == ('MIDI', 'Device'):
self.touchcontinuumwidget.set_midi_device()
elif token == ('MIDI', 'Channel'):
- # setting the value to 0 here causes an error?!
+ # TODO: setting the value to 0 here causes an error?!
# config.set('MIDI', 'Channel', boundary(value, 0, 15)
pass
elif token == ('MIDI', 'VoiceMode'):
View
4 src/settingfile.py
@@ -77,7 +77,7 @@ def _validate(self, instance):
self.popup = None
value = self.fileChooser.selection
# if the value was empty, don't change anything.
- if value == '':
+ if value == None or value == '':
return
self.value = value
@@ -91,7 +91,7 @@ def _create_popup(self, instance):
self.scrollView = scrollView = ScrollView()
# then, create the fileChooser and integrate it in the scrollView
- self.fileChooser = fileChooser = FileChooserListView(path=self.path,
+ self.fileChooser = fileChooser = FileChooserListView(#path=self.path, --> causes errors!
filters=self.file_filter,
size_hint_y=None)
fileChooser.height = 500 # TODO: UGLY!
View
2  src/touchcontinuum.ini
@@ -1,6 +1,6 @@
[General]
+pitchlock = On
yaxis = Volume
-pitchlock = Off
monomode = Legato
[Graphics]
View
4 src/touchcontinuum.kv
@@ -38,10 +38,10 @@
size_hint_y: 0.18 size_hint_x: None width: 2*(self.height - 2*self.padding) + self.spacing + 2*self.padding
pos_hint: {'center_x':0.5}
ToggleButton:
- id: pitch_lock_button background_normal: 'images/Pitch_Unlocked.png' background_down: 'images/Pitch_Locked.png' on_press: root.on_pitch_lock_button_press()
+ id: pitch_lock_button background_normal: 'images/Pitch_Unlocked.png' background_down: 'images/Pitch_Locked.png' on_press: root.on_pitch_lock_button_press() state: 'down' if root.app.config.get('General', 'PitchLock') == 'On' else 'normal'
ToggleButton:
id: y_axis_volume_button
- background_normal: 'images/X-Axis_mod.png' background_down: 'images/X-Axis_vol.png' on_press: root.on_y_axis_volume_button_press()
+ background_normal: 'images/X-Axis_mod.png' background_down: 'images/X-Axis_vol.png' on_press: root.on_y_axis_volume_button_press() state: 'down' if root.app.config.get('General', 'YAxis') == 'Volume' else 'normal'
# The two little buttons on the bottom-right:
BoxLayout: spacing: 15 padding: 10 size_hint_y: 0.15 size_hint_x: None width: 2*(self.height - 2*self.padding) + self.spacing + 2*self.padding pos_hint: {'right':1} Button: id: look_button background_normal: 'images/Look.png' background_down: 'images/Look.png' on_press: root.open_my_settings_panel() Button: id: settings_button background_normal: 'images/Settings.png' background_down: 'images/Settings.png' on_press: root.open_settings() # Maybe we could also add an "Exit" button on the top-right? #Button: # size_hint: None, None # width: root.width / 30 # height: self.width # pos_hint: {'right':0.98, 'top': 0.95} # text: "X" # on_press: root.app.stop()
# The custom settingspanel for the appearance settings: <MySettingsPanel>: background_scroll_view_grid: background_scroll_view_grid keyboard_scroll_view_box: keyboard_scroll_view_box size: root.size # left panel containing the background images ScrollView: size: 500, 700 x: 32 y: 32 do_scroll_x: False #scroll_distance: 5 #scroll_timeout: 250 scroll_friction: 3 # add the same border-shadow combination as on the keyboard canvas.before: Color: rgba: 1, 1, 1, 1 BorderImage: source: 'images/Shadow+Border_38.png' border: (38, 38, 38, 38) size: (self.width+38*2, self.height+38*2) pos: (self.x-38, self.y-38) # the actual content: a gridLayout filled with the images GridLayout: id: background_scroll_view_grid cols: 2 size_hint_y: None spacing: 10 # the background of the panel: dark, but half-transparent canvas: Color: rgba: 0, 0, 0, 0.7 Rectangle: pos: self.pos size: self.size # right panel containing the keyboard images ScrollView: size: 500, 700 right: win.Window.width - 32 y: 32 do_scroll_x: False #scroll_distance: 5 #scroll_timeout: 250 scroll_friction: 2 # add the same border-shadow combination as on the keyboard canvas.before: Color: rgba: 1, 1, 1, 1 BorderImage: source: 'images/Shadow+Border_38.png' border: (38, 38, 38, 38) size: (self.width+38*2, self.height+38*2) pos: (self.x-38, self.y-38) # the actual contend: a boxLayout filled with the images BoxLayout: id: keyboard_scroll_view_box orientation: 'vertical' size_hint_y: None spacing: 10 # the background of the panel: dark, but half-transparent canvas: Color: rgba: 0, 0, 0, 0.7 Rectangle: pos: self.pos size: self.size
Please sign in to comment.
Something went wrong with that request. Please try again.