Esempio n. 1
0
    def __init__(self, frame, party_type):
        #http://tkinter.unpythonic.net/wiki/ModalWindow 
        self.party_repository = PartyRepository()
        self.party_type = party_type
        tk.tkinter.Toplevel.__init__(self, frame)
#       self.geometry("400x300")
        self.transient(frame)
        self.focus_set()
        #self.grab_set()
        message = "Please enter your " + PartyType.reverse_mapping[self.party_type] + " ddex party details. You can apply for a ddex Party id for free at: http://ddex.net/content/implementation-licence-application-form"
        text = tk.tkinter.Label(self, height=5, text=message, wraplength=400)
        text.grid(row=0, column=0,columnspan=3)
        self.party_id = EntryInput(self, "Party Id", Validate().not_empty)
        self.party_name = EntryInput(self, "Party Name", Validate().not_empty)
        self.party_id.draw(2)
        self.party_name.draw(3)
        tk.Button(self, text="OK", command=self.save_and_close).grid(row=4, column=0)
        frame.wait_window(self)
Esempio n. 2
0
 def __init__(self, frame):
     tk.tkinter.Toplevel.__init__(self, frame)
     self.title("Deal Editor")
     self.focus_set()
     self.fields = ([
         OptionInput(self, "Commercial Model", *deal.CommercialModals),
         OptionInput(self, "Use Type", *deal.UseTypes),
         OptionInput(self, "Territory", *deal.Territories),
         EntryInput(self, "Start Date",
                    Validate().date),
         EntryInput(self, "Pre Order Date",
                    Validate().date),
         EntryInput(self, "Pre Order Preview Date",
                    Validate().date)
     ])
     for i in range(len(self.fields)):
         self.fields[i].draw(i)
     tk.Button(self, text="OK", command=self.__destroy_if_valid).grid(
         row=len(self.fields) + 1, column=0)
Esempio n. 3
0
 def __init__(self, frame):
     ReleaseWindow.__init__(self, frame)
     self._sound_file_paths = []
     self.fields.append(EntryInput(self, "ISRC", Validate().not_empty))
     total_fields = len(self.fields)
     self.draw_fields()
     self.add_sound_recording_button = tk.Button(
         self, text="Add Audio",
         command=self.add_audio).grid(row=total_fields + 1, column=0)
     self.add_deal_button = tk.Button(self,
                                      text="Add deal",
                                      command=self.create_deal).grid(
                                          row=total_fields + 2, column=0)
     self.button = tk.Button(self,
                             text="OK",
                             command=self.__destroy_if_valid).grid(
                                 row=total_fields + 3, column=0)
Esempio n. 4
0
    def __init__(self, frame, root_folder, batch_id):
        ReleaseWindow.__init__(self, frame)
        self.track_builder_file_paths = []
        self.image_path = None
        self._resource_manager = ResourceManager(FileParser(), batch_id,
                                                 root_folder)
        self.fields.append(EntryInput(self, "UPC", Validate().upc))
        self.fields.append(OptionInput(self, "Type", 'Single', 'Album'))
        self.is_update_check_box = CheckboxInput(self, "Is Update")
        self.fields.append(self.is_update_check_box)
        self.total_fields = len(self.fields)
        self.draw_fields()
        self.add_deal_button = tk.Button(self,
                                         text="Add deal",
                                         command=self.create_deal)
        self.add_deal_button.grid(row=self.new_row(), column=0)
        self.add_track_button = tk.Button(self,
                                          text="Add Track",
                                          command=self.create_track)
        self.add_track_button.grid(row=self.new_row(), column=0)
        self.delete_track_button = tk.Button(self,
                                             text="Remove Track",
                                             state="disabled",
                                             command=self.remove_track)
        self.delete_track_button.grid(row=self.new_row(), column=0)
        self.add_img_button = tk.Button(self,
                                        text="Album Artwork",
                                        command=self.add_image).grid(
                                            row=self.new_row(), column=0)
        self.button = tk.Button(self,
                                text="OK",
                                command=self.__destroy_if_valid).grid(
                                    row=self.new_row(), column=0)
        self.track_list = tk.tkinter.Listbox(self)
        self.track_list.bind('<Delete>', lambda x: self.remove_track())
        track_list_row = self.new_row()
        self.track_list.grid(row=track_list_row, column=0)

        self.artwork = tk.tkinter.Label(self)
        self.artwork.grid(row=track_list_row, column=1)
        self.draw_tracks()
Esempio n. 5
0
 def __init__(self, frame):
     tk.tkinter.Toplevel.__init__(self, frame)
     self._release_builder = ReleaseBuilder()
     self.fields = ([
         EntryInput(self, "Title",
                    Validate().not_empty),
         EntryInput(self, "Year",
                    Validate().year),
         EntryInput(self, "C Line",
                    Validate().not_empty),
         EntryInput(self, "P Line",
                    Validate().not_empty),
         EntryInput(self, "Artist",
                    Validate().not_empty),
         EntryInput(self, "Label",
                    Validate().not_empty),
         CheckboxInput(self, "Explicit")
     ])
Esempio n. 6
0
 def test_upcs_must_only_contain_numbers(self):
     result = Validate().upc("abc123456789")
     self.assertEqual(result["error"], "upc must only contain numbers")
     self.assertEqual(result["success"], False)
Esempio n. 7
0
 def test_dates_do_not_return_errors(self):
     result = Validate().date("2012-01-22")
     self.assertEqual(result["value"], datetime(2012, 1, 22))
     self.assertIsInstance(result["value"], datetime)
     self.assertFalse("error" in result)
Esempio n. 8
0
 def test_date_must_be_in_corret_format(self):
     result = Validate().date("abc")
     self.assertEqual(result["error"], "date must be in format YYYY-mm-dd")
Esempio n. 9
0
 def test_non_empty_strings_are_fine(self):
     result = Validate().not_empty("hello")
     self.assertEqual(result["value"], "hello")
     self.assertEqual(result["success"], True)
Esempio n. 10
0
 def test_strings_cannot_be_empty(self):
     result = Validate().not_empty("")
     self.assertEqual(result["error"], "value cannot be empty")
     self.assertEqual(result["success"], False)
Esempio n. 11
0
 def test_a_valid_year_does_not_return_any_errors(self):
     result = Validate().year("2012")
     self.assertEqual(result["value"], 2012)
     self.assertFalse("error" in result)
Esempio n. 12
0
 def test_year_must_be_a_number(self):
     result = Validate().year("a")
     self.assertEqual(result["error"], "year must be a number")
     self.assertEqual(result["success"], False)
Esempio n. 13
0
 def test_valid_upcs_do_not_return_errors(self):
     result = Validate().upc("123456789012")
     self.assertEqual(result["value"], "123456789012")
     self.assertEqual(result["success"], True)
     self.assertFalse("error" in result)
Esempio n. 14
0
 def test_upcs_cannot_contain_more_than_13_digits(self):
     result = Validate().upc("12345678910235")
     self.assertEqual(result["error"], "upc must be 12 - 13 digits long")
     self.assertEqual(result["success"], False)