gt-tools 0.1.4.1 → 0.1.4.2
raw patch · 5 files changed
+38/−8 lines, 5 filesnew-uploader
Files
- .gitignore +5/−0
- Gtc/gtc.hs +7/−1
- Gtg/gtg.hs +21/−1
- Gtg/main.glade +3/−4
- gt-tools.cabal +2/−2
+ .gitignore view
@@ -0,0 +1,5 @@+dist+*.o+*.hi+Gtc/gtc+Gtg/gtg
Gtc/gtc.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Main ( main@@ -33,8 +34,13 @@ main :: IO() main = do- -- TODO: Need to detecet terminal encoding and make convertions+#if MIN_VERSION_base(4,4,0)+ -- returns proper String+ args <- getArgs+#else+ -- TODO: Need to detecet terminal encoding and make convertion args <- U.getArgs+#endif case args of "-i":rest -> interactiveLoop rest
Gtg/gtg.hs view
@@ -1,4 +1,4 @@-+{-# LANGUAGE CPP #-} module Main ( main ) where@@ -8,9 +8,25 @@ import Graphics.UI.Gtk import Graphics.UI.Gtk.Glade import Paths_gt_tools(getDataDir)+import Data.List (elemIndex)+import qualified System.Environment.UTF8 as U +comboIndex :: [String] -> String -> Int+comboIndex xs x = maybe (-1) (id) (x `elemIndex` xs)+ main :: IO() main = do+#if MIN_VERSION_base(4,4,0)+ -- returns proper String+ args <- getArgs+#else+ -- TODO: Need to detecet terminal encoding and make convertion+ args <- U.getArgs+#endif+ let fromL = if (length args) >= 1 then comboIndex langs (args !! 0) else -1+ let toL = if (length args) >= 2 then comboIndex (tail langs) (args !! 1) else -1++ -- GUI initialization _ <- initGUI data_dir <- getDataDir Just xml <- xmlNew $ data_dir ++ "/Gtg/main.glade"@@ -29,6 +45,10 @@ mapM_ (comboBoxAppendText cmb_dest_lang ) (tail langs_descrs) mapM_ (comboBoxAppendText cmb_source_lang) langs_descrs++ -- Set active lang from command line+ comboBoxSetActive cmb_source_lang fromL+ comboBoxSetActive cmb_dest_lang toL -- Actions _ <- onClicked btn_close (widgetDestroy window)
Gtg/main.glade view
@@ -10,8 +10,6 @@ <property name="icon_name">accessories-dictionary</property> <child> <widget class="GtkVBox" id="vbox1">- <property name="width_request">400</property>- <property name="height_request">250</property> <property name="visible">True</property> <property name="border_width">4</property> <property name="orientation">vertical</property>@@ -121,8 +119,9 @@ <property name="shadow_type">out</property> <child> <widget class="GtkLabel" id="lbl_translation">- <property name="height_request">70</property> <property name="visible">True</property>+ <property name="xalign">0</property>+ <property name="yalign">0</property> <property name="wrap">True</property> <property name="selectable">True</property> <property name="width_chars">50</property>@@ -152,7 +151,7 @@ </child> <child> <widget class="GtkButton" id="btn_close">- <property name="label" translatable="yes">gtk-close</property>+ <property name="label">gtk-close</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property>
gt-tools.cabal view
@@ -1,5 +1,5 @@ name: gt-tools-version: 0.1.4.1+version: 0.1.4.2 cabal-version: >= 1.8 build-type: Simple license: GPL@@ -15,7 +15,7 @@ between different languages. category: Tools author: Mikhail S. Pobolovets-stability: experimental+stability: stable tested-with: GHC==6.12.1 data-files: LICENSE README Gtg/main.glade data-dir: ""