コード例 #1
0
ファイル: gui_word.py プロジェクト: svisser/palabra
 def launch_accidental(self, grid):
     if self.timer is not None:
         glib.source_remove(self.timer)
     highlight_cells(self.pwindow, self.puzzle, clear=True)
     self.store.clear()
     self.store.append([LOADING_TEXT, ''])
     self.timer = glib.timeout_add(constants.INPUT_DELAY_SHORT
         , self.load_words, grid, self.wordlists[self.index])
コード例 #2
0
ファイル: properties.py プロジェクト: klochner/palabra
    def __init__(self, window, puzzle):
        gtk.Dialog.__init__(self, u"Puzzle properties", window
            , gtk.DIALOG_MODAL)
        self.palabra_window = window
        self.puzzle = puzzle
        on_destroy = lambda widget: highlight_cells(window, puzzle, clear=True)
        self.connect("destroy", on_destroy)

        status = puzzle.grid.determine_status(True)
        
        tabs = gtk.Notebook()
        tabs.set_property("tab-hborder", 8)
        tabs.set_property("tab-vborder", 4)
        tabs.append_page(self.create_general_tab(status, puzzle), gtk.Label(u"General"))
        tabs.append_page(self.create_letters_tab(status, puzzle), gtk.Label(u"Letters"))
        tabs.append_page(self.create_words_tab(status, puzzle), gtk.Label(u"Words"))
        tabs.append_page(self.create_metadata_tab(puzzle), gtk.Label(u"Metadata"))
        tabs.append_page(self.create_notepad_tab(puzzle), gtk.Label(u"Notepad"))
        tabs.connect("switch-page", self.on_switch_page)
        
        main = gtk.VBox(False, 0)
        main.set_spacing(18)
        main.pack_start(tabs, True, True, 0)
        
        hbox = gtk.HBox(False, 0)
        hbox.set_border_width(12)
        hbox.set_spacing(18)
        hbox.pack_start(main, True, True, 0)
        
        self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
        self.vbox.add(hbox)
コード例 #3
0
ファイル: gui_word.py プロジェクト: svisser/palabra
 def __init__(self, parent, puzzle):
     super(AccidentalWordsDialog, self).__init__(parent, u"View accidental words")
     self.puzzle = puzzle
     self.wordlists = parent.wordlists
     self.index = 0
     self.collapse = True
     self.timer = None
     wlist_hbox = gtk.HBox(False, 0)
     wlist_hbox.pack_start(create_label(u"Check for words in list:"), True, True, 0)
     def on_wordlist_changed(widget):
         self.index = widget.get_active()
         self.launch_accidental(self.puzzle.grid)
     combo = create_combo([w.name for w in self.wordlists]
         , active=self.index, f_change=on_wordlist_changed)
     wlist_hbox.pack_start(combo, False, False, 0)
     self.main.pack_start(wlist_hbox, False, False, 0)
     self.store, self.tree, s_window = create_tree((str, str)
         , [(u"Word", 0)], window_size=(300, 300))
     self.tree.get_selection().connect("changed", self.on_selection_changed)
     self.main.pack_start(s_window, True, True, 0)
     self.main.pack_start(create_label(u"Click to highlight the word(s) in the grid."), False, False, 0)
     def collapse_callback(button):
         self.collapse = button.get_active()
         self.launch_accidental(self.puzzle.grid)
     button = gtk.CheckButton("Collapse multiple occurrences into one item.")
     button.connect("toggled", collapse_callback)
     button.set_active(self.collapse)
     self.main.pack_start(button, False, False, 0)
     self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
     destroy = lambda w: highlight_cells(self.pwindow, self.puzzle, clear=True)
     self.connect("destroy", destroy)
     self.launch_accidental(puzzle.grid)
コード例 #4
0
ファイル: properties.py プロジェクト: klochner/palabra
 def on_selection_changed(self, selection):
     store, it = selection.get_selected()
     if it:
         length = store.get_value(it, 0)
         words = highlight_cells(self.palabra_window, self.puzzle, "length", length)
         if not words:
             words = determine_words_message(self.puzzle)
         else:
             words = determine_words_message(self.puzzle, length=length)
         self.load_words(words)
コード例 #5
0
ファイル: gui_word.py プロジェクト: svisser/palabra
 def __init__(self, parent, puzzle):
     super(SimilarWordsDialog, self).__init__(parent, u"View similar words")
     self.puzzle = puzzle
     self.store, self.tree, scrolled_window = create_tree((str, str)
         , [(u"Similar words", 1)]
         , f_sel=self.on_selection_changed
         , window_size=(512, 384))
     self.main.pack_start(scrolled_window, True, True, 0)
     self.main.pack_start(create_label(u"Click to highlight the words in the grid."), False, False, 0)
     self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
     destroy = lambda w: highlight_cells(self.pwindow, self.puzzle, clear=True)
     self.connect("destroy", destroy)
     self.entries = word.similar_entries(word.similar_words(puzzle.grid))
     self.load_entries(self.entries)
コード例 #6
0
ファイル: gui_word.py プロジェクト: svisser/palabra
 def on_selection_changed(self, selection):
     """Highlight all cells associated with the selected entry."""
     store, it = selection.get_selected()
     if it is not None:
         cells = merge_highlights(self.results, self.store[it][1])
         highlight_cells(self.pwindow, self.puzzle, "cells", cells)
コード例 #7
0
ファイル: gui_word.py プロジェクト: svisser/palabra
 def on_selection_changed(self, selection):
     """Highlight all cells associated with the selected entry."""
     store, it = selection.get_selected()
     if it is not None:
         slots = [(x, y, d) for x, y, d, word, o in self.entries[store[it][0]]]
         highlight_cells(self.pwindow, self.puzzle, "slots", slots)
コード例 #8
0
ファイル: properties.py プロジェクト: klochner/palabra
 def on_word_selected(self, selection):
     store, it = selection.get_selected()
     if it:
         highlight_cells(self.palabra_window, self.puzzle, clear=True)
         x, y, d = store[it][1], store[it][2], store[it][3]
         highlight_cells(self.palabra_window, self.puzzle, "slot", (x, y, d))
コード例 #9
0
ファイル: properties.py プロジェクト: klochner/palabra
 def on_char_click(widget, event, char):
     highlight_cells(self.palabra_window, self.puzzle, "char", char)
コード例 #10
0
ファイル: properties.py プロジェクト: klochner/palabra
 def on_open_click(widget, event):
     highlight_cells(self.palabra_window, self.puzzle, f="open")
コード例 #11
0
ファイル: properties.py プロジェクト: klochner/palabra
 def on_switch_page(self, tabs, page, pagenum):
     self.load_words(determine_words_message(self.puzzle))
     self.words_tab_sel.unselect_all()
     highlight_cells(self.palabra_window, self.puzzle, clear=True)