Kara-Moon Forum
April 26, 2024, 06:49:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Better mma-gb  (Read 11577 times)
alexis
Jr. Member
*
Posts: 62


« on: July 25, 2011, 01:26:57 PM »

Hello all,

I decided to stop complaining about MMA and to start contributing Smiley Cheesy .

I played a bit with mma-gb.py and I added some features:
  • File and groove lists may now be browsed using keyboard arrows.
  • A double clic on a file name displays file in a text editor (default editor: Geany).
  • A new button has been added: "Generate MIDI" (wording could be enhanced...). It generates a demo MMA file featuring all grooves from selected file, with an empty bar to distinguish grooves. The corresponding MIDI file is also generated. Both files are written in current dir. This feature is useful to have a look at grooves in a sequencer and compares them.

Bob, do whatever you want with these additions.

Cheers,

Alexis

* mma-gb.zip (4.76 KB - downloaded 430 times.)
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #1 on: July 25, 2011, 03:46:14 PM »

Great! Just what open source is all about.

I wrote mma-gb more as a proof-of-concept for another user than anything else. And I have to admit that I've not used it much (guess I know too much about the groove Smiley ).

I'll have a look at the file later this week and it'll most likely go into the next distro.

Thanks!
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #2 on: July 25, 2011, 05:26:18 PM »

Quote
I wrote mma-gb more as a proof-of-concept for another user than anything else. And I have to admit that I've not used it much (guess I know too much about the groove Smiley ).
I think mma-gb is a great app. Very useful when you don't know exactly what groove to use.

Quote
I'll have a look at the file later this week and it'll most likely go into the next distro.
I'm glad you like it and want to integrate it into "official" package. Thanks!

Cheers,

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 on: July 26, 2011, 05:23:17 PM »

My only nit-pick is your choice of editor. I'd suggest to change the selection process to:


# Set here editor permitting to read groove files
EDITOR = os.getenv('EDITOR')
if not EDITOR:
    EDITOR = 'vi'

Not sure if 'vi' is a universal default ... better?

I'm not totally convinced that editing an existing groove file should be that easy for a user? Perhaps the default should be a VIEWER, not EDITOR?
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #4 on: August 01, 2011, 09:55:23 AM »

Quote
My only nit-pick is your choice of editor. I'd suggest to change the selection process to:

# Set here editor permitting to read groove files
EDITOR = os.getenv('EDITOR')
if not EDITOR:
    EDITOR = 'vi'
Yes, this is better than my quick-and-dirty code!
Probably the best thing would be to allow the user to choose the editor in the UI directly and to save settings in a file for next time.
Another way is to introduce a similar mecanism to the one you use for midi player: SetMIDIplayer and mmarc file.
But this is maybe overkill since mma-gb is not part of "core" MMA package.

Quote
Not sure if 'vi' is a universal default ... better?
Personally, I hate 'vi'. But this is probably the most "universal basic" editor in Unix/Linux world.
So let's adopt it! BTW, 'vi' is unknown to Windows users and I'm not sure it is very popular among Apple users, too.
You'll probably have to change the default viewer following OS.

Quote
I'm not totally convinced that editing an existing groove file should be that easy for a user? Perhaps the default should be a VIEWER, not EDITOR?
Yes, agreed. The purpose is to view groove files, not to edit them.

As a conclusion, I would retain an env. variable called "MMA_VIEWER" (the most flexible and simplest solution, probably) and I would set a default editor for each OS.

Cheers,

Alexis

Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 on: August 05, 2011, 01:27:41 AM »

Just been on a little holiday to my annual band camp experience. Let me get things back to normal around the homestead and I'll reply more.

Thanks!
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #6 on: August 17, 2011, 07:07:08 PM »

I had a moment to look at this again. Here's what I came up with ... instead of using an external editor/viewer I've just modified/added to the code a little so that on a double-click the actual file is displayed in the bottom window (replacing the list of grooves). I've modified your displayFile() func as follows:

Code:
	    
    def displayFile(self, fileName):
#self.launchSubprocess("Text Editor", EDITOR, fileName);
        f=file(fileName)
        if f:
            self.lgv.delete(0,END)
            for gg in f:
                self.lgv.insert(END, gg.strip())
            root.update()


Errors, which shouldn't occur anyway, do need a bit of work in the code. But, in the meantime could you try this out and let me know. I think it makes more sense to do it inside the existing framework Huh?

Best,
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #7 on: August 18, 2011, 02:14:01 PM »

Quote
But, in the meantime could you try this out and let me know. I think it makes more sense to do it inside the existing framework Huh?
I tried. Nice! Let's get rid off the text editor. One suggestion, though: I'd colorize the text in black and not in blue. I think it's easier to read.

BTW, why are the vertical scrollbars located to the left? Usually they can be found on the right. If you could change that easily, it'd be nice.

Cheers,

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #8 on: August 19, 2011, 08:30:03 PM »

Geez you guys ... more and more requests Smiley

Anyway, here is better code for the "viewer" section. Handles tabs and an error check. Really, there should never be an error in opening the lib file for browsing (and if there is one it indicates some serious install issue).

Code:
	    
    def displayFile(self, fileName):
        try:
            f=file(fileName)
        except:
            f=null

        if f:
            self.lgv.delete(0,END)
            for gg in f:
                self.lgv.insert(END, gg.rstrip().expandtabs())
            root.update()


The text color and size is easily adjustable. Right near the top of the code there as some variables (ie, listbox_Bcolor, etc). The comments should direct you. I suppose this could be set in yet another rc file, but I'll leave that as an option for the next generation.

Scroll bars belong on the left Smiley. Well, whatever ... if you want to try to change this have a look at the makeTextBox() ... it's not trivial as I recall.

There is a keybinding in the program as modified. If you currently click a line the program wants to do a preview. So, I'll need to disable/enable that. Stay tuned.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #9 on: August 20, 2011, 09:36:18 PM »

Now you have me going ... spent a few hours fixing up the code from the other day Smiley

I think this makes much more sense. Do let me know.

Instead of redoing an existing panel, I think it makes more sense to open a new window with the file listing.

Code:
    def displayFile(self, fileName):
       
        w = Toplevel()
w.title( "MMA Groove Browser: %s" % fileName)

        b=makeListBox(w, height=24,width=80, row=0, column=0)
        try:
            infile=file(fileName)
        except:
            b.insert(END, "Can't access file %s. This is configuration error." % fileName)
        else:
            for l in infile:
                b.insert(END, l.rstrip().expandtabs())

        w.grid_rowconfigure(0, weight=1)
        w.grid_columnconfigure(0, weight=1)



This new window inherits the application's fonts, etc. It doesn't have a <close> button or anything else. Just scrollbars. You can have as many browser windows open as you like, which might be a feature. You can close it manually, or just leave it 'til you close the main window which closes all the browsers as well.

Comments please.
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #10 on: August 22, 2011, 11:17:12 AM »

Sorry Bob, I am on vacation.
My Android HTC smartphone allows me to read your message, but I have no computer.
Would you please wait one week? By next tuesday I will comment your code.

Cheers

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #11 on: August 22, 2011, 04:16:03 PM »

Enjoy the holiday. Even better, enjoy the holiday away from computers!
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #12 on: August 30, 2011, 10:07:29 PM »

Enjoy the holiday. Even better, enjoy the holiday away from computers!
I'm back  Smiley


Quote
This new window inherits the application's fonts, etc. It doesn't have a <close> button or anything else. Just scrollbars. You can have as many browser windows open as you like, which might be a feature. You can close it manually, or just leave it 'til you close the main window which closes all the browsers as well.
I had a look. Nice, but I would create only one window (a style would replace the previous one) and located at a fixed position (top-right corner of main window?).

All the best,

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #13 on: August 31, 2011, 04:48:09 PM »

I think I agree with the "only one display window" idea. I'll make the change later today (it's minor). Forcing a display position is not that hard, but becomes so tied to user prefs and the window manager I think it's better to not force the issue.

I'll be releasing a new developer snapshot later this week (maybe even today). The updated mma-gb will be there as well as a number of minor mma improvements.
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.06 seconds with 19 queries.