def __init__(self, generator_facade):
        self.root = tk.Tk()
        self.root.title('Composer')
        self.root.resizable(False, False)
        self.model_label_text = StringVar()
        self.duration_seconds = StringVar()
        self.player_time = StringVar()
        self.should_timer_stop = False
        self.generator_facade = generator_facade
        self.canvas = tk.Canvas(self.root,
                                height=self.HEIGHT,
                                width=self.WIDTH,
                                highlightthickness=0,
                                bg=GUIUtils.BACKGROUND_COLOR)
        self.background_image = GUIUtils.get_background_image()
        self.canvas.create_image(0,
                                 0,
                                 image=self.background_image,
                                 anchor='nw')
        self.create_model_button = GUIUtils.init_button(
            self.root, 'create model', self.create_model_button_callback)
        self.load_model_button = GUIUtils.init_button(
            self.root, 'load model', self.load_model_button_callback)
        self.save_model_button = GUIUtils.init_button(
            self.root, 'save model', self.save_model_button_callback,
            'disabled')
        self.model_label = GUIUtils.set_label(
            self.canvas,
            relx=0.1,
            rely=0.05,
            stringvar=self.model_label_text,
            change_callback=self.on_model_label_change)
        self.generate_button = GUIUtils.init_button(
            self.root, 'generate', self.generate_button_callback, 'disabled')
        self.save_melody_button = GUIUtils.init_button(
            self.root, 'save melody', self.save_melody_button_callback,
            'disabled')
        self.play_icon = tk.PhotoImage(file='./img/play2.png')
        self.stop_icon = tk.PhotoImage(file='./img/stop2.png')
        self.melody_progress_bar = ttk.Progressbar(self.root,
                                                   orient='horizontal',
                                                   length=300,
                                                   mode='determinate')
        self.player_time_label = GUIUtils.set_label(
            self.canvas,
            relx=0.4,
            rely=0.65,
            stringvar=self.player_time,
            change_callback=self.on_timer_label_change)
        self.play_melody_button = GUIUtils.init_button(
            self.root, None, self.play_melody_button_callback, 'disabled', 50)
        self.stop_melody_button = GUIUtils.init_button(
            self.root, None, self.stop_melody_button_callback, 'disabled', 50)

        self.init_widgets()
Exemplo n.º 2
0
 def linkageOutput(*args):
     #grab the current selection of the list
     selection = distListBox.curselection()
     selectionIndex = binaryList[selection[0]]
     for i in range(int(len(selectionIndex) / 2)):
         if i == 0:
             linkLoc = (2 * int(selectionIndex[0]) +
                        int(selectionIndex[1]))
             link = linkageList[linkLoc]
         elif i == 1:
             distLoc = (2 * int(selectionIndex[2]) +
                        int(selectionIndex[3]))
             dist = distList[distLoc]
             GU.createClustergram(0, link, dist)
Exemplo n.º 3
0
        def linkageComp(*args):
            #get the file containing the groups
            linkList = []
            file = filedialog.askopenfilename()
            selection = linkListBox.curselection()
            selectionIndex = binaryList[selection[0]]
            for i in range(int(len(selectionIndex))):
                if int(selectionIndex[i]) == 1:
                    #put the output into the linkList to be sent to the linkageComparison function
                    linkList.append(linkageList[i])

            #get the linkage length to tell the linkageComparison how many comparisons to perform
            num_comps = len(linkList)

            #send the parameters for linkage comparison
            GU.linkageComparison(file, num_comps, linkList)
 def generate_button_callback(self):
     if GUIUtils.is_positive_integer(self.duration_seconds.get()):
         try:
             duration = int(self.duration_seconds.get())
             self.generator_facade.generate_melody(duration)
             self.melody_progress_bar.configure(max=duration)
             self.refresh_buttons_after_generating_melody()
         except Exception as e:
             messagebox.showerror("Error", str(e))
     else:
         messagebox.showerror("Error", 'Invalid duration')
Exemplo n.º 5
0
 def generate(self):
     #ask the user to select the file in which will be used to create a minimum spanning tree.
     GU.PDFGenerator()
Exemplo n.º 6
0
 def mst(self):
     #send the user to the minimum spanning tree function.
     GU.MST(func="base")
Exemplo n.º 7
0
        def ensembleOutput(*args):
            #grab the current selection of the list
            selection = optClustBox.curselection()
            selection = int(selection[0]) + 1

            GU.ensembleClustering(optNum=selection)
Exemplo n.º 8
0
 def mstF(self):
     numClust = GU.MST(func='ensemble')
     numClust = int(numClust)
     print(numClust)
     GU.ensembleClustering(optNum=numClust)
Exemplo n.º 9
0
 def integrity(self):
     #ask the user to select a volcano plot file to check the integrity of the data against.
     filename = filedialog.askopenfilename()
     GU.dataIntegrity(filename)
Exemplo n.º 10
0
 def P2P(self):
     #Waiting until the MST functionality is complete.
     GU.peaksToPathways()
Exemplo n.º 11
0
 def compound(self):
     #ask the user to select a clustergram file to run through a validition study.
     #Waiting on confirmation...
     GU.compoundMatchUp()
Exemplo n.º 12
0
 def medians(self):
     #send the user to the groupMedians function
     GU.groupMedians()