Alphabetical order rom listing
  • Is there anyway I could list my roms in alphabetical order? It's pretty hard to navigate one rom at a time itself, it's even harder to find a rom on an emulator when the list is scrambled... Anyway to fix this? Thanks.
  • it's coming very soon. In the meantime, if you want to add it yourself, it's like 1 line of code. you need to edit the file /home/pi/pimame/pimame-menu/pmmenu/pmlist.py

    near the top you should see some code like this:
    self.global_opts = global_opts
    self.first_index = self.last_index = 0
    self.labels = []

    right after that code, add a line that looks like this:
    self.rom_list = sorted(rom_list, key=lambda rom: rom['title'])


    make sure that the indentation is the same, otherwise you will get errors
  • Thanks. I'll try it when I get home and I'll let you know.
  • Nice, I have been waiting for the update for this myself. Now I will just do it myself in the meantime! :)
  • Darn, didn't work for me. I changed the line that originally said:
    self.rom_list = rom_list

    to what you said above:
    self.rom_list = sorted(rom_list, key=lambda rom: rom['title'])

    Same scrambled listing as before.
  • really? you still got a scrambled list? did it spit out any errors? It's been quite a while since I last took a look at that, so there may be something else that needs to be changed too.
  • Also tried it. No good luck...
  • can you post your pmlist.py file? I'll see if I can see what is going on (my file has been edited so much that I can't even remember what it used to look like)
  • I will try to grab mine off of the Pi and post it in here. It seems like that should work, it doesn't throw any errors or anything, and it looks like the recommended sorting method in Python... will report back in a bit with contents.
  • import os
    import pygame
    from pmlabel import *


    class PMList(pygame.sprite.OrderedUpdates):
    labels = []

    def __init__(self, rom_list, global_opts):
    pygame.sprite.OrderedUpdates.__init__(self)

    self.first_index = self.last_index = 0
    self.labels = []

    self.rom_list = sorted(rom_list, key=lambda rom: rom['title'])

    back_item = {'type': 'back', 'title': '<- Back', 'command': None}<br /> rom_list.insert(0, back_item)

    for list_item in rom_list:
    label = PMLabel(list_item['title'], global_opts.font, global_opts.text_color, global_opts.background_color)
    label.type = list_item['type']
    label.command = list_item['command']
    self.labels.append(label)

    def set_visible_items(self, first_index, last_index):
    self.first_index = first_index
    self.last_index = last_index

    self.empty()
    self.add(self.labels[first_index:last_index])
  • Ooops... how do I format with indentions?
  • that's ok, I can figure it out without the indents
  • I found it.. line 19:
    change:
    for list_item in rom_list:
    to
    for list_item in self.rom_list:
  • BINGO! However, that gets rid of the "Back" menu item. I don't always have a keyboard around, got an easy fix?
  • in line 17 you have a problem with your code, the
    shouldn't be there and everything after should be on the next line. Then change that to
    self.rom_list.insert(0, back_item)
  • you should be good from there. :D
  • Yeah, it is correct in the file, I'm not sure why the br shows up in the post.. :P changing it to self.rom_list did the trick. Thanks @mholgatem!
  • Worked like a charm! Thanks!!!!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!