Howdy, Stranger!

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

Supported by

[open] Adjust number of displayed experiments on Android runtime

edited December 2015 in OpenSesame

Hi,

Just a short and practical question: Is there a way to display more than 8 experiments in the experiment menu? For example by creating two columns or a second page?

Comments

  • edited 12:14AM

    Hi,

    Not really, no. You could take a look at the menu 'experiment' though. This is the code that implements the startup menu on OpenSesame for Android, and it's just a normal OpenSesame experiment.

    If you feel so inclined, you could see if you can come up with a better design?

    Cheers,
    Sebastiaan

  • edited 12:14AM

    Hi Sebastiaan,

    Here is my attempt at creating a second column, i reckon it isn't the most elegant but it does the trick:

    # Create a form to select the experiment
    max_file_list_size = 16
    form = widgets.form(exp, cols=[1,1], rows=[1]*(max_file_list_size/2)+[1], 
        margins=[32,32,32,32])
    
    i = 1
    j = 1
    path_dict = {}
    if len(experiments) == 0:
        label_notfound = widgets.label(form, text='No experiments found!' % src)
        form.set_widget(label_notfound, (0,0))
    else:
        label_title = widgets.label(form,
            text='Select experiment<br><span size=8>Showing up to %d files</span>' \
            % max_file_list_size)
        form.set_widget(label_title, (0,0), colspan=2)
        for path in experiments[0:(max_file_list_size/2)+1]:
    
            name = os.path.basename(path).split('.')[0].replace('_', ' ').capitalize()
            text = '%s<br /><span size=16>%s</span>' % (name, path)
            path_dict[text] = path
            button_exp = widgets.button(form, text=text)
            form.set_widget(button_exp, (0,i))
            i+= 1
            if i == (max_file_list_size/2)+1:
                break
        for path in experiments[(max_file_list_size/2):max_file_list_size+1]:
    
            name = os.path.basename(path).split('.')[0].replace('_', ' ').capitalize()
            text = '%s<br /><span size=16>%s</span>' % (name, path)
            path_dict[text] = path
            button_exp = widgets.button(form, text=text)
            form.set_widget(button_exp, (1,j))
            j+= 1   
            if j == (max_file_list_size/2)+1:
                break
    
    exp._experiment = path_dict[form._exec()]
    

    Basically, it creates buttons for the first half of the list until it breaks and continues on the second column with the second half of the experiments list. The amount of experiments is now doubled to 16 but in the unlikely scenario of needing more than that amount (let's hope this will never happen :) ) the font size should be adjusted too.

    Alternatively, i could stick to one column and reserve the final row for a 'next page' button which leads to an identical form that loops through the second half of the experiments list. Let me know what you think.

    Laurent

  • edited December 2015

    I've also added another piece that passes the chosen experiment into the logfile path. Might be handy when you have multiple experiments running and want the logfile into the corresponding folder of that experiment, instead of manually switching between folders. I couldn't find a variable for the chosen experiment so it strips the path of the experiment until only the title remains:

    # Detect and strip experiment file path         
    exp._experiment = path_dict[form._exec()]
    experiment = str(exp._experiment)
    experiment = experiment.split('.')[0]
    
    if '\\' in experiment:
        experiment = experiment.split('\\')[-1]
    
    if '/' in experiment:
        experiment = experiment.split('/')[-1]
    

    And later on in the select logfile form:

    text_input_logfile = widgets.text_input(form,
        text=os.path.join(logfile_folder, experiment, 'subject-%d.csv' % exp._subject_nr),
        var='_logfile', return_accepts=True)
    

    Again, probably not the prettiest but it works on my end :)

    Cheers,

    Laurent

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games