Changes

Line 21: Line 21:  
     # Clicking one of the displayed buttons calls the choose method
 
     # Clicking one of the displayed buttons calls the choose method
   −
def choose(self, widget):
+
def choose(self, widget):
    chooser = ObjectChooser(parent=self, what_filter=mime.GENERIC_TYPE_AUDIO)
+
 
    result = chooser.run()
+
chooser = ObjectChooser(parent=self, what_filter=mime.GENERIC_TYPE_AUDIO)
    if result == gtk.RESPONSE_ACCEPT:
+
result = chooser.run()
    self.jobject = chooser.get_selected_object()
+
if result == gtk.RESPONSE_ACCEPT:
    if self.jobject is not None:
+
  self.jobject = chooser.get_selected_object()
        self.path = str(self.jobject.get_file_path())
+
  self.path = str(self.jobject.get_file_path())
 +
else:
 +
  self.jobject = None
 +
  self.path1 = "0"
    
=== Random observations: ===
 
=== Random observations: ===
Line 37: Line 40:  
# self.path stores the soundfile name (complete path); self.jobject stores the object itself. This is key to being able (in Csound) to locate and load the selected soundfile. self.path is then a channel opened to send the named soundfile to Csound.
 
# self.path stores the soundfile name (complete path); self.jobject stores the object itself. This is key to being able (in Csound) to locate and load the selected soundfile. self.path is then a channel opened to send the named soundfile to Csound.
 
# If the user closes the Object Chooser box instead of clicking on a sound object, the result is not accepted, and self.path reverts to "0" - which is a flag (in Csound) to revert to the default soundfile included in FileMix.
 
# If the user closes the Object Chooser box instead of clicking on a sound object, the result is not accepted, and self.path reverts to "0" - which is a flag (in Csound) to revert to the default soundfile included in FileMix.
# The str() cast for self.jname1 converts the filename to the usual path format readable by Csound (this too is required). It is dbus string object... maybe we need to this type cast in sugar-toolkit code (though in most cases this casting should happen implicitly).
+
# The str() cast for self.path converts the filename to the usual path format readable by Csound (this too is required). It is dbus string object... maybe we need to this type cast in sugar-toolkit code (though in most cases this casting should happen implicitly).
    
''Art Hunkins and Aleksey Lim''
 
''Art Hunkins and Aleksey Lim''