Saturday, April 14, 2012

Pygtk 3+ gui app using pango for character rendering



imported basically the entire unicode library, albeit haven't worked the details on languages with large character sets (Chinese and other eastern languages).  Someday maybe everything will get rendered automatically, but for now event with correct utf-8 or unicode code set for characters you may have difficulty without appropriate font set loaded in your os to render sets.

4/16 -

Okay some updates on this modified code, on existing keyboard pop ups to create movable/resizable keyboard windows.  Also modified from earlier pop up window type, window so that it is no longer destroyed either by out of focus event or by key or button events sending write back returns on respective drawing area widget.  Based on open source Sudoku code, to make better use of more permanent keyboard windows decided to instantiate this outside of drawing area widget, and instead on the top level window, with function call back which sends character string information to the class instantiated aspect frame first, and this in turn finds the last focused drawing area widget for character write.  The effect of this allows for multiple keyboard windows to be instantiated with different character sets.  I've included for each window the ability to instance any number of language sets at once.  I also created a move to top position for keyboard window instancing, this allows for quicker movement between windows.  Studying on changing some style aspects of keyboard windows namely, to avoid Active versus Normal states, however, it appears .get_style() functions on a widget are generally deprecated in gtk3+, while function appears here, attempting to change or modify style appears to do nothing...supposed to use Gtk.StyleContext instead here.  Also when working with multiple windows active (or at least 'normal') concurrently for a running application, if you want to provide toggle automations between windows (with users initiation), you can use the Wnck module...first accessing the screen (X11) using a get screen, then iterating windows on screen object, you can filter search for your window by name, and then using this modules window functions, activate() the given window.




Qa crossword source code here

if you want to run code, may have to install Ubuntu's quickly package to get source to work, free for any to use.

-4/18 - Presently constructing crossword generating algorithm

 Okay so this is a routine that I have thought of at the moment
1. Pick word from list.
2.  From its allocation (horizontal or vetical), determine matched tokens on its length running perpendicular, and pick words having least rank where rank is determined from the absolute value of all character distance summed relative to crossword grid center.
3.  Configure grid, subtract all matched words from dicitionary pools.
4.  Then work all previously matched words on the opposite axis of such grid, repeating step 2.
5.  Repeat step 3.

6.  Assess Squareness.
   i.What are the width, height characteristics of the crossword of 1-5.
   ii.  Depending on variance of relative measures to one another, decision
        is made to seed a word on the axis to compensate for differences
        of one measure relative the other.
7. From word determined on step 6, repeat steps 2-5.  Then repeat step 6.   


Added to this somewhere in iteration when dictionary pool is close to some determined threshold, boundary restrictions are placed on any added words which define boundary thresholds of the crossword grid.  Once either fixed iteration cycles (program specified) or dictionary pool are exhausted, then the crossword is ranked overall for squareness and word densities relative size.

Then having implemented tracking on picks (step 1), one can rerun steps2-7 with permutation of picks at step 1 and step 6.

Once a sufficiently well enough ranked crossword has been found, the generator can terminate, and the selected crossword coordinate system can be re normalized for typical table inputs (i.e., first quadrant in the cartesian system). 

No comments:

Post a Comment

Oblivion

 Between the fascination of an upcoming pandemic ridden college football season, Taylor Swift, and Kim Kardashian, wildfires, crazier weathe...