def __init__(self): """Widget creator.""" super().__init__() #---------------------------------------------------------------------- # Other (non settings) attributes... self.inputSeg = None self.selectedCharacters = list() self.characters = list() self.mustLoad = True if INSTALLED_MODELS: self.model = INSTALLED_MODELS[0] else: self.model = "" #---------------------------------------------------------------------- # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) #---------------------------------------------------------------------- # User interface... self.characterListbox = gui.listBox( widget=self.controlArea, master=self, value="selectedCharacters", labels="characters", callback=None, tooltip="List of identified characters", ) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input.", "warning") # Check that there's a model... if not self.model: self.noLanguageModelWarning()
def __init__(self, *args, **kwargs): """Initialize a Message widget""" super().__init__(*args, **kwargs) # Other attributes... self.segmentation = None self.createdInputs = list() self.noLanguageParameterWarning = ( "Please make sure that at least one language parameter " "file is installed in your Treetagger 'lib' directory, " "then click 'Reload language parameter files'.") self.noTreetaggerPathWarning = ( "Please click 'Locate Treetagger' below and select the " "base directory of a valid Treetagger distribution.") self.TreetaggerPath = (treetaggerwrapper.locate_treetagger() or self.lookupSavedTreetaggerPath()) self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton(widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute=u"infoBox", sendIfPreCallback=self.updateGUI) gui.separator(self.controlArea, height=3) self.optionsBox = gui.widgetBox( self.controlArea, u"Options", ) self.languageCombobox = gui.comboBox( widget=self.optionsBox, master=self, value="language", items=list(), sendSelectedValue=True, orientation=u"horizontal", label="Input language:", labelWidth=180, callback=self.sendButton.settingsChanged, tooltip=(u"Select the language of the input text."), ) self.languageCombobox.setMinimumWidth(120) gui.separator(self.optionsBox, height=3) gui.comboBox( widget=self.optionsBox, master=self, value="outputFormat", items=[ "segment into words", "add XML tags", ], sendSelectedValue=True, orientation=u"horizontal", label="Output format:", labelWidth=180, callback=self.sendButton.settingsChanged, tooltip=( u"Select the format of the output:\n\n" u"Segment into words: each word is in a separate segment,\n" u"with lemma and POS-tag as annotations.\n\n" u"Add XML tags: output segments correspond to input segments\n" u"and each word is tagged in XML as a 'w' element with\n" u"lemma and POS-tag as attributes."), ) gui.separator(self.optionsBox, height=3) gui.checkBox( widget=self.optionsBox, master=self, value="replaceUnknown", label="Output token in place of [unknown] lemmas", callback=self.sendButton.settingsChanged, tooltip=( u"For out-of-vocabulary words, the word form is used as the\n" u"lemma (in place of Treetagger's default 'unknown' code)."), ) gui.rubber(self.controlArea) self.sendButton.draw() self.infoBox.draw() self.locateTreetaggerBox = gui.widgetBox( self.controlArea, addSpace=False, ) gui.separator(self.locateTreetaggerBox, height=3) self.treetaggerButton = gui.button( widget=self.locateTreetaggerBox, master=self, label="Locate Treetagger", callback=self.validateTreetagger, tooltip=( u"Click to select the location of the Treetagger base\n" u"directory (containing the 'lib' and 'bin' subdirectories)."), ) self.sendButton.sendIf() self.adjustSizeWithTimer()
def __init__(self): """Widget creator.""" super().__init__() # ATTRIBUTS # searchFunction self.searchResults = None self.inputSeg = None # newQuery = attribut box lineEdit (search something) self.newQuery = '' # Results box attributs self.titleLabels = list() self.selectedTitles = list() # selections box attributs self.myTitles = list() self.mytitleLabels = list() # stock all the inputs (scripts) in a list self.createdInputs = list() # stock the part of dictionary that will be used to access script's page self.path_storage = dict() # stock titles of movies self.movie_titles = list() # stock all the movies titles and link parts self.title_to_href = dict() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) # User interface... # Create the working area queryBox = gui.widgetBox( widget=self.controlArea, box="Search movie", orientation="vertical", ) searchBox = gui.widgetBox( widget=queryBox, orientation="horizontal", ) # Allows to enter specific text to the research # Uses "newQuery" attribute gui.lineEdit( widget=searchBox, master=self, value='newQuery', orientation='horizontal', labelWidth=100, tooltip=("Enter a movie title"), ) # Research button # Use "searchFunction" attibute self.searchButton = gui.button( widget=searchBox, master=self, label='Search', callback=self.searchFunction, tooltip='Search for the movie', ) gui.separator(widget=queryBox, height=3) # Button that refresh all movie titles from the website self.refreshButton = gui.button( widget=queryBox, master=self, label="Refresh database", callback=self.refreshTitles, tooltip="Update SpringfieldSpringfield database" ) # Box that displays search results self.titleListbox = gui.listBox( widget=queryBox, master=self, value="selectedTitles", # setting (list) labels="titleLabels", # setting (list) callback=lambda: self.selectButton.setDisabled( self.selectedTitles == list()), tooltip="Select the movie transcript you want to import", ) self.titleListbox.doubleClicked.connect(self.Add) self.titleListbox.setMinimumHeight(120) self.titleListbox.setSelectionMode(3) boxbutton = gui.widgetBox( widget=queryBox, box=False, orientation='horizontal', ) # Add button # Uses "Add" function self.selectButton = gui.button( widget=boxbutton, master=self, label="Add to corpus", callback=self.Add, tooltip="Add selected movie to the corpus", ) self.selectButton.setDisabled(True) # Clear button # Uses "clearResults" function self.clearButton = gui.button( widget=boxbutton, master=self, label="Clear results", callback=self.clearResults, tooltip="Clear results", ) self.clearButton.setDisabled(True) # Area where confirmed movies are moved and stocked mytitleBox = gui.widgetBox( widget=self.controlArea, box="Corpus", orientation="vertical", ) self.mytitleListbox = gui.listBox( widget=mytitleBox, master=self, value="myTitles", labels="mytitleLabels", callback=lambda: self.removeButton.setDisabled( self.myTitles == list()), tooltip="The list of titles whose content will be imported", ) self.mytitleListbox.doubleClicked.connect(self.Remove) self.mytitleListbox.setMinimumHeight(150) self.mytitleListbox.setSelectionMode(3) boxbutton2 = gui.widgetBox( widget=mytitleBox, box=False, orientation='horizontal', ) # Remove movies button self.removeButton = gui.button( widget=boxbutton2, master=self, label=u'Remove from corpus', callback=self.Remove, tooltip="Remove the selected movie from your corpus.", ) self.removeButton.setDisabled(True) # Delete all confirmed movies button self.clearmyBasket = gui.button( widget=boxbutton2, master=self, label=u'Clear corpus', callback=self.ClearmyCorpus, tooltip="Remove all movies from your corpus.", ) self.clearmyBasket.setDisabled(True) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button self.sendButton.draw() self.searchButton.setDefault(True) self.infoBox.draw() # This initialization step needs to be done after infoBox has been # drawn (because we may need to display an error message). self.loadDatabaseCache() # Make sure that whatever was in the corpus last time is deleted self.ClearmyCorpus() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # NONE BASIC SETTING self.inputData = None self.system = os.name self.user = os.environ.get("USER") self.langues = list() self.created_inputs = list() self.language = 0 self.check_firt_use = False self.createdInputs = list() self.compteur = 0 self.NoLink = True # liste des langues possible self.langues_possibles = { "French": ["french.par", "french-abbreviations"], "English": ["english-utf8.par", "english-abbreviations"], "German": ["german-utf8.par", "german-abbreviations"], "Italian": ["italian-utf8.par", "italian-abbreviations"], "Swahili": ["swahili.par", "swahili-abbreviations"], "Portuguese": ["portuguese.par", "portuguese-abbreviations"], "Russian": ["russian.par", "russian-abbreviations"], "Spanish": ["spanish-utf8.par", "spanish-abbreviations", "spanish-mwls"], "Slovenian": ["slovenian-utf8.par"], "Slovak": ["slovak2-utf8.par"], "Romanian": ["romanian.par"], "Polish": ["polish-utf8.par"], "Mongolian": ["mongolian.par"], "Latin": ["latin.par"], "Galician": ["galician.par"], "Finnish": ["finnish-utf8.par"], "Estonian": ["estonian.par"], "Bulgarian": ["bulgarian-utf8.par"], "Spoken French": ["spoken-french.par", "french-abbreviations"] } # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton(widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute=u"infoBox", sendIfPreCallback=self.updateGUI) # The AdvancedSettings class, also from TextableUtils, facilitates # the management of basic vs. advanced interface. An object from this # class (here assigned to self.advancedSettings) contains two lists # (basicWidgets and advancedWidgets), to which the corresponding # widgetBoxes must be added. # User interface... # OPTION BOX gui.separator(widget=self.controlArea, height=5) self.infoBox1 = gui.widgetBox(self.controlArea, u"Option", addSpace=True) # definir la langue self.langueBox = gui.comboBox(widget=self.infoBox1, master=self, value="language", items=self.langues, orientation=u"horizontal", label="Select text language :", callback=self.settings_changed) self.langueBox.setMaximumWidth(100) gui.separator(widget=self.controlArea, height=3) # Checkbox pour activer output avec code xml self.choix_xml = gui.checkBox(widget=self.infoBox1, master=self, value="activer_xml", label=" Output with XML code", callback=self.settings_changed) # Checkbox pour afficher unknown si le mot est inconnu self.choix_unknown = gui.checkBox(widget=self.infoBox1, master=self, value="unknown", label=" Output without '[unknown]'", callback=self.settings_changed) # The following lines: # Bouton pour aller cherche le lien vers treetagger... self.treetagger_box = gui.widgetBox( self.controlArea, u"Please, enter a correct path to TreeTagger :", addSpace=True) gui.button(widget=self.treetagger_box, master=self, label="Browse", callback=self.treetagger_search) gui.separator(widget=self.treetagger_box, height=3) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() # Send data if autoSend. self.sendButton.sendIf() # ajuster taille widjet self.adjustSizeWithTimer() # verifie lien treetagger self.treetagger_check()
def __init__(self): """Widget creator.""" super().__init__() #---------------------------------------------------------------------- # Other (non settings) attributes... self.inputSeg = None self.outputSeg = None self.html_outputSeg = None self.nlp = None self.cv = None if INSTALLED_MODELS: self.model = INSTALLED_MODELS[0] else: self.model = "" #---------------------------------------------------------------------- # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) #---------------------------------------------------------------------- # User interface... self.languageCombo = gui.comboBox( widget=self.controlArea, master=self, value="language", items=INSTALLED_MODELS[:], sendSelectedValue=True, orientation="horizontal", label="Input's language:", labelWidth=135, # Appeler autre méthode callback=self.languageChanged, tooltip=("Please select the text's language.\n"), ) box = gui.widgetBox(self.controlArea, "Language informations:") self.infoa = gui.widgetLabel( box, "More languages are available. \nTo access them, please use the spaCy widget to \ndownload the model first." ) self.lenghtMethodCombo = gui.comboBox( widget=self.controlArea, master=self, value="method", items=[ "Number of sentences", "Percentage of input's length", ], sendSelectedValue=True, orientation="horizontal", label="Define summary's length by:", labelWidth=180, #Add below call to method that activate/deactivate self.numSentsSpin or self.percentageSpin callback=self.summaryGui, tooltip=("How do you want to choose the summary's length ?"), ) self.numSentsSpin = gui.spin( widget=self.controlArea, master=self, value='numSents', label='Number of sentences : ', callback=self.sendButton.sendIf(), labelWidth=180, tooltip=('Select the number of sentences wanted for the summary.'), # Define max sentences according to input maxv=10, minv=1, step=1, ) self.percentageSpin = gui.spin( widget=self.controlArea, master=self, value='percentage', label='Length in %:', labelWidth=180, callback=self.sendButton.sendIf(), tooltip= ('Select the length of the summary in percentage of the input text.' ), maxv=99, minv=1, step=1, ) self.segmentBox = gui.comboBox( widget=self.controlArea, master=self, value="typeSeg", items=[ "Summarize all segments as one", "Summarize each segments individually", ], sendSelectedValue=True, orientation="horizontal", label="Segmentation", labelWidth=135, callback=self.maxNumSents, tooltip=("How should the input segments be summarized ? \n"), ) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input.", "warning") # Check that there's a model and if not call noLanguageModelWarning() if not self.model: self.noLanguageModelWarning()
def __init__(self): """Widget creator.""" super().__init__() # ATTRIBUTS # searchFunction self.searchResults = None self.inputSeg = None # newQuery = attribut box lineEdit (search something) self.titleQuery = '' self.authorQuery = '' self.nbr_results = 10 # Results box attributs self.titleLabels = list() self.selectedTitles = list() # selections box attributs self.myTitles = list() self.mytitleLabels = list() # stock all the inputs (songs) in a list self.createdInputs = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) #---------------------------------------------------------------------- # User interface... # Create the working area queryBox = gui.widgetBox( widget=self.controlArea, box="Search books", orientation="vertical", ) self.cacheGenerationButton = gui.button( widget=queryBox, master=self, label="Generate cache", callback=self.generate_cache, tooltip="Generate the gutenberg cache, this might take a while...", ) # Allows to enter specific text to the research # Uses "newQuery" attribut gui.lineEdit( widget=queryBox, master=self, value='titleQuery', orientation='horizontal', label=u"Title: ", labelWidth=120, tooltip=("Enter a string"), ) # gui.lineEdit( # widget=queryBox, # master=self, # value='authorQuery', # orientation='horizontal', # label=u"Author: ", # labelWidth=120, # tooltip=("Enter a string"), # ) # Allows to choose the wanted results numberp (10 by 10) queryNbr = gui.comboBox( widget=queryBox, master=self, value="nbr_results", items=[ "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "200", "300", "400", "500", "1000" ], sendSelectedValue=True, orientation="horizontal", label="Number of results: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Reasearch button # Uses "searchFunction" attribut self.searchButton = gui.button( widget=queryBox, master=self, label="Search", callback=self.search, tooltip="Connect Genius and make a research", ) self.titleListbox = gui.listBox( widget=queryBox, master=self, value="selectedTitles", # setting (list) labels="titleLabels", # setting (list) callback=lambda: self.addButton.setDisabled(self.selectedTitles == list()), tooltip="The list of titles whose content will be imported", ) self.titleListbox.setMinimumHeight(150) self.titleListbox.setSelectionMode(3) boxbutton = gui.widgetBox( widget=queryBox, box=False, orientation='horizontal', ) # Add songs button self.addButton = gui.button( widget=boxbutton, master=self, label=u'Add to corpus', callback=self.add, tooltip=(u"Move the selected book downward in your corpus."), ) self.addButton.setDisabled(True) # Clear button # Uses "clearResults" function self.clearButton = gui.button( widget=boxbutton, master=self, label="Clear results", callback=self.clearResults, tooltip="Clear results", ) self.clearButton.setDisabled(True) gui.separator(widget=queryBox, height=3) # area where confirmed songs are moved and stocked mytitleBox = gui.widgetBox( widget=self.controlArea, box="Corpus", orientation="vertical", ) self.mytitleListbox = gui.listBox( widget=mytitleBox, master=self, value="myTitles", labels="mytitleLabels", callback=lambda: self.removeButton.setDisabled(self.myTitles == list()), tooltip="The list of books which will be imported", ) self.mytitleListbox.setMinimumHeight(150) self.mytitleListbox.setSelectionMode(3) boxbutton2 = gui.widgetBox( widget=mytitleBox, box=False, orientation='horizontal', ) # Remove songs button self.removeButton = gui.button( widget=boxbutton2, master=self, label=u'Remove from corpus', callback=self.remove, tooltip=(u"Remove the selected book from your corpus."), ) self.removeButton.setDisabled(True) # Delete all confirmed texts button self.clearmyBasketButton = gui.button( widget=boxbutton2, master=self, label=u'Clear corpus', callback=self.clearmyBasket, tooltip=(u"Remove all books from your corpus."), ) self.clearmyBasketButton.setDisabled(True) gui.separator(widget=mytitleBox, height=3) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button self.sendButton.draw() self.searchButton.setDefault(True) self.infoBox.draw() # Update the selections list self.updateMytitleLabels() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): super().__init__() # Search filters attributs self.newQuery = '' self.type_results = 'Title' #self.genre_searched = 'Comedy' self.filter_results = 'Popularity' self.nbr_results = '10' # Results box attributs self.titleLabels = list() self.selectedTitles = list() # selections box attributs self.myTitles = list() self.mytitleLabels = list() # stocks the imdbpy instance self.ia = imdb.IMDb() # stock all the inputs (movie names) in a list self.createdInputs = list() # Mandatory declaration of the info box and the send button self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute='infoBox', sendIfPreCallback=None, ) #---------------------------------------------------------------------- # User interface... # Creation of the different working areas self.queryBox = gui.widgetBox( widget=self.controlArea, box="Query", orientation="horizontal", ) self.genreBox = gui.widgetBox( widget=self.controlArea, box="Query", orientation="horizontal", ) self.filterBox = gui.widgetBox( widget=self.controlArea, box="Query options", orientation="horizontal", ) searchButtonBox = gui.widgetBox( widget=self.controlArea, orientation="vertical", ) resultBox = gui.widgetBox( widget=self.controlArea, box="Search results", orientation="vertical", ) # List Box where all the searched movies are stocked self.titleListbox = gui.listBox( widget=resultBox, master=self, value="selectedTitles", labels="titleLabels", callback=lambda: self.addButton.setDisabled(self.selectedTitles == list()), tooltip="The list of titles whose content will be imported", ) self.titleListbox.doubleClicked.connect(self.addToCorpus) self.titleListbox.setMinimumHeight(150) self.titleListbox.setSelectionMode(3) resultButtonBox = gui.widgetBox( widget=resultBox, box=False, orientation='horizontal', ) corpusBox = gui.widgetBox( widget=self.controlArea, box="Corpus", orientation="vertical", ) # Corpus where confirmed movies are moved and stocked self.mytitleListbox = gui.listBox( widget=corpusBox, master=self, value="myTitles", labels="mytitleLabels", callback=lambda: self.removeButton.setDisabled(self.myTitles == list()), tooltip="The list of titles whose content will be imported", ) self.mytitleListbox.doubleClicked.connect(self.remove) self.mytitleListbox.setMinimumHeight(150) self.mytitleListbox.setSelectionMode(3) corpusButtonBox = gui.widgetBox( widget=corpusBox, box=False, orientation='horizontal', ) # Allows to enter specific text to the research gui.lineEdit( widget=self.queryBox, master=self, value='newQuery', orientation='horizontal', label=u"Search: ", labelWidth=120, tooltip=("Enter a string"), ) # Allows to choose a type of search searchType = gui.comboBox( widget=self.queryBox, master=self, value="type_results", items=[ "Title", "Actor", #"Genre", ], sendSelectedValue=True, callback=self.mode_changed, orientation="horizontal", label="Search by: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) """genreTypes = gui.comboBox( widget=self.genreBox, master=self, value="genre_searched", items=[ "Comedy", "Action", "Drama", "Horror", ], sendSelectedValue=True, orientation="horizontal", label="Search Type: ", labelWidth=120, tooltip=( "Please select the desired search.\n" ), ) """ searchTypeGenre = gui.comboBox( widget=self.genreBox, master=self, value="type_results", items=[ "Title", "Actor", "Genre", ], sendSelectedValue=True, callback=self.mode_changed, orientation="horizontal", label="Search Type: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Allows to chose a filter for the search self.searchFilter = gui.comboBox( widget=self.filterBox, master=self, value="filter_results", items=[ "Year", "Alphabetical", "Random", ], sendSelectedValue=True, orientation="horizontal", label="Sort by: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Allows to choose the wanted results numberp (10 by 10) self.searchNbr = gui.comboBox( widget=self.filterBox, master=self, value="nbr_results", items=[ "10", "20", "30", "40", "50", ], sendSelectedValue=True, orientation="horizontal", label="Results' number: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Reasearch button # Uses "searchMovies" attribute self.searchButton = gui.button( widget=searchButtonBox, master=self, label="Search", callback=self.searchMovies, tooltip="Connect to imdbpy and make a research", ) # Add movies button self.addButton = gui.button( widget=resultButtonBox, master=self, label=u'Add to corpus', callback=self.addToCorpus, tooltip=(u"Move the selected movie downward in your corpus."), ) self.addButton.setDisabled(True) # Clear button # Uses "clearResults" function self.clearButton = gui.button( widget=resultButtonBox, master=self, label="Clear results", callback=self.clearResults, tooltip="Clear results", ) self.clearButton.setDisabled(True) #gui.separator(widget=queryBox, height=3) # Remove movie button self.removeButton = gui.button( widget=corpusButtonBox, master=self, label=u'Remove from corpus', callback=self.remove, tooltip=(u"Remove the selected movie from your corpus."), ) self.removeButton.setDisabled(True) # Delete all confirmed movies button self.clearmyBasket = gui.button( widget=corpusButtonBox, master=self, label=u'Clear corpus', callback=self.clearCorpus, tooltip=(u"Remove all movies from your corpus."), ) self.clearmyBasket.setDisabled(True) gui.separator(widget=corpusBox, height=3) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button self.sendButton.draw() self.searchButton.setDefault(True) self.infoBox.draw() #self.mode_changed() self.updateCorpus() self.mode_changed() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.inputSeg = None self.morphology = dict() self.selectedMainWord = None self.mainWords = list() self.selectedParse = None self.parses = list() self.selectedStemForParse = None self.stemsForParse = list() self.selectedSuffixForParse = None self.suffixesForParse = list() self.selectedMainSignature = None self.mainSignatures = list() self.wordsForSig = list() self.stemsForSig = list() self.suffixesForSig = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) # User interface... # A) Control area... # Options box... optionsBox = gui.widgetBox( widget=self.controlArea, box="Options", orientation="vertical", ) gui.spin( widget=optionsBox, master=self, value='minStemLen', label='Minimum length of stems: ', callback=self.sendButton.sendIf, labelWidth=180, tooltip=( 'Select the minimum number of required characters in stems'), minv=LOWER_MIN_STEM_LEN, maxv=MAX_MORPH_LEN, step=1, ) gui.separator(widget=optionsBox, height=2) gui.rubber(self.controlArea) # B) Main area... font = QFont() font.setFamily('Courier') font.setStyleHint(QFont.Courier) font.setPixelSize(12) # Tabs... self.tabs = QTabWidget() self.wordTab = QWidget() self.signatureTab = QWidget() self.tabs.addTab(self.wordTab, "Words") self.tabs.addTab(self.signatureTab, "Signatures") # Words tab... wordTabBox = QHBoxLayout() wordBox = gui.widgetBox( widget=self.wordTab, orientation="horizontal", margin=5, ) wordBoxRight = gui.widgetBox(widget=wordBox) self.mainWordListbox = gui.listBox( widget=wordBoxRight, master=self, value="selectedMainWord", labels="mainWords", callback=self.mainWordSelected, tooltip="Select a word to display its possible parses.", ) self.mainWordListbox.setFont(font) gui.separator(widget=wordBox, width=3) wordBoxLeft = gui.widgetBox(widget=wordBox) gui.label( widget=wordBoxLeft, master=self, label="Parse(s):", ) self.parsesListbox = gui.listBox( widget=wordBoxLeft, master=self, value="selectedParse", labels="parses", callback=self.parseSelected, tooltip="Select a parse to display the corresponding signature.", ) self.parsesListbox.setFont(font) self.sigForParseBox = gui.widgetBox( widget=wordBoxLeft, box="Signature", ) gui.label( widget=self.sigForParseBox, master=self, label="Stem(s):", ) self.stemsForParseListbox = gui.listBox( widget=self.sigForParseBox, master=self, labels="stemsForParse", tooltip="Stems associated with the parse selected above.", ) gui.separator(widget=self.sigForParseBox, height=2) gui.label( widget=self.sigForParseBox, master=self, label="Suffixes(s):", ) self.suffixesForParseListbox = gui.listBox( widget=self.sigForParseBox, master=self, labels="suffixesForParse", tooltip="Suffixes associated with the parse selected above.", ) wordTabBox.addWidget(wordBox) self.wordTab.setLayout(wordTabBox) # Signature tab... signatureTabBox = QHBoxLayout() signatureBox = gui.widgetBox( widget=self.signatureTab, orientation="horizontal", margin=5, ) signatureBoxRight = gui.widgetBox(widget=signatureBox) self.mainSignatureListbox = gui.listBox( widget=signatureBoxRight, master=self, value="selectedMainSignature", labels="mainSignatures", callback=self.mainSignatureSelected, tooltip="Select a signature to display its contents.", ) self.mainSignatureListbox.setFont(font) gui.separator(widget=signatureBox, width=3) signatureBoxLeft = gui.widgetBox(widget=signatureBox) gui.label( widget=signatureBoxLeft, master=self, label="Words:", ) self.wordsForSigListbox = gui.listBox( widget=signatureBoxLeft, master=self, labels="wordsForSig", tooltip="Words associated with the selected signature.", ) self.wordsForSigListbox.setFont(font) gui.label( widget=signatureBoxLeft, master=self, label="Stem(s):", ) self.stemsForSigListbox = gui.listBox( widget=signatureBoxLeft, master=self, labels="stemsForSig", tooltip="Stems associated with the selected signature.", ) self.stemsForSigListbox.setFont(font) gui.label( widget=signatureBoxLeft, master=self, label="Suffixes(s):", ) self.suffixesForSigListbox = gui.listBox( widget=signatureBoxLeft, master=self, labels="suffixesForSig", tooltip="Suffixes associated with the selected signature.", ) self.suffixesForSigListbox.setFont(font) signatureTabBox.addWidget(signatureBox) self.signatureTab.setLayout(signatureTabBox) self.mainArea.layout().addWidget(self.tabs) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input", "warning") self.setMinimumWidth(602) self.setMinimumHeight(317) self.adjustSizeWithTimer() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self, caller): """Widget creator.""" super().__init__() # Variable to communicate with the base widjet by calling # self.creator.vriable_name self.caller = caller # Other attributes... self.inputSeg = None self.outputSeg = None # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) # Temporary dictionary so that the user can cancel changes self.tempDict = defaultDict.copy() # User interface... # CONTROL AREA # # Options box for the structure titleListBox = gui.widgetBox( widget=self.controlArea, box="Lists", orientation="horizontal", ) # SAVE AREA # (After the control one but need to be first for the savechange button) SaveBox = gui.widgetBox( widget=self.controlArea, box=None, orientation="horizontal", ) self.SaveChanges = gui.button( widget=SaveBox, master=self, label="Save changes", callback=self.saveChanges, width=130, ) self.CancelChanges = gui.button( widget=SaveBox, master=self, label="Cancel", callback=self.closeWindow, width=130, ) # END OF SAVE AREA # List of Lexical list that the user can select self.titleLabelsList = gui.listBox( widget=titleListBox, master=self, value="selectedFields", # setting (list) labels="titleList", # setting (list) tooltip= "The list of lexical list that you want to use for annotation", callback=self.updateGUI, ) self.titleLabelsList.setMinimumHeight(300) self.titleLabelsList.setMinimumWidth(150) self.titleLabelsList.setSelectionMode(1) # a box for vertical align of the button controlBox = gui.widgetBox( widget=titleListBox, box=None, orientation="vertical", ) # Actions on list self.EditList = gui.button( widget=controlBox, master=self, label="Edit", callback=self.setEditContent, width=130, autoDefault=False, ) self.ImportList = gui.button( widget=controlBox, master=self, label="Import", callback=self.importLexic, width=130, autoDefault=False, ) self.ExportList = gui.button( widget=controlBox, master=self, label="Export All", callback=self.exportAllLexics, width=130, ) self.ExportSelectedList = gui.button( widget=controlBox, master=self, label="Export Selected", callback=self.exportOneLexic, width=130, ) self.NewList = gui.button( widget=controlBox, master=self, label="New", callback=self.newLexicalField, width=130, ) self.ClearList = gui.button( widget=controlBox, master=self, label="Clear all", callback=self.clearList, width=130, ) self.RemoveSelectedList = gui.button( widget=controlBox, master=self, label="Remove Selected", callback=self.deleteSelectedList, width=130, ) # MAIN AREA (edit list) # # structure ... listEditBox = gui.widgetBox( widget=self.mainArea, box="Edit", orientation="vertical", ) listEditBox.setMinimumWidth(300) # Edit the titile of the list self.titleEdit = gui.lineEdit( widget=listEditBox, master=self, value="listTitle", label="List name", orientation="vertical", ) # Editable text Field. Each line gonna be a enter of # the lexical list selected self.ContentLabel = gui.label( widget=listEditBox, master=self, label="List content", ) self.editor = QPlainTextEdit() listEditBox.layout().addWidget(self.editor) self.editor.setMinimumHeight(300) buttonEditBox = gui.widgetBox(widget=listEditBox, box=None, orientation="horizontal") # For saving the chang on the list edit self.CommitList = gui.button( widget=buttonEditBox, master=self, label="Commit", callback=self.saveEdit, width=100, ) self.CancelList = gui.button(widget=buttonEditBox, master=self, label="Cancel list changes", callback=self.cancelListChanges, width=100) gui.rubber(self.controlArea) self.setTitleList() self.updateGUI() # Now Info box and Send button must be drawn... self.infoBox.draw() # Set the window as modal self.exec()
def __init__(self): """Widget creator.""" super().__init__() #---------------------------------------------------------------------- # Other (non settings) attributes... self.inputSeg = None self.selectedCharacters = list() self.characters = list() if spacy_widget.INSTALLED_MODELS: self.model = spacy_widget.INSTALLED_MODELS[0] self.mustInstall = False else: self.model = "" self.mustInstall = True self.editsWereMade = False #---------------------------------------------------------------------- # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) #---------------------------------------------------------------------- # User interface... # Sample box... self.optionsBox = gui.widgetBox( widget=self.controlArea, box="Options", orientation="vertical", ) # self.sourceTypeCombo = gui.comboBox( # widget=self.optionsBox, # master=self, # value="sourceType", # sendSelectedValue=True, # items=["Plain text", "IMSDB-formatted script"], # orientation="horizontal", # label="Source type:", # labelWidth=120, # callback=self.changeSourceType, # tooltip=( # "TODO\n" # "TODO\n" # "TODO\n" # ), # ) self.spacyModelCombo = gui.comboBox( widget=self.optionsBox, master=self, value="model", sendSelectedValue=True, items=spacy_widget.INSTALLED_MODELS, orientation="horizontal", label="SpaCy model:", labelWidth=120, callback=self.loadModel, tooltip=("Choose spaCy model for named entity recognition."), ) # gui.separator(widget=self.optionsBox, height=3) # minFreqSpin = gui.spin( # widget=self.optionsBox, # master=self, # value='minFreq', # minv=1, # maxv=1000, # orientation='horizontal', # label="Minimum frequency:", # labelWidth=120, # callback=self.sendButton.settingsChanged, # keyboardTracking=False, # tooltip=( # "TODO\n" # "TODO\n" # "TODO\n" # ), # ) # gui.separator(widget=self.optionsBox, height=3) # Character box... self.characterBox = gui.widgetBox( widget=self.controlArea, box="Edit character list", orientation="vertical", ) characterListbox = gui.listBox( widget=self.characterBox, master=self, value="selectedCharacters", labels="characters", callback=self.updateButtons, tooltip="List of identified characters", ) # TODO set min height self.characterButtonBox = gui.widgetBox( widget=self.characterBox, orientation="horizontal", ) self.newButton = gui.button( widget=self.characterButtonBox, master=self, label="New", callback=self.newCharacter, tooltip="Add a new entry to the character list.", ) self.editButton = gui.button( widget=self.characterButtonBox, master=self, label="Edit", callback=self.editCharacters, tooltip="Add the selected character list entry.", ) self.deleteButton = gui.button( widget=self.characterButtonBox, master=self, label="Delete", callback=self.deleteCharacter, tooltip="Delete the selected character list entry.", ) self.resetButton = gui.button( widget=self.characterButtonBox, master=self, label="Reset", callback=self.resetCharacters, tooltip="Revert all changes made to character list.", ) self.updateButtons() gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input.", "warning") # Check that there's a model... if self.mustInstall: self.noLanguageModelWarning() else: self.loadModel()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Other attributes... self.segmentation = None self.operation = "no" self.applyInclusion = False self.applyExclusion = False self.applySampling = True self.samplingRate = 100 self.createdInputs = list() self.folderLabels = list() self.selectedFolderLabels = list() self.rootFolderPath = u'' self.inclusionsUser = u'' self.exclusionsUser = u'' self.newAnnotationKey = u'' self.newAnnotationValue = u'' # self.folder is a dictionary whose keys are :'rootPath', 'maxDepth','inclusionsUser','exclusionsUser', ... # ... 'samplingRate' and 'fileList' self.folder = dict() # self.folders is a list of previously defined "self.folder" dictionaries self.folders = list() # self.inclusionList is the default inclusion list (used in minimal mode, ... # ... and in advanced mode when no inclusion has been selected) self.inclusionList = [".txt", ".html", ".xml", ".csv", ".rtf"] # self.inclusionList is the default null inclusion list (used in minimal mode, ... # ... and in advanced mode when no inclusion has been selected) self.exclusionList = [] self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute='infoBox', sendIfPreCallback=self.updateGUI, ) self.advancedSettings = AdvancedSettings( widget=self.controlArea, master=self, callback=self.sendButton.settingsChanged, ) # GUI... # Advanced settings checkbox... self.advancedSettings.draw() # BASIC GUI... # Basic folder box basicFolderBox = gui.widgetBox( widget=self.controlArea, box=u'Source', orientation='vertical', addSpace=False, ) basicFolderBoxLine1 = gui.widgetBox( widget=basicFolderBox, box=False, orientation='horizontal', ) gui.lineEdit( widget=basicFolderBoxLine1, master=self, value='rootFolderPath', orientation='horizontal', label=u'Folder path:', labelWidth=101, callback=self.add, tooltip=(u"The path of the folder."), ) gui.separator(widget=basicFolderBoxLine1, width=5) gui.button( widget=basicFolderBoxLine1, master=self, label=u'Browse', callback=self.browse, tooltip=(u"Open a dialog for selecting a top folder."), ) gui.separator(widget=basicFolderBox, width=3) self.advancedSettings.basicWidgets.append(basicFolderBox) self.advancedSettings.basicWidgetsAppendSeparator() # ADVANCED GUI... # folder box folderBox = gui.widgetBox( widget=self.controlArea, box=u'Sources', orientation='vertical', addSpace=False, ) folderBoxLine1 = gui.widgetBox( widget=folderBox, box=False, orientation='horizontal', addSpace=True, ) self.folderListbox = gui.listBox( widget=folderBoxLine1, master=self, value='selectedFolderLabels', labels='folderLabels', callback=self.updatefolderBoxButtons, tooltip=(u"The list of folders whose content will be imported.\n" u"\nIn the output segmentation, the content of each\n" u"folder appears in the same position as in the list.\n" u"\nColumn 1 shows the folder's name.\n" u"Column 2 shows the folder's depth.\n" u"Column 3 shows the inclusions filter.\n" u"Column 4 shows the exclusions filter.\n" u"Column 5 shows the folder's level of sampling."), ) font = QFont() font.setFamily('Courier') font.setStyleHint(QFont.Courier) font.setPixelSize(12) self.folderListbox.setFont(font) folderBoxCol2 = gui.widgetBox( widget=folderBoxLine1, orientation='vertical', ) self.moveUpButton = gui.button( widget=folderBoxCol2, master=self, label=u'Move Up', callback=self.moveUp, tooltip=(u"Move the selected folder upward in the list."), ) self.moveDownButton = gui.button( widget=folderBoxCol2, master=self, label=u'Move Down', callback=self.moveDown, tooltip=(u"Move the selected folder downward in the list."), ) self.removeButton = gui.button( widget=folderBoxCol2, master=self, label=u'Remove', callback=self.remove, tooltip=(u"Remove the selected folder from the list."), ) self.clearAllButton = gui.button( widget=folderBoxCol2, master=self, label=u'Clear All', callback=self.clearAll, tooltip=(u"Remove all folders from the list."), ) self.exportButton = gui.button( widget=folderBoxCol2, master=self, label=u'', callback=self.exportList, disabled=True, tooltip=(u"Open a dialog for selecting a folder where the folder\n" u"list can be exported in JSON format."), ) self.importButton = gui.button( widget=folderBoxCol2, master=self, label=u'', callback=self.importList, disabled=True, tooltip=(u"Open a dialog for selecting a folder list to\n" u"import (in JSON format). folders from this list\n" u"will be added to those already imported."), ) folderBoxLine2 = gui.widgetBox( widget=folderBox, box=False, orientation='vertical', ) # Add folder box addFolderBox = gui.widgetBox( widget=folderBoxLine2, box=True, orientation='vertical', ) addFolderBoxLine1 = gui.widgetBox( widget=addFolderBox, orientation='horizontal', ) # Folder path input gui.lineEdit( widget=addFolderBoxLine1, master=self, value='rootFolderPath', orientation='horizontal', label=u'Folder path:', labelWidth=101, callback=self.updateGUI, tooltip=(u"The paths of the folders that will be added to the\n" u"list when button 'Add' is clicked.\n\n" u"Successive paths must be separated with ' / ' \n" u"(whitespace + slash + whitespace). Their order in\n" u"the list will be the same as in this field."), ) gui.separator(widget=addFolderBoxLine1, width=5) # Button Browse gui.button( widget=addFolderBoxLine1, master=self, label=u'Browse', callback=self.browse, tooltip=(u"Open a dialog for selecting a top folder.\n\n" u"Selected folder paths will appear in the field to\n" u"the left of this button afterwards, ready to be\n" u"added to the list when button 'Add' is clicked."), ) gui.separator(widget=addFolderBox, width=10) # Filter box to input include gui.separator(widget=addFolderBox, width=3) includeBoxLine1 = gui.widgetBox( widget=addFolderBox, box=False, orientation='horizontal', ) # Include box gui.checkBox( widget=includeBoxLine1, master=self, value='applyInclusion', label=u'Include', labelWidth=100, callback=lambda: includeLineEdit.setDisabled(not self. applyInclusion), tooltip=(u"Choose the inclusion(s)"), ) includeLineEdit = gui.lineEdit( widget=includeBoxLine1, master=self, value='inclusionsUser', orientation='horizontal', label=u'', disabled=True, labelWidth=101, tooltip=(u"This field lets you specify a custom filter\n" u"to select the folders to be\n" u"added to the list."), ) # Filter box to exclude gui.separator(widget=addFolderBox, width=3) excludeBoxLine1 = gui.widgetBox( widget=addFolderBox, box=False, orientation='horizontal', ) # Exclude box gui.checkBox( widget=excludeBoxLine1, master=self, value='applyExclusion', label=u'Exclude', labelWidth=100, disabled=False, callback=lambda: includeLineEdit2.setDisabled(not self. applyExclusion), tooltip=(u"Exclude the inclusion(s)"), ) includeLineEdit2 = gui.lineEdit( widget=excludeBoxLine1, master=self, value='exclusionsUser', orientation='horizontal', label=u'', disabled=True, labelWidth=101, tooltip=(u"This field lets you specify a custom filter\n" u"to select the folders to be\n" u"added to the list."), ) # Sampling box to input the level of sampling gui.separator(widget=addFolderBox, width=3) samplingBoxLine1 = gui.widgetBox( widget=addFolderBox, box=False, orientation='horizontal', ) # Check box for sampling gui.checkBox( widget=samplingBoxLine1, master=self, value='applySampling', label=u'Sampling', labelWidth=100, disabled=False, callback=lambda: samplingSpin.setDisabled(not self.applySampling), tooltip=(u"Choose the sampling level"), ) samplingSpin = gui.spin( widget=samplingBoxLine1, master=self, value='samplingRate', minv=10, maxv=100, labelWidth=50, orientation='horizontal', tooltip=(u"sampling level"), ) gui.separator(widget=addFolderBox, width=3) self.addButton = gui.button( widget=addFolderBox, master=self, label=u'Add', callback=self.add, tooltip=(u"Add the folder(s) currently displayed in the\n" u"'folders' text field to the list.\n\n" u"Each of these folders will be associated with the\n" u"specified encoding and annotation (if any).\n\n" u"Other folders may be selected afterwards and\n" u"assigned a different encoding and annotation."), ) self.advancedSettings.advancedWidgets.append(folderBox) self.advancedSettings.advancedWidgetsAppendSeparator() # Options box... optionsBox = gui.widgetBox( widget=self.controlArea, box=u'Options', orientation='vertical', addSpace=False, ) optionsBoxLine1 = gui.widgetBox( widget=optionsBox, box=False, orientation='horizontal', ) gui.separator(widget=optionsBox, width=3) optionsBoxLine2 = gui.widgetBox( widget=optionsBox, box=False, orientation='horizontal', ) gui.checkBox( widget=optionsBoxLine2, master=self, value='autoNumber', label=u'Auto-number with key:', labelWidth=180, callback=self.sendButton.settingsChanged, tooltip=(u"Annotate folders with increasing numeric indices."), ) self.autoNumberKeyLineEdit = gui.lineEdit( widget=optionsBoxLine2, master=self, value='autoNumberKey', orientation='horizontal', callback=self.sendButton.settingsChanged, tooltip=(u"Annotation key for folder auto-numbering."), ) gui.separator(widget=optionsBox, width=3) self.advancedSettings.advancedWidgets.append(optionsBox) self.advancedSettings.advancedWidgetsAppendSeparator() gui.rubber(self.controlArea) # Send button... self.sendButton.draw() # Info box... self.infoBox.draw() self.adjustSizeWithTimer() QTimer.singleShot(0, self.sendButton.sendIf)
def __init__(self): """Widget creator.""" super().__init__() if INSTALLED_MODELS: self.model = INSTALLED_MODELS[0] else: self.model = "" # Other attributes... self.inputSeg = None self.nlp = None self.selectedModels = list() self.downloadableModelLabels = list() self.loadedComponents = list() self.mustLoad = True # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) # User interface... # Tabs... self.tabs = QTabWidget() self.optionsTab = QWidget() self.modelManagerTab = QWidget() self.tabs.addTab(self.optionsTab, "Options") self.tabs.addTab(self.modelManagerTab, "Model manager") # Options tab... OptionsTabBox = QHBoxLayout() optionsBox = gui.widgetBox(widget=self.optionsTab) self.modelComboBox = gui.comboBox( widget=optionsBox, master=self, value='model', label='Model: ', tooltip='Select the spaCy language model you want to use.', items=INSTALLED_MODELS[:], sendSelectedValue=True, callback=self.modelComboboxChanged, ) gui.separator(widget=optionsBox, height=3) annotationsBox = gui.widgetBox( widget=optionsBox, box="Additional token annotations:", ) annotationsBoxLine1 = gui.widgetBox( widget=annotationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=annotationsBoxLine1, master=self, value='annotatePOSTags', label='part-of-speech tags', callback=self.updateDisabledComponents, tooltip=("Annotate output tokens with part-of-speech tags."), ) self.annotatePOSTagsReloadLabel = gui.label( annotationsBoxLine1, master=self, label="(reload needed)", ) self.annotatePOSTagsReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) annotationsBoxLine2 = gui.widgetBox( widget=annotationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=annotationsBoxLine2, master=self, value='annotateDependencies', label='syntactic dependencies', callback=self.updateDisabledComponents, tooltip=("Annotate output tokens with syntactic dependencies."), ) self.annotateDependenciesReloadLabel = gui.label( annotationsBoxLine2, master=self, label="(reload needed)", ) self.annotateDependenciesReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) annotationsBoxLine3 = gui.widgetBox( widget=annotationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=annotationsBoxLine3, master=self, value='annotateEntities', label='named entities', callback=self.updateDisabledComponents, tooltip=("Annotate output tokens with named entities."), ) self.annotateEntitiesReloadLabel = gui.label( annotationsBoxLine3, master=self, label="(reload needed)", ) self.annotateEntitiesReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) segmentationsBox = gui.widgetBox( widget=optionsBox, box="Additional segmentations:", ) segmentationsBoxLine1 = gui.widgetBox( widget=segmentationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=segmentationsBoxLine1, master=self, value='segmentEntities', label='named entities', callback=self.updateDisabledComponents, tooltip="Output named entity segmentation on separate channel.", ) self.segmentEntitiesReloadLabel = gui.label( segmentationsBoxLine1, master=self, label="(reload needed)", ) self.segmentEntitiesReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) segmentationsBoxLine2 = gui.widgetBox( widget=segmentationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=segmentationsBoxLine2, master=self, value='segmentChunks', label='noun chunks', callback=self.updateDisabledComponents, tooltip="Output noun chunk segmentation on separate channel.", ) self.segmentChunksReloadLabel = gui.label( segmentationsBoxLine2, master=self, label="(reload needed)", ) self.segmentChunksReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) segmentationsBoxLine3 = gui.widgetBox( widget=segmentationsBox, orientation="horizontal", box=None, ) gui.checkBox( widget=segmentationsBoxLine3, master=self, value='segmentSentences', label='sentences', callback=self.updateDisabledComponents, tooltip="Output sentence segmentation on separate channel.", ) self.segmentSentencesReloadLabel = gui.label( segmentationsBoxLine3, master=self, label="(reload needed)", ) self.segmentSentencesReloadLabel.setStyleSheet( "font-style: oblique; color: gray" ) self.updateReloadNeededLabels() gui.comboBox( widget=optionsBox, master=self, value='maxLen', items=["1 million"] + ["%i millions" % l for l in range(2, 10)] \ + ["no limit"], sendSelectedValue=True, label=u'Max number of input characters:', tooltip=( "The spaCy parser and NER models require roughly 1GB of\n" "temporary memory per 100'000 characters in the input.\n" "This means long texts may cause memory allocation errors.\n" "If you're not using the parser or NER, or have lots of \n" "RAM, it's probably safe to increase the default limit of\n" "1 million characters." ), ) gui.rubber(optionsBox) OptionsTabBox.addWidget(optionsBox) self.optionsTab.setLayout(OptionsTabBox) # Model manager tab... modelManagerTabBox = QHBoxLayout() modelManagerBox = gui.widgetBox(widget=self.modelManagerTab) gui.label(modelManagerBox, self, label="Available models:") self.downloadableModelsListbox = gui.listBox( widget=modelManagerBox, master=self, value="selectedModels", labels="downloadableModelLabels", callback=self.downloadableModelsListboxChanged, tooltip="Select language models then click Download.", ) self.downloadableModelsListbox.setSelectionMode(3) self.downloadableModelLabels = DOWNLOADABLE_MODELS[:] self.downloadableModelLabels = self.downloadableModelLabels self.downloadButton = gui.button( widget=modelManagerBox, master=self, label="Download", callback=self.downloadModels, tooltip="Download the selected language models.", ) self.downloadButton.setDisabled(True) modelManagerTabBox.addWidget(modelManagerBox) self.modelManagerTab.setLayout(modelManagerTabBox) self.controlArea.layout().addWidget(self.tabs) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input.", "warning") # Check that there's a model... if not self.model: self.infoBox.setText( "Please download a language model first.", "warning", ) self.tabs.setCurrentIndex(1) optionsBox.setDisabled(True)
def __init__(self): """Widget creator.""" super().__init__() # Other (non-setting) attributes... self.fileSegmentation = None self.createdInputs = list() self.displayedFolderLabels = list() self.currentFolder = self.__class__.baseUrl self.database = None self.selectedInDisplayedFolder = list() self.selectedInSelection = list() self.selectionLabels = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) # User interface... # Browse database box browseBox = gui.widgetBox( widget=self.controlArea, box="Browse database", orientation="vertical", addSpace=False, ) self.currentFolderLabel = gui.label( widget=browseBox, master=self, label="Current folder: /", tooltip="This is the currently displayed folder.", ) gui.separator(widget=browseBox, height=3) upwardNavBox = gui.widgetBox( widget=browseBox, box=False, orientation="horizontal", ) self.homeRefreshButton = gui.button( widget=upwardNavBox, master=self, label="Home", callback=self.homeRefreshPressed, ) self.backButton = gui.button( widget=upwardNavBox, master=self, label="Back", callback=self.backPressed, tooltip="View parent folder.", ) gui.separator(widget=browseBox, height=3) displayedFolderListbox = gui.listBox( widget=browseBox, master=self, value="selectedInDisplayedFolder", labels="displayedFolderLabels", callback=self.corpusSelected, tooltip="Select an item to open or import.", ) displayedFolderListbox.setMinimumHeight(120) displayedFolderListbox.setSelectionMode(3) displayedFolderListbox.doubleClicked.connect( self.displayedFoldersDoubleClicked) downwardNavBox = gui.widgetBox( widget=browseBox, box=False, orientation="horizontal", ) self.openButton = gui.button( widget=downwardNavBox, master=self, label="Open", callback=self.openPressed, tooltip="View selected folder's contents.", ) self.addButton = gui.button( widget=downwardNavBox, master=self, label="Add to selection", callback=self.addPressed, tooltip="Add selected items contents to selection.", ) gui.separator(widget=browseBox, height=3) # Selection box... selectionBox = gui.widgetBox( widget=self.controlArea, box="Selection", orientation="vertical", addSpace=False, ) selectionListbox = gui.listBox( widget=selectionBox, master=self, value="selectedInSelection", labels="selectionLabels", callback=lambda: self.removeButton.setDisabled( # TODO move self.selectedInSelection == list()), tooltip="The list of corpora whose content will be imported", ) selectionListbox.setMinimumHeight(120) selectionListbox.setSelectionMode(3) selectionListbox.doubleClicked.connect(self.selectionDoubleClicked) removalBox = gui.widgetBox( widget=selectionBox, box=False, orientation="horizontal", ) self.removeButton = gui.button( widget=removalBox, master=self, label="Remove from selection", callback=self.removePressed, tooltip="Remove the selected corpus.", ) self.clearButton = gui.button( widget=removalBox, master=self, label="Clear selection", callback=self.clearPressed, tooltip="Remove all corpora from selection.", ) gui.separator(widget=selectionBox, height=3) # Options box... optionsBox = gui.widgetBox( widget=self.controlArea, box="Options", orientation="vertical", addSpace=False, ) gui.checkBox( widget=optionsBox, master=self, value='outputUtterances', label=u'Output utterance segmentation', callback=self.sendButton.settingsChanged, tooltip=u"Toggle emission of utterance segmentation on or off.", ) gui.separator(widget=optionsBox, height=1) gui.checkBox( widget=optionsBox, master=self, value='outputWords', label=u'Output word segmentation', callback=self.toggleWordOptions, tooltip=u"Toggle emission of word segmentation on or off.", ) gui.separator(widget=optionsBox, height=1) self.wordOptionsBox = gui.indentedBox( widget=optionsBox, orientation="horizontal", addSpace=False, ) gui.label( widget=self.wordOptionsBox, master=self, labelWidth=135, label="Word stem includes: ", tooltip="Select the elements that will be added to the stem.", ) gui.checkBox( widget=self.wordOptionsBox, master=self, labelWidth=85, value='includePOSTag', label=u'POS-tag', callback=self.sendButton.settingsChanged, tooltip=u"Add the part-of-speech tag (e.g. door => N|door).", ) gui.checkBox( widget=self.wordOptionsBox, master=self, labelWidth=85, value='includePrefixes', label=u'prefixes', callback=self.sendButton.settingsChanged, tooltip=u"Include the prefix (e.g. write => re#write).", ) gui.separator(widget=self.controlArea, height=3) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() # This initialization step needs to be done after infoBox has been # drawn (because we may need to display an error message). self.loadDatabaseCache() self.updateSelection() # Send data if autoSend. self.sendButton.sendIf() self.setMinimumWidth(350) self.adjustSizeWithTimer()
def __init__(self): """Widget creator.""" super().__init__() # ATTRIBUTS # searchFunction self.searchResults = None self.inputSeg = None # newQuery = attribut box lineEdit (search something) self.newQuery = '' self.nbr_results = 10 # Results box attributs self.titleLabels = list() self.selectedTitles = list() # selections box attributs self.myTitles = list() self.mytitleLabels = list() # stock all the inputs (songs) in a list self.createdInputs = list() self.sendData = '' self.newQuery = '' # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) # User interface... # Create the working area queryBox = gui.widgetBox( widget=self.controlArea, box="Search movie", orientation="vertical", ) # Allows to enter specific text to the research # Uses "newQuery" attribut gui.lineEdit( widget=queryBox, master=self, value='newQuery', orientation='horizontal', label=u"Movie title: ", labelWidth=100, tooltip=("Enter a string"), ) # Allows to choose the wanted results numberp (10 by 10) queryNbr = gui.comboBox( widget=queryBox, master=self, value="nbr_results", items=[ "5", "10", "20", "30", "40", "50", ], sendSelectedValue=True, orientation="horizontal", label="Number of results: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Research button # Use "sendData" attibute self.searchButton = gui.button( widget=queryBox, master=self, label='search', callback=self.get_all_titles, tooltip='Search for the movie', ) self.searchButton.setDisabled(False) # Reasearch button # Uses "searchFunction" attribut self.titleListbox = gui.listBox( widget=queryBox, master=self, value="selectedTitles", # setting (list) labels="titleLabels", # setting (list) callback=lambda: self.addButton.setDisabled(self.selectedTitles == list()), tooltip="The list of titles whose content will be imported", ) self.titleListbox.setMinimumHeight(120) self.titleListbox.setSelectionMode(3) boxbutton = gui.widgetBox( widget=queryBox, box=False, orientation='horizontal', ) # select button # Uses "select" function self.selectButton = gui.button( widget=boxbutton, master=self, label="Select", # callback=self.clearResults, tooltip="Select", ) self.selectButton.setDisabled(True) # Clear button # Uses "clearResults" function self.clearButton = gui.button( widget=boxbutton, master=self, label="Clear results", # callback=self.clearResults, tooltip="Clear results", ) self.clearButton.setDisabled(True) gui.separator(widget=queryBox, height=3) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button # self.sendButton.draw() # self.searchButton.setDefault(True) self.infoBox.draw()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.segmentation = None self.createdInputs = list() self.titleSeg = None self.filteredTitleSeg = None self.filterValues = dict() self.base_url = \ u"http://www.eighteenthcenturypoetry.org/works/#genres" self.document_base_url = \ u"http://www.eighteenthcenturypoetry.org" # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=self.updateGUI, ) # The AdvancedSettings class, also from TextableUtils, facilitates # the management of basic vs. advanced interface. An object from this # class (here assigned to self.advancedSettings) contains two lists # (basicWidgets and advancedWidgets), to which the corresponding # widgetBoxes must be added. self.advancedSettings = AdvancedSettings( widget=self.controlArea, master=self, callback=self.updateFilterValueList, ) # User interface... # Advanced settings checkbox (basic/advanced interface will appear # immediately after it... self.advancedSettings.draw() # Filter box (advanced settings only) filterBox = gui.widgetBox( widget=self.controlArea, box="Filter", orientation="vertical", ) filterCriterionCombo = gui.comboBox( widget=filterBox, master=self, value="filterCriterion", items=["author", "genre"], sendSelectedValue=True, orientation="horizontal", label="Criterion:", labelWidth=120, callback=self.updateFilterValueList, tooltip=( "Please select a criterion for searching the title list\n"), ) filterCriterionCombo.setMinimumWidth(120) gui.separator(widget=filterBox, height=3) self.filterValueCombo = gui.comboBox( widget=filterBox, master=self, value="filterValue", sendSelectedValue=True, orientation="horizontal", label="Value:", labelWidth=120, callback=self.updateTitleList, tooltip=("Please select a value for the chosen criterion."), ) gui.separator(widget=filterBox, height=3) # The following lines add filterBox (and a vertical separator) to the # advanced interface... self.advancedSettings.advancedWidgets.append(filterBox) self.advancedSettings.advancedWidgetsAppendSeparator() # Title box titleBox = gui.widgetBox( widget=self.controlArea, box="Titles", orientation="vertical", ) self.titleListbox = gui.listBox( widget=titleBox, master=self, value="selectedTitles", # setting (list) labels="titleLabels", # setting (list) callback=self.sendButton.settingsChanged, tooltip="The list of titles whose content will be imported", ) self.titleListbox.setMinimumHeight(150) self.titleListbox.setSelectionMode(3) gui.separator(widget=titleBox, height=3) gui.button( widget=titleBox, master=self, label="Refresh", callback=self.refreshTitleSeg, tooltip="Connect to ECP website and refresh list.", ) gui.separator(widget=titleBox, height=3) gui.separator(widget=self.controlArea, height=3) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() # This initialization step needs to be done after infoBox has been # drawn (because getTitleSeg may need to display an error message). self.getTitleSeg() # Send data if autoSend. self.sendButton.sendIf() self.setMinimumWidth(350) self.adjustSizeWithTimer()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.inputSeg = None self.outputSeg = None self.titleLabels = [] # Put the saved dictionarys, if exist, in the global variable defaultDict if self.savedDict: defaultDict.clear() defaultDict.update(self.savedDict) # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=self.updateGUI, ) # User interface... # Options box... titleLabelsList = gui.widgetBox( widget=self.controlArea, box="Click to select the lexical lists", orientation="vertical", ) # List of Lexical list that the user can select self.titleListbox = gui.listBox( widget=titleLabelsList, master=self, value="selectedFields", # setting (list) labels="titleLabels", # setting (list) callback=self.sendButton.settingsChanged, tooltip="The list of lexical list that you want\ to use for annotation", ) self.titleListbox.setMinimumHeight(150) self.titleListbox.setSelectionMode(2) # Edit a list ... self.OptionList = gui.button( widget=titleLabelsList, master=self, label="Edit lists", callback=self.editList, width=100, ) self.titleEdit = gui.lineEdit( widget=self.controlArea, master=self, value="labelName", label="Annotation key : ", orientation="horizontal", ) self.titleEdit.setPlaceholderText("Topic") gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() # Show the lists in the box self.setTitleList() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.inputTable = None self.listEntries = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.send_data, infoBoxAttribute="infoBox", sendIfPreCallback=self.updateGUI, ) # User interface... # Filter box (advanced settings only) optionsBox = gui.widgetBox( widget=self.controlArea, box="Options", orientation="vertical", ) method_combo = gui.comboBox( widget=optionsBox, master=self, value="method", items=[ "Latent Dirichlet allocation", "Latent semantic indexing", "Correspondence analysis", ], sendSelectedValue=True, orientation="horizontal", label="Method:", labelWidth=120, callback=self.sendButton.settingsChanged, tooltip=("Please select the desired topic modelling method.\n"), ) method_combo.setMinimumWidth(120) gui.separator(widget=optionsBox, height=3) self.numTopicsSpin = gui.spin( widget=optionsBox, master=self, value='numTopics', minv=1, maxv=999, orientation='horizontal', label=u'Number of topics:', labelWidth=120, callback=self.sendButton.settingsChanged, keyboardTracking=False, tooltip=( u"Please select the desired number of topics in output tables." ), ) gui.separator(widget=optionsBox, height=3) gui.listBox( widget=optionsBox, master=self, labels='listEntries', tooltip=(u"TODO"), ) gui.separator(widget=self.controlArea, height=3) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input", "warning") # Send data if autoSend. self.sendButton.sendIf() self.setMinimumWidth(350) self.adjustSizeWithTimer()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.inputSeg = None self.nlp = None # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) # User interface... # Tabs... self.tabs = QTabWidget() self.optionsTab = QWidget() self.modelManagerTab = QWidget() self.tabs.addTab(self.optionsTab, "Options") self.tabs.addTab(self.modelManagerTab, "Model manager") # Options tab... OptionsTabBox = QHBoxLayout() optionsBox = gui.widgetBox(widget=self.optionsTab) self.modelComboBox = gui.comboBox( widget=optionsBox, master=self, value='model', label='Model: ', tooltip='Select the spaCy language model you want to use.', items=INSTALLED_MODELS, sendSelectedValue=True, callback=self.modelChanged, ) OptionsTabBox.addWidget(optionsBox) self.optionsTab.setLayout(OptionsTabBox) # Model manager tab... modelManagerTabBox = QHBoxLayout() modelManagerBox = gui.widgetBox(widget=self.modelManagerTab) # TODO: Model manager UI modelManagerTabBox.addWidget(modelManagerBox) self.modelManagerTab.setLayout(modelManagerTabBox) self.controlArea.layout().addWidget(self.tabs) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input", "warning") # Load spaCy language model... self.modelChanged() # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # Other attributes... self.inputSeg = None self.outputSeg = None self.dialect = None self.selectedHeader = None self.csvSeg = list() # list of deleted segments self.contentIsNone = list() # list for gui self.headerList = list() self.content_column = 0 self.headerEdit = "" # those are for the rename function self.renamedHeader = None self.isRenamed = False self.dict_keys = list() # preprocess self.deleteQuotes = False # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", sendIfPreCallback=None, ) #self.header_there = False #---------------------------------------------------------------------- # User interface... # preprocess box... self.preprocessBox = gui.widgetBox( widget=self.controlArea, box="Preprocess", orientation="vertical", ) # check box... self.checkQuotes = gui.checkBox( widget=self.preprocessBox, master=self, value='deleteQuotes', label='delete quotation marks', callback=self.delete_quotes, ) # main box... self.mainBox = gui.widgetBox( widget=self.controlArea, box="Click to select a header to modify", orientation="vertical", ) # List of all the headers (named with numbers if None) self.headerListbox = gui.listBox( widget=self.mainBox, master=self, value="selectedHeader", labels="headerList", callback=self.update_gui, selectionMode=1, # can only choose one item tooltip="list of all your headers", ) # set "rename" button (must be aside the list) self.renameHeader = gui.button( widget=self.mainBox, master=self, label="rename", callback=self.set_renamebox, tooltip="click to rename header" ) # set "use as content" button (must be aside the list) self.iscontentHeader = gui.button( widget=self.mainBox, master=self, label="use as content", callback=self.content_changed, tooltip="click to select as content" ) #---------------------------------------------------------------------- # rename box... self.renameBox = gui.widgetBox( widget=self.controlArea, box='Rename header', orientation='horizontal', addSpace=True, ) gui.separator(widget=self.renameBox, height=3) self.headerEditLine = gui.lineEdit( widget=self.renameBox, master=self, value='headerEdit', orientation='horizontal', label='New header:', tooltip=( "Rename the selected header." ), callback=lambda: self.renameButton.setDisabled(not self.headerEdit), ) self.renameButton = gui.button( widget=self.renameBox, master=self, label="rename", callback=self.rename, tooltip="click to rename header" ) self.cancelButton = gui.button( widget=self.renameBox, master=self, label="cancel", callback=self.cancel, tooltip="click to cancel renaming" ) #---------------------------------------------------------------------- # interface parameters... self.update_gui() self.renameBox.setVisible(False) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() self.infoBox.setText("Widget needs input", "warning") # Send data if autoSend. self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # ATTRIBUTS # searchFunction self.searchResults = None self.inputSeg = None # newQuery = attribut box lineEdit (search something) self.titleQuery = '' self.authorQuery = '' self.langQuery = 'Any' self.nbr_results = 200 # Results box attributs self.titleLabels = list() self.selectedTitles = list() # selections box attributs self.myTitles = list() self.mytitleLabels = list() # stock all the inputs (texts) in a list self.createdInputs = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) #---------------------------------------------------------------------- # User interface... # Create the working area self.cacheGenerationButton = gui.button( widget=self.controlArea, master=self, label="Generate cache", callback=self.generate_cache, tooltip="Generate the gutenberg cache, this might take a while...", ) self.queryBox = gui.widgetBox( widget=self.controlArea, box="Search books", orientation="vertical", ) # Allows to enter specific text to the research # Uses "newQuery" attribut gui.lineEdit( widget=self.queryBox, master=self, value='titleQuery', orientation='horizontal', label=u"Title: ", labelWidth=120, tooltip=("Enter a string"), ) gui.lineEdit( widget=self.queryBox, master=self, value='authorQuery', orientation='horizontal', label=u"Author: ", labelWidth=120, tooltip=("Enter a string"), ) #ComboBox for selecting the text language queryLang = gui.comboBox( widget=self.queryBox, master=self, value='langQuery', items=[ "Any", "Afrikaans", "Aleut", "Arabic", "Arapaho", "Bodo", "Breton", "Bulgarian", "Caló", "Catalan", "Cebuano", "Chinese", "Czech", "Danish", "Dutch", "English", "Esperanto", "Estonian", "Farsi", "Finnish", "French", "Frisian", "Friulian", "Gaelic, Scottish", "Galician", "Gamilaraay", "German", "Greek", "Greek, Ancient", "Hebrew", "Hungarian", "Icelandic", "Iloko", "Interlingua", "Inuktitut", "Irish", "Italian", "Japanese", "Kashubian", "Khasi", "Korean", "Latin", "Lithuanian", "Maori", "Mayan Languages", "Middle English", "Nahuatl", "Napoletano-Calabrese", "Navajo", "North American Indian", "Norwegian", "Occitan", "Ojibwa", "Old English", "Polish", "Portuguese", "Romanian", "Russian", "Sanskrit", "Serbian", "Slovenian", "Spanish", "Swedish", "Tagabawa", "Tagalog", "Telugu", "Welsh", "Yiddish" ], sendSelectedValue=True, orientation="horizontal", label="Language", labelWidth=120, tooltip=("Please select the desired language.\n"), ) #dict to get the language code self.lang_dict = { "Any": "", "Afrikaans": "af", "Aleut": "ale", "Arabic": "ar", "Arapaho": "arp", "Bodo": "brx", "Breton": "br", "Bulgarian": "bg", "Caló": "rmr", "Catalan": "ca", "Cebuano": "ceb", "Chinese": "zh", "Czech": "cs", "Danish": "da", "Dutch": "nl", "English": "en", "Esperanto": "eo", "Estonian": "et", "Farsi": "fa", "Finnish": "fi", "French": "fr", "Frisian": "fy", "Friulian": "fur", "Gaelic, Scottish": "gla", "Galician": "gl", "Gamilaraay": "kld", "German": "de", "Greek": "el", "Greek, Ancient": "grc", "Hebrew": "he", "Hungarian": "hu", "Icelandic": "is", "Iloko": "ilo", "Interlingua": "ia", "Inuktitut": "iu", "Irish": "ga", "Italian": "it", "Japanese": "ja", "Kashubian": "csb", "Khasi": "kha", "Korean": "ko", "Latin": "la", "Lithuanian": "lt", "Maori": "mi", "Mayan Languages": "myn", "Middle English": "enm", "Nahuatl": "nah", "Napoletano-Calabrese": "nap", "Navajo": "nav", "North American Indian": "nai", "Norwegian": "no", "Occitan": "oc", "Ojibwa": "oji", "Old English": "ang", "Polish": "pl", "Portuguese": "pt", "Romanian": "ro", "Russian": "ru", "Sanskrit": "sa", "Serbian": "sr", "Slovenian": "sl", "Spanish": "es", "Swedish": "sv", "Tagabawa": "bgs", "Tagalog": "tl", "Telugu": "te", "Welsh": "cy", "Yiddish": "yi" } # Allows to choose the wanted results numberp (10 by 10) queryNbr = gui.comboBox( widget=self.queryBox, master=self, value="nbr_results", items=[ "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "200", "300", "400", "500", "1000" ], sendSelectedValue=True, orientation="horizontal", label="Number of results: ", labelWidth=120, tooltip=("Please select the desired search.\n"), ) # Reasearch button # Uses "searchFunction" attribut self.searchButton = gui.button( widget=self.queryBox, master=self, label="Search", callback=self.search, tooltip="Connect Genius and make a research", ) self.titleListbox = gui.listBox( widget=self.queryBox, master=self, value="selectedTitles", # setting (list) labels="titleLabels", # setting (list) callback=lambda: self.addButton.setDisabled(self.selectedTitles == list()), tooltip="The list of titles whose content will be imported", ) self.titleListbox.setMinimumHeight(150) self.titleListbox.setSelectionMode(3) boxbutton = gui.widgetBox( widget=self.queryBox, box=False, orientation='horizontal', ) # Add text button self.addButton = gui.button( widget=boxbutton, master=self, label=u'Add to corpus', callback=self.add, tooltip=(u"Move the selected book downward in your corpus."), ) self.addButton.setDisabled(True) # Clear button # Uses "clearResults" function self.clearButton = gui.button( widget=boxbutton, master=self, label="Clear results", callback=self.clearResults, tooltip="Clear results", ) self.clearButton.setDisabled(True) gui.separator(widget=self.queryBox, height=3) # area where confirmed texts are moved and stocked mytitleBox = gui.widgetBox( widget=self.controlArea, box="Corpus", orientation="vertical", ) self.mytitleListbox = gui.listBox( widget=mytitleBox, master=self, value="myTitles", labels="mytitleLabels", callback=lambda: self.removeButton.setDisabled(self.myTitles == list()), tooltip="The list of books which will be imported", ) self.mytitleListbox.setMinimumHeight(150) self.mytitleListbox.setSelectionMode(3) boxbutton2 = gui.widgetBox( widget=mytitleBox, box=False, orientation='horizontal', ) # Remove text button self.removeButton = gui.button( widget=boxbutton2, master=self, label=u'Remove from corpus', callback=self.remove, tooltip=(u"Remove the selected book from your corpus."), ) self.removeButton.setDisabled(True) # Delete all confirmed texts button self.clearmyBasketButton = gui.button( widget=boxbutton2, master=self, label=u'Clear corpus', callback=self.clearmyBasket, tooltip=(u"Remove all books from your corpus."), ) self.clearmyBasketButton.setDisabled(True) gui.separator(widget=mytitleBox, height=3) gui.rubber(self.controlArea) #---------------------------------------------------------------------- # Draw Info box and Send button self.sendButton.draw() self.searchButton.setDefault(True) self.infoBox.draw() # Update the selections list self.updateMytitleLabels() # Send data if autoSend. self.sendButton.sendIf() # checks if the cache exists self.check_cache()
def __init__(self): """Init of the module: UI and variables definition""" super().__init__() # queryBox indexes self.indicesPanier = list() #---------------------------------------------------------------------- # User interface... self.infoBox = InfoBox(widget=self.controlArea, ) #-------------------------# # Main widget boxes # #-------------------------# sourceBox = gui.widgetBox( widget=self.controlArea, box=u'Source', orientation='vertical', addSpace=False, ) self.filterBox = gui.widgetBox( widget=self.controlArea, box=u'Filters', orientation='vertical', addSpace=False, ) self.includeOuterBox = gui.widgetBox( widget=self.controlArea, box=u'Include', orientation='vertical', addSpace=False, ) self.requestsBox = gui.widgetBox( widget=self.controlArea, orientation='horizontal', addSpace=False, ) panierBox = gui.widgetBox( widget=self.controlArea, orientation='vertical', box=u'Selection', addSpace=False, ) #-------------------# # Send button # #-------------------# self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.send_data, infoBoxAttribute='infoBox', ) #------------------------# # Query box elements # #------------------------# self.choiceBox = gui.comboBox( widget=sourceBox, master=self, value='mode', label="Mode:", callback=self.mode_changed, tooltip="Choose mode", orientation='horizontal', sendSelectedValue=True, items=["Subreddit", "URL", "Full text"], labelWidth=135, ) self.modeBox = gui.widgetBox( widget=sourceBox, orientation='horizontal', addSpace=False, ) self.urlBox = gui.widgetBox( widget=sourceBox, orientation='horizontal', addSpace=False, ) gui.lineEdit( widget=self.urlBox, master=self, value='URL', orientation='horizontal', callback=self.sendButton.settingsChanged, label=u'Search with URL:', labelWidth=135, ) self.subredditBox = gui.widgetBox( widget=sourceBox, orientation='horizontal', addSpace=False, ) gui.lineEdit( widget=self.subredditBox, master=self, value='subreddit', orientation='horizontal', callback=self.sendButton.settingsChanged, label=u'reddit.com/r/...:', labelWidth=135, ) self.fullTextBox = gui.widgetBox( widget=sourceBox, orientation='horizontal', addSpace=False, ) gui.lineEdit( widget=self.fullTextBox, master=self, value='fullText', orientation='horizontal', callback=self.sendButton.settingsChanged, label=u'Search on reddit:', labelWidth=135, ) #----------------------------# # Filters box elements # #----------------------------# self.subredditFilter = gui.widgetBox( widget=self.filterBox, orientation='horizontal', addSpace=False, ) gui.comboBox( widget=self.subredditFilter, master=self, value='sortBy', label=u'Sort by:', tooltip="Choose mode to sort your posts", orientation='horizontal', sendSelectedValue=True, callback=self.checkSubredditSortMode, items=["Hot", "New", "Controversial", "Top", "Rising"], labelWidth=135, ) self.fullTextFilter = gui.widgetBox( widget=self.filterBox, orientation='horizontal', addSpace=False, ) gui.comboBox( widget=self.fullTextFilter, master=self, value='sortByFT', label="Sort by:", tooltip="Choose mode", orientation='horizontal', sendSelectedValue=True, callback=self.checkSearchSortMode, items=["Relevance", "Top", "New", "Comments"], labelWidth=135, ) self.timeBox = gui.widgetBox( widget=self.filterBox, orientation='horizontal', addSpace=False, ) gui.comboBox( widget=self.timeBox, master=self, value='postedAt', label=u'Time:', tooltip="Choose mode to sort your posts", orientation='horizontal', callback=self.sendButton.settingsChanged, sendSelectedValue=True, items=["All", "Past day", "Past hour", "Past month", "Past year"], labelWidth=135, ) gui.spin( widget=self.filterBox, master=self, value="amount", minv=1, maxv=10000, label="Max amount of posts:", labelWidth=135, orientation="horizontal", callback=self.sendButton.settingsChanged, tooltip="Select the amount of posts that you want", ) #--------------------------# # Include box elements # #--------------------------# self.includeBox = gui.widgetBox( widget=self.includeOuterBox, orientation='horizontal', addSpace=False, ) gui.checkBox( widget=self.includeBox, master=self, value='includeImage', label=u'Include images', callback=self.mode_changed, ) gui.checkBox( widget=self.includeBox, master=self, value='includeComments', label=u'Include comments', callback=self.mode_changed, ) #--------------------------# # Request box elements # #--------------------------# self.refreshButton = gui.button( widget=self.requestsBox, master=self, label=u'Refresh the Data', callback=self.refresh_content, ) if len(self.labelsPanier) == 0: self.refreshButton.setDisabled(True) self.fetchButton = gui.button( widget=self.requestsBox, master=self, label=u'Add Request', callback=self.confirm_settings, ) #--------------------------# # Results box elements # #--------------------------# panier = gui.listBox( widget=panierBox, master=self, value="indicesPanier", labels="labelsPanier", callback=lambda: self.removeButton.setDisabled(self.indicesPanier == list()), tooltip="List of imported corpora.", ) panier.setMinimumHeight(120) panier.setSelectionMode(3) self.update_list(self.labelsPanier) removalBox = gui.widgetBox( widget=panierBox, orientation='horizontal', addSpace=False, ) self.removeButton = gui.button( widget=removalBox, master=self, label="Remove from selection", callback=self.removePressed, tooltip="Remove the selected corpus.", ) self.removeButton.setDisabled(True) self.clearButton = gui.button( widget=removalBox, master=self, label="Clear selection", callback=self.clearPressed, tooltip="Remove all corpora from selection.", ) if len(self.labelsPanier) == 0: self.clearButton.setDisabled(True) #------------------------# # End of definitions # #------------------------# gui.separator(widget=self.controlArea, height=3) # Spacer gui.rubber(self.controlArea) # Info box... self.sendButton.draw() self.infoBox.draw() self.mode_changed() self.sendButton.settingsChanged() # Send data if autoSend... self.sendButton.sendIf()
def __init__(self): """Widget creator.""" super().__init__() # Other (non-setting) attributes... self.segmentation = None self.displayedFolderLabels = list() self.currentFolder = self.__class__.base_url self.database = None self.selectedItems = list() # Next two instructions are helpers from TextableUtils. Corresponding # interface elements are declared here and actually drawn below (at # their position in the UI)... self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", ) # User interface... # Browse database box browseBox = gui.widgetBox( widget=self.controlArea, box="Browse database", orientation="vertical", addSpace=False, ) upwardNavBox = gui.widgetBox( widget=browseBox, box=False, orientation="horizontal", ) self.homeRefreshButton = gui.button( widget=upwardNavBox, master=self, label="Home", callback=self.homeRefreshPressed, tooltip="Return to database root.", # tooltip="Connect to CHILDES website and refresh corpus list.", ) self.backButton = gui.button( widget=upwardNavBox, master=self, label="Back", callback=self.backPressed, tooltip="View parent folder.", ) gui.separator(widget=browseBox, height=3) self.currentFolderLabel = gui.label( widget=browseBox, master=self, label="Current folder: /", tooltip="This is the currently displayed folder.", ) gui.separator(widget=browseBox, height=3) displayedFolderListbox = gui.listBox( widget=browseBox, master=self, value="selectedItems", labels="displayedFolderLabels", callback=self.corpusSelected, tooltip="Select an item to open or import.", ) displayedFolderListbox.setMinimumHeight(150) displayedFolderListbox.setSelectionMode(1) displayedFolderListbox.doubleClicked.connect(self.listBoxDoubleClicked) self.importedCorpusLabel = gui.label( widget=browseBox, master=self, label="No corpus imported yet.", tooltip="This is the currently imported corpus.", ) gui.separator(widget=browseBox, height=3) downwardNavBox = gui.widgetBox( widget=browseBox, box=False, orientation="horizontal", ) self.openButton = gui.button( widget=downwardNavBox, master=self, label="Open", callback=self.openPressed, tooltip="View selected folder's contents.", ) self.importButton = gui.button( widget=downwardNavBox, master=self, label="Import", callback=self.importPressed, tooltip="Import selected item's contents.", ) gui.separator(widget=browseBox, height=3) gui.rubber(self.controlArea) # Now Info box and Send button must be drawn... self.sendButton.draw() self.infoBox.draw() # This initialization step needs to be done after infoBox has been # drawn (because we may need to display an error message). self.loadDatabaseCache() # Send data if autoSend. self.sendButton.sendIf() self.setMinimumWidth(350) self.adjustSizeWithTimer()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Other attributes... self.segmentation = None self.createdInputs = list() self.fileLabels = list() self.selectedFileLabels = list() self.newFiles = u'' self.newAnnotationKey = u'' self.newAnnotationValue = u'' self.pdfPassword = u'' # SuperTextFiles self.ocrForce = False # SuperTextFiles self.ocrLanguages = u'eng' # SuperTextFiles self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute='infoBox', sendIfPreCallback=self.updateGUI, ) self.advancedSettings = AdvancedSettings( widget=self.controlArea, master=self, callback=self.sendButton.settingsChanged, ) # GUI... # Advanced settings checkbox... self.advancedSettings.draw() # BASIC GUI... # Basic file box basicFileBox = gui.widgetBox( widget=self.controlArea, box=u'Source', orientation='vertical', addSpace=False, ) basicFileBoxLine1 = gui.widgetBox( widget=basicFileBox, box=False, orientation='horizontal', ) gui.lineEdit( widget=basicFileBoxLine1, master=self, value='file', orientation='horizontal', label=u'File path:', labelWidth=101, callback=self.sendButton.settingsChanged, tooltip=(u"The path of the file."), ) gui.separator(widget=basicFileBoxLine1, width=5) gui.button( widget=basicFileBoxLine1, master=self, label=u'Browse', callback=self.browse, tooltip=(u"Open a dialog for selecting file."), ) gui.separator(widget=basicFileBox, width=3) advancedEncodingsCombobox = gui.comboBox( widget=basicFileBox, master=self, value='encoding', items=getPredefinedEncodings(), sendSelectedValue=True, orientation='horizontal', label=u'Encoding:', labelWidth=101, callback=self.sendButton.settingsChanged, tooltip=(u"Select input file(s) encoding."), ) addSeparatorAfterDefaultEncodings(advancedEncodingsCombobox) addAutoDetectEncoding(advancedEncodingsCombobox) gui.separator(widget=basicFileBox, width=3) self.advancedSettings.basicWidgets.append(basicFileBox) self.advancedSettings.basicWidgetsAppendSeparator() # ADVANCED GUI... defaultLabelWidth = 120 # SuperTextFiles # File box fileBox = gui.widgetBox( widget=self.controlArea, box=u'Sources', orientation='vertical', addSpace=False, ) fileBoxLine1 = gui.widgetBox( widget=fileBox, box=False, orientation='horizontal', addSpace=True, ) self.fileListbox = gui.listBox( widget=fileBoxLine1, master=self, value='selectedFileLabels', labels='fileLabels', callback=self.updateFileBoxButtons, tooltip=( u"The list of files whose content will be imported.\n" u"\nIn the output segmentation, the content of each\n" u"file appears in the same position as in the list.\n" u"\nColumn 1 shows the file's name.\n" u"Column 2 shows the file's annotation (if any).\n" # Start SuperTextFiles # u"Column 3 shows the file's encoding." # removed u"Column 3 shows the file's password (if any).\n" u"Column 4 shows the file's languages (if any).\n" u"Column 5 shows if OCR is forced.\n" u"Column 6 shows the file's encoding." # End SuperTextFiles ), ) font = QFont() font.setFamily('Courier') font.setStyleHint(QFont.Courier) font.setPixelSize(12) self.fileListbox.setFont(font) fileBoxCol2 = gui.widgetBox( widget=fileBoxLine1, orientation='vertical', ) self.moveUpButton = gui.button( widget=fileBoxCol2, master=self, label=u'Move Up', callback=self.moveUp, tooltip=(u"Move the selected file upward in the list."), ) self.moveDownButton = gui.button( widget=fileBoxCol2, master=self, label=u'Move Down', callback=self.moveDown, tooltip=(u"Move the selected file downward in the list."), ) self.removeButton = gui.button( widget=fileBoxCol2, master=self, label=u'Remove', callback=self.remove, tooltip=(u"Remove the selected file from the list."), ) self.clearAllButton = gui.button( widget=fileBoxCol2, master=self, label=u'Clear All', callback=self.clearAll, tooltip=(u"Remove all files from the list."), ) self.exportButton = gui.button( widget=fileBoxCol2, master=self, label=u'Export List', callback=self.exportList, tooltip=(u"Open a dialog for selecting a file where the file\n" u"list can be exported in JSON format."), ) self.importButton = gui.button( widget=fileBoxCol2, master=self, label=u'Import List', callback=self.importList, tooltip=(u"Open a dialog for selecting a file list to\n" u"import (in JSON format). Files from this list\n" u"will be added to those already imported."), ) fileBoxLine2 = gui.widgetBox( widget=fileBox, box=False, orientation='vertical', ) # Add file box addFileBox = gui.widgetBox( widget=fileBoxLine2, box=True, orientation='vertical', ) addFileBoxLine1 = gui.widgetBox( widget=addFileBox, orientation='horizontal', ) gui.lineEdit( widget=addFileBoxLine1, master=self, value='newFiles', orientation='horizontal', label=u'File path(s):', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"The paths of the files that will be added to the\n" u"list when button 'Add' is clicked.\n\n" u"Successive paths must be separated with ' / ' \n" u"(whitespace + slash + whitespace). Their order in\n" u"the list will be the same as in this field."), ) gui.separator(widget=addFileBoxLine1, width=5) gui.button( widget=addFileBoxLine1, master=self, label=u'Browse', callback=self.browse, tooltip=(u"Open a dialog for selecting files.\n\n" u"To select multiple files at once, either draw a\n" u"selection box around them, or use shift and/or\n" u"ctrl + click.\n\n" u"Selected file paths will appear in the field to\n" u"the left of this button afterwards, ready to be\n" u"added to the list when button 'Add' is clicked."), ) gui.separator(widget=addFileBox, width=3) basicEncodingsCombobox = gui.comboBox( widget=addFileBox, master=self, value='encoding', items=getPredefinedEncodings(), sendSelectedValue=True, orientation='horizontal', label=u'Encoding:', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"Select input file(s) encoding."), ) addSeparatorAfterDefaultEncodings(basicEncodingsCombobox) addAutoDetectEncoding(basicEncodingsCombobox) self.encoding = self.encoding gui.separator(widget=addFileBox, width=3) gui.lineEdit( widget=addFileBox, master=self, value='newAnnotationKey', orientation='horizontal', label=u'Annotation key:', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"This field lets you specify a custom annotation\n" u"key associated with each file that is about to be\n" u"added to the list."), ) gui.separator(widget=addFileBox, width=3) gui.lineEdit( widget=addFileBox, master=self, value='newAnnotationValue', orientation='horizontal', label=u'Annotation value:', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"This field lets you specify the annotation value\n" u"associated with the above annotation key."), ) ### Start SuperTextFiles addition gui.separator(widget=addFileBox, width=3) # Field for PDF password gui.lineEdit( widget=addFileBox, master=self, value='pdfPassword', orientation='horizontal', label=u'PDF password:'******'ocrLanguages', orientation='horizontal', label=u'OCR Language(s):', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"This field lets you specify languages\n" u"for the OCR process. Ex.: fra+ita"), ) gui.checkBox( widget=addFileBox, master=self, value='ocrForce', label=u'Force OCR', labelWidth=defaultLabelWidth, callback=self.updateGUI, tooltip=(u"Force to use an OCR detection on this file"), ) ### End SuperTextFiles addition gui.separator(widget=addFileBox, width=3) self.addButton = gui.button( widget=addFileBox, master=self, label=u'Add', callback=self.add, tooltip=(u"Add the file(s) currently displayed in the\n" u"'Files' text field to the list.\n\n" u"Each of these files will be associated with the\n" u"specified encoding and annotation (if any).\n\n" u"Other files may be selected afterwards and\n" u"assigned a different encoding and annotation."), ) self.advancedSettings.advancedWidgets.append(fileBox) self.advancedSettings.advancedWidgetsAppendSeparator() # Options box... optionsBox = gui.widgetBox( widget=self.controlArea, box=u'Options', orientation='vertical', addSpace=False, ) optionsBoxLine1 = gui.widgetBox( widget=optionsBox, box=False, orientation='horizontal', ) gui.checkBox( widget=optionsBoxLine1, master=self, value='importFilenames', label=u'Import file names with key:', labelWidth=180, callback=self.sendButton.settingsChanged, tooltip=(u"Import file names as annotations."), ) self.importFilenamesKeyLineEdit = gui.lineEdit( widget=optionsBoxLine1, master=self, value='importFilenamesKey', orientation='horizontal', callback=self.sendButton.settingsChanged, tooltip=(u"Annotation key for importing file names."), ) gui.separator(widget=optionsBox, width=3) optionsBoxLine2 = gui.widgetBox( widget=optionsBox, box=False, orientation='horizontal', ) gui.checkBox( widget=optionsBoxLine2, master=self, value='autoNumber', label=u'Auto-number with key:', labelWidth=180, callback=self.sendButton.settingsChanged, tooltip=(u"Annotate files with increasing numeric indices."), ) self.autoNumberKeyLineEdit = gui.lineEdit( widget=optionsBoxLine2, master=self, value='autoNumberKey', orientation='horizontal', callback=self.sendButton.settingsChanged, tooltip=(u"Annotation key for file auto-numbering."), ) gui.separator(widget=optionsBox, width=3) self.advancedSettings.advancedWidgets.append(optionsBox) self.advancedSettings.advancedWidgetsAppendSeparator() gui.rubber(self.controlArea) # Send button... self.sendButton.draw() # Info box... self.infoBox.draw() self.adjustSizeWithTimer() QTimer.singleShot(0, self.sendButton.sendIf)
def __init__(self): super().__init__() self.infoBox = InfoBox(widget=self.controlArea) self.sendButton = SendButton( widget=self.controlArea, master=self, callback=self.sendData, infoBoxAttribute="infoBox", #sendIfPreCallback = self.updateGUI, ) self.advancedSettings = AdvancedSettings( widget=self.controlArea, master=self, callback=self.showAdvancedSettings, ) # Initiates output segmentation self.segmentation = Input(text=u"") self.createdInputs = list() self.advancedSettings.draw() # Basic file box basicFileBox = gui.widgetBox( widget=self.controlArea, box=u"File selection", orientation="vertical", addSpace=False, ) basicFileBoxLine1 = gui.widgetBox( widget=basicFileBox, box=False, orientation="horizontal", ) gui.lineEdit( widget=basicFileBoxLine1, master=self, value="file", orientation="horizontal", label=u"File path :", labelWidth=101, callback=self.sendButton.settingsChanged, tooltip=(u"The path of the file."), ) languageComboBox = gui.comboBox( widget=basicFileBox, master=self, value="language", # Displays the keys of the above dict of the multiple languages items=[(language) for language in AudioFile.dict_languages], sendSelectedValue=True, orientation=u"horizontal", label="Input language :", labelWidth=101, callback=self.sendButton.settingsChanged, tooltip=(u"Select the language of the input text."), ) gui.separator(widget=basicFileBoxLine1, width=3) gui.button( widget=basicFileBoxLine1, master=self, label=u"Browse", callback=self.browse, tooltip=(u"Open a dialog for selecting file."), ) OptionsBox = gui.widgetBox( widget=self.controlArea, box=u"Segmentation at pauses", orientation="vertical", addSpace=False, ) OptionBoxLine1 = gui.widgetBox( widget=OptionsBox, box=False, orientation="horizontal", ) gui.spin( widget=OptionsBox, master=self, value="selected_vol", label="Maximum volume (in dBFS) : ", callback=self.sendButton.settingsChanged, tooltip="Select a value between 1 and 50", minv=1, maxv=50, step=1, ) gui.spin( widget=OptionsBox, master=self, value="selected_dur", label="Minimum duration (in milliseconds) : ", callback=self.sendButton.settingsChanged, tooltip="Select a value between 1 and 1000", minv=1, maxv=1000, step=1, ) gui.checkBox( widget=OptionsBox, master=self, value="selected_seg", label="Segment the audio file with the parameters", box=None, callback=self.sendButton.settingsChanged, tooltip="Leave this box unchecked if you want one and only segment." ) gui.separator(widget=OptionsBox, width=3) self.advancedSettings.advancedWidgets.append(OptionsBox) self.advancedSettings.advancedWidgetsAppendSeparator() # Adding space between control area and send button gui.rubber(self.controlArea) # Send button... self.sendButton.draw() # Info box... self.infoBox.draw() self.advancedSettings.setVisible(self.displayAdvancedSettings)