From 69234b1d8c99ecbdfa9376d507d2d883c7e0fe64 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 13 Mar 2008 16:41:25 +0000 Subject: [PATCH 01/58] adding some coloration on active term title --- terminator | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/terminator b/terminator index a71af6b4..110401d1 100755 --- a/terminator +++ b/terminator @@ -185,14 +185,17 @@ class TerminatorTerm: self._termbox = gtk.HBox () self._termbox.show() self._title = gtk.Label() + self._title.show() + self._titlebox = gtk.EventBox() + self._titlebox.add(self._title) self._box = gtk.VBox () self._box.show() - self._box.pack_start(self._title, False) + self._box.pack_start(self._titlebox, False) self._box.pack_start(self._termbox) if self.reconf('titlebars'): - self._title.show() + self._titlebox.show() else: - self._title.hide() + self._titlebox.hide() self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ()) if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled": @@ -212,6 +215,8 @@ class TerminatorTerm: self._vte.connect ("composited-changed", self.on_composited_changed) self._vte.connect ("window-title-changed", self.on_vte_title_change) self._vte.connect ("grab-focus", self.on_vte_focus) + self._vte.connect ("focus-out-event", self.on_vte_focus_out) + self._vte.connect ("focus-in-event", self.on_vte_focus_in) exit_action = self.gconf_client.get_string (self.profile + "/exit_action") exit_action = self.reconf ("exit_action") @@ -604,6 +609,16 @@ class TerminatorTerm: self._title.set_text(vte.get_window_title ()) self.terminator.set_window_title("Terminator: %s" %vte.get_window_title ()) + def on_vte_focus_in(self, vte, event): + self._titlebox.modify_bg(gtk.STATE_NORMAL,self.terminator.window.get_style().bg[gtk.STATE_SELECTED]) + self._title.modify_fg(gtk.STATE_NORMAL, self.terminator.window.get_style().fg[gtk.STATE_SELECTED]) + return + + def on_vte_focus_out(self, vte, event): + self._titlebox.modify_bg(gtk.STATE_NORMAL, self.terminator.window.get_style().bg[gtk.STATE_NORMAL]) + self._title.modify_fg(gtk.STATE_NORMAL, self.terminator.window.get_style().fg[gtk.STATE_NORMAL]) + return + def on_vte_focus(self, vte): if vte.get_window_title (): self.terminator.set_window_title("Terminator: %s" %vte.get_window_title ()) From 034d8ed1287b271163dea3d558299235a568ab22 Mon Sep 17 00:00:00 2001 From: Cory Kontros Date: Tue, 18 Mar 2008 18:17:06 -0400 Subject: [PATCH 02/58] * Added new icon. --- data/icons/16x16/apps/terminator.png | Bin 845 -> 779 bytes data/icons/22x22/apps/terminator.png | Bin 1225 -> 1110 bytes data/icons/24x24/apps/terminator.png | Bin 1385 -> 1193 bytes data/icons/48x48/apps/terminator.png | Bin 3251 -> 2595 bytes data/icons/scalable/apps/terminator.svg | 877 ++++++++++++------------ 5 files changed, 425 insertions(+), 452 deletions(-) diff --git a/data/icons/16x16/apps/terminator.png b/data/icons/16x16/apps/terminator.png index df543b129b87eebf0704a8ba236b47474fc6eb5b..9c649a403174575ee6489004c310e67ec79ffe1e 100644 GIT binary patch delta 755 zcmVLlRIx*We|p+ zIeXT-d+asFi3pLEwG(V3sFFxg5Ghh1(a=&*A;Axzpr+t=Kz~6IDGd^JnkWiJmI5(E zT#_iZgdDFOld#fW&N<(AF5e7=7lQ%?5^pn?;+@MoBWA|`LHy-c*I$3-?AkSu9{fdS z25O2a7>cP)VT37fyLaA?mrkGgG*sc@ozFfeDk}_#rX&I&f&e0NaF2J^*U>yjOtGL0LLiyzGB+L)>Hw;s%8h=X-i7nDUw&yZ z1_)-%AzZrhCd1obBcaAb*%o2p#RXQDPLus|A55XHxIIbnbw!qE7Hd!}ib%&}wr}2~ z+goP5{fIKpIj95sg8|GYG#d?m`)&*Mo>3Jjs*)_rEPoCmU?Mp081?rV?LGz#m4dy2{BcWpsFW+`$Hr7ak{SvG<;`ESZFWPZAEMasm8q zMi+SD)PE@so<2R6HdUnzHFYf(6~4fg1^eSMTi=KJ4|6^X1G8L4**3##xq@K7#i?{)osx zqUh-Ap2K2QS~%xM4<0`JLI8R7wY96uE4_E4s8Ro;^uNGN`SIS*KRr1(yd{6W lvxvlI_MZquBm%_D!XNE~alY|m4yynF002ovPDHLkV1ivXT*d$Z delta 822 zcmV-61Ihf02F(VLB!2;OQb$4nuFf3k00006VoOIv0RI600RN!9r;`8x010qNS#tmY z4c7nw4c7reD4Tcy000McNliru*a8R%J1zTh$FBeY0?kQ8K~y-)m6K0sTvZgtfA`OO zcjhIN%u7=-X_}I^7@IOoAcBi5TB3r5EZt}VS&F#pHVZc{MSr_+r5kA|WRWcT$CaSL zMbt&4l7fV$XbcURIMbQQkjXHUckgwPW+;M!XZd~K`ObGZ9Kl(Mxw*MK|D&QPYOb!X zS}{92`&t~w_qyHg<(CCoYtl6RR|BO~)mr9DY{z|ztZ#u$`R7-KNT&@Vi1UmW1Q$%J9s>ETjJr2&jF z6bc2bwXChJos$@27-${w;h^Tt&u$~6WbW%P`SjcG*o{X}N}6aJ>cZRo2itN2ypKx^a_} zdKGN~)YT$at~}z^M(ZpA!0u6o%Rp1RA@wqUL0oxwwPe8dl@n#n(R$W^B}saHs!KH>Z0Q*4w$2qCmm ziXaF$^?!yN*#j;FDR&M>@ZRIS=UMI*ZdaCw>8&{skTf6iAbl^@sF z*Y68}v9YnNb8b8g!;gVUA;iTn3@=PiPiOo3`q;M1&07*qoM6N<$g12#< Ar2qf` diff --git a/data/icons/22x22/apps/terminator.png b/data/icons/22x22/apps/terminator.png index 891bdc732178d00808ee3366762ae606bc6d8867..d5319a6b826afd0f5e517c81864696c5a4e6d9ca 100644 GIT binary patch delta 1089 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 delta 1366 zcmV-c1*!U}3F!)uB!2;OQb$4nuFf3k00006VoOIv0RI600RN!9r;`8x010qNS#tmY z4c7nw4c7reD4Tcy000McNliru*a8R%Iv!oRm-qkx1nEgcK~zY`wUy0p8|M+mfA7bV z%Oy>j;)g84T-kwKs}Niuj_kHB5(rR$R)2sEI6#8}0es6LNPp0x7oU1BfV4pu7+|qG^E@-pyfZKS zpC19RxVRVxepe_IW`z*u`+|C&*KD`jzrAteMoj}EolY-#p7+ANd-pKrd*hQ%r*U2P zh57mUIlZv3aDPTA^^?`r)o%?bl}a2tc8ula znVz1eP$4|X<;~YJC zmA!6{`>(%@WoyiU(L9X^{!ux~{jVgM#5V`+i&h-Neh=!xBKqeNtz zyhqYbkWR*^HUl2%EXRa6OrW*K3&!!b86Cwaiio0!oa&QN9-r=}xE&woxsN{JcqxyG zfq$BqC8&N$fFauHadV&uQi&0U41xe51a54XS-XQ)5`ZuaF~(qw;i&SNvIiJr*g2Bt zkGnBGuQ%w`n|ReK+iNYFYn%M3(c@;Kh%p8+tYFyWjz};Y@9>N9Ce@zedMisahyfg$ z>?n#@Pfzmu?lyDF_sA@N%r0<0Ot4{1B7cM!B^E`|*Ai`qn!BD&O8A^~e9~>7hOzd+ zt$pAy3`eD7J1m>T*I+UlC2*($-}h@l5DZST8J|6}!{3`}Ha4A621CH1JqhyU`_q<8 zCaF{^bpdec(xtymO-(Jd+ifw_ev~QTYLBAT=Td-E(tb0Jl}ZKA^BVnr|IfylkA)B)*tY%Q%F2rWG|+JAh>3}b zyw>`tQtCCO)X$?RnovqP!$oI|A%By};5ZKJ>+2X}a<*;%>R?v<-QC?y*L7D0gTWhG z>vpYH+W_`7K(Sa%gkkth7>47eQt4-fLctA!KzW`=7>4Za?a}Y|DVNK{<8ijOws0JW zcs!0$3deC`sZ^@i?RKrZckli%48zS_E*CZ$jdcxBuh)CPzW`=tW|pETT2FLc_myI? zctR<41c)1BEI=4zq?9reLhK#bPN&n^c=YJeyOw3WQ>)ds|L4p6%9ShD#fujc|4q!l Y0RWnFrplEP$^ZZW07*qoM6N<$f)tIVDF6Tf diff --git a/data/icons/48x48/apps/terminator.png b/data/icons/48x48/apps/terminator.png index 9f8159963e77714b6afd0ddb626f4ea01517c5d6..4125c9fc91b96c9698f0c08365de0f9b615528a1 100644 GIT binary patch delta 2565 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 diff --git a/data/icons/scalable/apps/terminator.svg b/data/icons/scalable/apps/terminator.svg index 4883dbf3..f85b606c 100644 --- a/data/icons/scalable/apps/terminator.svg +++ b/data/icons/scalable/apps/terminator.svg @@ -2,551 +2,524 @@ - - - - - - - - + id="defs1308"> + + + id="linearGradient5060"> + id="stop5062" /> + id="stop5064" /> + + id="linearGradient5048"> + id="stop5050" /> - - - - - + style="stop-color:black;stop-opacity:1;" /> - - - - + id="stop5052" /> + xlink:href="#linearGradient5048" + id="linearGradient5027" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" + x1="302.85715" + y1="366.64789" + x2="302.85715" + y2="609.50507" /> + + + + + + + + + + + + + + + + + + + id="stop2240" /> + id="stop2242" /> + id="linearGradient2224"> + style="stop-color:#32342f;stop-opacity:0.54639173;" + offset="0.0000000" + id="stop2226" /> + id="stop2228" /> + id="linearGradient2214"> + style="stop-color:#a9aaa7;stop-opacity:1.0000000;" + offset="0.0000000" + id="stop2216" /> - + style="stop-color:#676964;stop-opacity:1.0000000;" + offset="1.0000000" + id="stop2218" /> + id="linearGradient2206"> + + + + + id="stop2200" /> + id="stop2202" /> + gradientTransform="matrix(0.9500924,0,0,0.9650936,1.1833929,0.2767092)" /> + gradientTransform="matrix(0.957412,0.000000,0.000000,0.952331,1.022766,0.133307)" /> + + + gradientTransform="matrix(0.953506,0.000000,0.000000,0.947873,1.141528,1.205591)" /> + gradientTransform="matrix(0.9975908,0,0,0.9893614,4.354704e-2,9.1764254e-2)" /> - - + xlink:href="#linearGradient2214" + id="linearGradient5719" + x1="40.253334" + y1="42.318577" + x2="36.451904" + y2="37.999615" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.000000,0.000000,0.000000,0.744756,0.000000,9.569132)" /> - - - - - - - - - - + showgrid="false" + inkscape:grid-bbox="true" + inkscape:document-units="px" + inkscape:window-width="1460" + inkscape:window-height="1129" + inkscape:window-x="321" + inkscape:window-y="50" + showguides="true" + inkscape:guide-bbox="true" + inkscape:showpageshadow="false" /> + id="metadata1311"> image/svg+xml + Terminal + 2005-10-15 + + + Andreas Nilsson + + + + + terminal + emulator + term + command line + + + + + + Jakub Steiner + + + + + + + + + + - - - - + inkscape:groupmode="layer"> + + + + + + style="opacity:1.0000000;fill:url(#linearGradient2212);fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient2220);stroke-width:0.99999946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000" + id="rect1316" + width="44.996037" + height="38.998734" + x="1.5026338" + y="3.5015533" + rx="4.8517075" + ry="4.8517079" /> + style="opacity:1;fill:url(#linearGradient2204);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4260);stroke-width:0.99467027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect1314" + width="37.088291" + height="29.005329" + x="5.4357266" + y="7.4998446" + rx="1.6452278" + ry="1.6442512" /> + + + + + + + + + + + + + + - > | - > | - > | + style="opacity:0.76373626;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient2244);stroke-width:0.99999946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2232" + width="42.945141" + height="37.000587" + x="2.5542557" + y="4.5007114" + rx="3.7910469" + ry="3.7910469" /> - > | + style="font-size:18.58501053px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:#ff0000;stroke-width:0.36798642pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.2786885;font-family:Bitstream Vera Sans Mono" + d="M 8.5171086,12.191731 L 8.5171086,11.067756 L 11.823403,12.562073 L 11.823403,13.245026 L 8.5171086,14.749146 L 8.5171086,13.628511 L 11.079912,12.946316 L 8.5171086,12.191731 z M 15.469341,15.881295 L 15.469341,16.607773 L 11.457036,16.607773 L 11.457036,15.881295 L 15.469341,15.881295" + id="text1340" + sodipodi:nodetypes="ccccccccccccc" /> + style="opacity:0.72413791;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.2786885" + d="M 23 9.9375 L 23 21 L 7.96875 21 L 7.96875 23 L 23 23 L 23 34.09375 L 25 34.09375 L 25 23 L 40.03125 23 L 40.03125 21 L 25 21 L 25 9.9375 L 23 9.9375 z " + id="rect3228" /> - + - - - + sodipodi:nodetypes="ccccccc" + style="opacity:0.53142856;fill:url(#linearGradient2673);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 7.625388,8 C 7.102102,8 6.05153,8.190188 6.05153,9.0259761 L 6.16958,25.542519 C 23.841567,24.579133 20.294433,17.286426 42,13.633318 L 41.937264,9.2913791 C 41.859002,8.1662868 41.397947,8.0594548 40.327115,8.066071 L 7.625388,8 z " + id="path2443" /> + style="opacity:0.71428572999999995;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect1340" + width="34.026031" + height="26.057468" + x="6.9894562" + y="8.9805145" + rx="0.11773217" + ry="0.11773217" /> + + + style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" + id="path2300" + sodipodi:cx="28.3125" + sodipodi:cy="38.75" + sodipodi:rx="0.5625" + sodipodi:ry="0.5625" + d="M 28.875 38.75 A 0.5625 0.5625 0 1 1 27.75,38.75 A 0.5625 0.5625 0 1 1 28.875 38.75 z" + transform="translate(4.375000,-6.250000e-2)" /> + + + From 8ee314a2848efcb7d7b98522eb1af01c60afc8a0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 19 Mar 2008 17:16:58 +0000 Subject: [PATCH 03/58] move trunk to 0.9 --- debian/changelog | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a7ca8212..dd499cc6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +terminator (0.9-0ubuntu1) hardy; urgency=low + + * New upstream release + + -- Chris Jones Wed, 19 Mar 2008 17:16:25 +0000 + terminator (0.8.1-0ubuntu1) hardy; urgency=low * New upstream release diff --git a/setup.py b/setup.py index a47609d2..d94f3d65 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ class InstallData(install_data): setup(name='Terminator', - version='0.8.1', + version='0.9', description='Terminator, the robot future of terminals', author='Chris Jones', author_email='cmsj@tenshu.net', From 5ea8776fceadd9f533dc27330b548542cd734caf Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 29 Mar 2008 01:06:42 +0000 Subject: [PATCH 04/58] Fix up titlebar related actions now the widget is called titlebox --- terminator | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/terminator b/terminator index dc2340fc..8fd7451e 100755 --- a/terminator +++ b/terminator @@ -441,16 +441,20 @@ class TerminatorTerm: return False def do_scrollbar_toggle (self): - if self._scrollbar.get_property ('visible'): - self._scrollbar.hide () - else: - self._scrollbar.show () + self.toggle_widget_visibility (self._scrollbar) def do_title_toggle (self): - if self._title.get_property ('visible'): - self._title.hide () + self.toggle_widget_visibility (self._titlebox) + + def toggle_widget_visibility (self, widget): + if not isinstance (widget, gtk.Widget): + raise TypeError + + if widget.get_property ('visible'): + widget.hide () else: - self._title.show () + widget.show () + #keybindings for the individual splited terminals (affects only the #the selected terminal) def on_vte_key_press (self, term, event): @@ -577,8 +581,8 @@ class TerminatorTerm: item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ()) menu.append (item) - item = gtk.CheckMenuItem (_("Show Title")) - item.set_active (self._title.get_property ('visible')) + item = gtk.CheckMenuItem (_("Show _titlebar")) + item.set_active (self._titlebox.get_property ('visible')) item.connect ("toggled", lambda menu_item: self.do_title_toggle ()) menu.append (item) From 78e8aa42ae6dda1d68dfeed1f6102cd596a8043e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 29 Mar 2008 01:29:09 +0000 Subject: [PATCH 05/58] consistency and likely cross-platform improvement --- terminator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminator b/terminator index 8fd7451e..9263930c 100755 --- a/terminator +++ b/terminator @@ -132,7 +132,7 @@ class TerminatorTerm: self.cwd = cwd or os.getcwd(); if not os.path.exists(self.cwd) or not os.path.isdir(self.cwd): - self.cwd = os.path.expanduser("~") + self.cwd = pwd.getpwuid(os.getuid ())[5] if profile == None: profile = self.gconf_client.get_string (self.defaults['gt_dir'] + '/global/default_profile') From b31fee31ed6e2055b2b33b77e4616e3ac772cebf Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 29 Mar 2008 01:36:23 +0000 Subject: [PATCH 06/58] add global variables and use them --- terminator | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/terminator b/terminator index 9263930c..c69b1baa 100755 --- a/terminator +++ b/terminator @@ -17,12 +17,16 @@ """Terminator by Chris Jones """ +# Global defines +APP_NAME = 'terminator' +APP_VERSION = '0.9' + # import standard python libs import os, platform, sys, string, time, math from optparse import OptionParser import gettext -gettext.install ('terminator') +gettext.install (APP_NAME) # import unix-lib import pwd @@ -150,8 +154,8 @@ class TerminatorTerm: self.gconf_client.add_dir (self.profile, gconf.CLIENT_PRELOAD_RECURSIVE) self.gconf_client.notify_add (self.profile, self.on_gconf_notification) - if os.path.exists (pwd.getpwuid(os.getuid ())[5] + "/.terminatorrc"): - f = open (pwd.getpwuid (os.getuid ())[5] + "/.terminatorrc") + if os.path.exists (pwd.getpwuid(os.getuid ())[5] + "/." + APP_NAME + "rc"): + f = open (pwd.getpwuid (os.getuid ())[5] + "/." + APP_NAME + "rc") config = f.readlines () f.close () @@ -613,7 +617,7 @@ class TerminatorTerm: vte.set_property ("tooltip-text", vte.get_window_title ()) #set the title anyhow, titlebars setting only show/hide the label self._title.set_text(vte.get_window_title ()) - self.terminator.set_window_title("Terminator: %s" %vte.get_window_title ()) + self.terminator.set_window_title("%s: %s" %(APP_NAME.capitalize(), vte.get_window_title ())) def on_vte_focus_in(self, vte, event): self._titlebox.modify_bg(gtk.STATE_NORMAL,self.terminator.window.get_style().bg[gtk.STATE_SELECTED]) @@ -627,7 +631,7 @@ class TerminatorTerm: def on_vte_focus(self, vte): if vte.get_window_title (): - self.terminator.set_window_title("Terminator: %s" %vte.get_window_title ()) + self.terminator.set_window_title("%s: %s" %(APP_NAME.capitalize(), vte.get_window_title ())) def get_box (self): return self._box @@ -641,11 +645,11 @@ class Terminator: self._fullscreen = False self.window = gtk.Window () - self.window.set_title ("Terminator") + self.window.set_title (APP_NAME.capitalize()) # FIXME: This really shouldn't be a hardcoded path try: - self.window.set_icon_from_file ("/usr/share/icons/hicolor/48x48/apps/terminator.png") + self.window.set_icon_from_file ("/usr/share/icons/hicolor/48x48/apps/" + APP_NAME + ".png") except: self.icon = self.window.render_icon (gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) self.window.set_icon (self.icon) @@ -681,7 +685,7 @@ class Terminator: self.window.show () def maximize (self): - """ Maximize the Terminator.""" + """ Maximize the Terminator window.""" self.window.maximize () def toggle_fullscreen (self): @@ -942,13 +946,13 @@ if __name__ == '__main__': usage = "usage: %prog [options]" parser = OptionParser (usage) parser.add_option ("-d", "--debug", action="store_true", dest="debug", help="Enable debugging information") - parser.add_option ("-m", "--maximise", action="store_true", dest="maximise", help="Open the Terminator window maximised") + parser.add_option ("-m", "--maximise", action="store_true", dest="maximise", help="Open the %s window maximised"%APP_NAME.capitalize()) parser.add_option ("-f", "--fullscreen", action="store_true", dest="fullscreen", help="Set the window into fullscreen mode") parser.add_option ("-b", "--borderless", action="store_true", dest="borderless", help="Turn off the window's borders") parser.add_option ("-p", "--profile", dest="profile", help="Specify a GNOME Terminal profile to emulate") parser.add_option ("-e", "--command", dest="command", help="Execute the argument to this option inside the terminal") parser.add_option ("-x", "--execute", dest="execute", action="callback", callback=execute_cb, help="Execute the remainder of the command line inside the terminal") - parser.add_option ("-g", "--no-gconf", dest="nogconf", action="store_true", help="Disable gconf usage, falling back on ~/.terminatorrc and defaults") + parser.add_option ("-g", "--no-gconf", dest="nogconf", action="store_true", help="Disable gconf usage, falling back on ~/." + APP_NAME.capitalize() + "rc and defaults") (options, args) = parser.parse_args () if len (args) != 0: From 00e8127246821a4744e35488702d952f150edf00 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 29 Mar 2008 01:40:49 +0000 Subject: [PATCH 07/58] display version with -v --- terminator | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/terminator b/terminator index c69b1baa..eab7487b 100755 --- a/terminator +++ b/terminator @@ -945,6 +945,7 @@ if __name__ == '__main__': usage = "usage: %prog [options]" parser = OptionParser (usage) + parser.add_option ("-v", "--version", action="store_true", dest="version", help="Display program version") parser.add_option ("-d", "--debug", action="store_true", dest="debug", help="Enable debugging information") parser.add_option ("-m", "--maximise", action="store_true", dest="maximise", help="Open the %s window maximised"%APP_NAME.capitalize()) parser.add_option ("-f", "--fullscreen", action="store_true", dest="fullscreen", help="Set the window into fullscreen mode") @@ -958,6 +959,10 @@ if __name__ == '__main__': if len (args) != 0: parser.error("Expecting zero additional arguments, found: %d"%len (args)) + if options.version: + print "%s %s"%(APP_NAME, APP_VERSION) + sys.exit (0) + command = [] if (options.command): command.append (options.command) From 8ce3f6f6267ff7a1b6dc8fef5c26cd5172a8444f Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 29 Mar 2008 14:57:37 +0000 Subject: [PATCH 08/58] update setup.py to use version from terminator --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d94f3d65..5278463c 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from distutils.core import setup from distutils.command.install_data import install_data from distutils.dep_util import newer from distutils.log import info +from terminator import APP_VERSION import glob import os import sys @@ -44,12 +45,12 @@ class InstallData(install_data): setup(name='Terminator', - version='0.9', + version=APP_VERSION, description='Terminator, the robot future of terminals', author='Chris Jones', author_email='cmsj@tenshu.net', url='http://www.tenshu.net/terminator/', - license='GPL v2', + license='GNU GPL v2', scripts=['terminator'], data_files=[ ('share/applications', ['data/terminator.desktop']), From 65cb27c2bb7d5c346ec2ca04911536f0fc6b867f Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 2 Apr 2008 22:10:32 +0100 Subject: [PATCH 09/58] Start landing configclass work --- terminator | 260 +++++++++++--------------------------------- terminatorconfig.py | 26 ++++- 2 files changed, 86 insertions(+), 200 deletions(-) diff --git a/terminator b/terminator index eab7487b..fec4324e 100755 --- a/terminator +++ b/terminator @@ -31,34 +31,8 @@ gettext.install (APP_NAME) # import unix-lib import pwd -# import gconf if possible, if not construct a fake replacement -class fakegconfclient: - def get_string (self, key): - return ("") - def get_list (self, key, type): - return ([]) - def add_dir (self, profile, path): - return (True) - def notify_add (self, profile, callback): - return (True) - def get_bool (self, key): - return (False) - def get (self, key): - return (0) -class fakegconf: - CLIENT_PRELOAD_RECURSIVE = False - VALUE_STRING = "" - VALUE_INT = 0 - VALUE_FLOAT = 0.0 - VALUE_BOOL = False - def client_get_default (self): - foo = fakegconfclient () - return (foo) - -try: - import gconf -except: - pass +# import our configuration loader +import terminatorconfig # import gtk libs # check just in case anyone runs it on a non-gnome system. @@ -96,92 +70,19 @@ def openurl (url): class TerminatorTerm: - # Our settings - defaults = { - 'gt_dir' : '/apps/gnome-terminal', - '_profile_dir' : '%s/profiles', - 'titlebars' : True, - 'titletips' : False, - 'allow_bold' : True, - 'silent_bell' : True, - 'background_color' : '#000000', - 'background_darkness' : 0.5, - 'background_type' : 'solid', - 'backspace_binding' : 'ascii-del', - 'delete_binding' : 'delete-sequence', - 'cursor_blink' : False, - 'emulation' : 'xterm', - 'font' : 'Serif 10', - 'foreground_color' : '#AAAAAA', - 'scrollbar_position' : "right", - 'scroll_background' : True, - 'scroll_on_keystroke' : False, - 'scroll_on_output' : False, - 'scrollback_lines' : 100, - 'focus' : 'sloppy', - 'exit_action' : 'close', - 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', - 'word_chars' : '-A-Za-z0-9,./?%&#:_', - 'mouse_autohide' : True, - } - matches = {} def __init__ (self, terminator, profile = None, command = None, cwd = None): - self.defaults['profile_dir'] = self.defaults['_profile_dir']%(self.defaults['gt_dir']) - self.terminator = terminator - self.gconf_client = gconf.client_get_default () + self.conf = terminator.conf self.command = command self.cwd = cwd or os.getcwd(); if not os.path.exists(self.cwd) or not os.path.isdir(self.cwd): self.cwd = pwd.getpwuid(os.getuid ())[5] - if profile == None: - profile = self.gconf_client.get_string (self.defaults['gt_dir'] + '/global/default_profile') - - self.profile = "" - profiles = self.gconf_client.get_list (self.defaults['gt_dir'] + '/global/profile_list', 'string') - - if profile in profiles: - self.profile = '%s/%s'%(self.defaults['profile_dir'], profile) - else: - if profile != "Default" and "Default" in profiles: - self.profile = '%s/Default'%(self.defaults['profile_dir']) - - if self.profile: - self.gconf_client.add_dir (self.profile, gconf.CLIENT_PRELOAD_RECURSIVE) - self.gconf_client.notify_add (self.profile, self.on_gconf_notification) - - if os.path.exists (pwd.getpwuid(os.getuid ())[5] + "/." + APP_NAME + "rc"): - f = open (pwd.getpwuid (os.getuid ())[5] + "/." + APP_NAME + "rc") - config = f.readlines () - f.close () - - for line in config: - try: - line = line.strip () - if line[0] == '#': - pass - elif line: - (key,value) = line.split ("=") - print >> sys.stderr, _('''Overriding setting '%s' from value '%s' to: '%s' ''')%(key.strip (), self.defaults[key.strip ()], value.strip ()) - if value.strip() == "True": - self.defaults[key.strip ()] = True - elif value.strip() == "False": - self.defaults[key.strip ()] = False - else: - self.defaults[key.strip ()] = value.strip () - except: - pass - - self.gconf_client.add_dir ('/apps/metacity/general', gconf.CLIENT_PRELOAD_RECURSIVE) - self.gconf_client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notification) - self.clipboard = gtk.clipboard_get (gtk.gdk.SELECTION_CLIPBOARD) - - self.scrollbar_position = self.reconf ('scrollbar_position') + self.scrollbar_position = self.conf.scrollbar_position self._vte = vte.Terminal () self._vte.set_size (80, 24) @@ -198,11 +99,11 @@ class TerminatorTerm: self._box.show() self._box.pack_start(self._titlebox, False) self._box.pack_start(self._termbox) - if self.reconf('titlebars'): + if self.conf.titlebars: self._titlebox.show() else: self._titlebox.hide() - + self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ()) if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled": self._scrollbar.show () @@ -224,8 +125,7 @@ class TerminatorTerm: self._vte.connect ("focus-out-event", self.on_vte_focus_out) self._vte.connect ("focus-in-event", self.on_vte_focus_in) - exit_action = self.gconf_client.get_string (self.profile + "/exit_action") - exit_action = self.reconf ("exit_action") + exit_action = self.conf.exit_action if exit_action == "restart": self._vte.connect ("child-exited", self.spawn_child) # We need to support "left" because some buggy versions of gnome-terminal @@ -246,14 +146,14 @@ class TerminatorTerm: self.spawn_child () def spawn_child (self, event=None): - update_records = self.gconf_client.get_bool (self.profile + "/update_records") or True - login = self.gconf_client.get_bool (self.profile + "/login_shell") or False + update_records = self.conf.update_records + login = self.conf.login_shell if self.command: args = self.command shell = self.command[0] - elif self.gconf_client.get_bool (self.profile + "/use_custom_command") == True: - args = self.gconf_client.get_string (self.profile + "/custom_command").split () + elif self.conf.use_custom_command: + args = self.conf.custom_command.split () shell = args[0] else: shell = pwd.getpwuid (os.getuid ())[6] @@ -275,42 +175,19 @@ class TerminatorTerm: cwd = None return (cwd) - def reconf (self, property): - value = self.gconf_client.get ('%s/%s'%(self.profile, property)) - ret = None - if not value: - try: - ret = self.defaults[property] - except: - pass - else: - if value.type == gconf.VALUE_STRING: - ret = value.get_string () - elif value.type == gconf.VALUE_INT: - ret = value.get_int () - elif value.type == gconf.VALUE_FLOAT: - ret = value.get_float () - elif value.type == gconf.VALUE_BOOL: - ret = value.get_bool () - - if ret == None: - print >> sys.stderr, _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property - - return (ret) - def reconfigure_vte (self): # Set our emulation - self._vte.set_emulation (self.defaults['emulation']) + self._vte.set_emulation (self.conf.emulation) # Set our wordchars - self._vte.set_word_chars (self.reconf ('word_chars')) + self._vte.set_word_chars (self.conf.word_chars) # Set our mouselation - self._vte.set_mouse_autohide (self.defaults['mouse_autohide']) + self._vte.set_mouse_autohide (self.conf.mouse_autohide) # Set our compatibility - backspace = self.reconf ('backspace_binding') - delete = self.reconf ('delete_binding') + backspace = self.conf.backspace_binding + delete = self.conf.delete_binding # Note, each of the 4 following comments should replace the line beneath it, but the python-vte bindings don't appear to support this constant, so the magic values are being assumed from the C enum :/ if backspace == "ascii-del": @@ -330,28 +207,23 @@ class TerminatorTerm: self._vte.set_backspace_binding (backbind) self._vte.set_delete_binding (delbind) - # Set our font, preferably from gconf settings - if self.gconf_client.get_bool (self.profile + "/use_system_font"): - font_name = (self.gconf_client.get_string ("/desktop/gnome/interface/monospace_font_name") or self.defaults['font']) - else: - font_name = self.reconf ('font') - + # Set our font try: - self._vte.set_font (pango.FontDescription (font_name)) + self._vte.set_font (pango.FontDescription (self.conf.font)) except: pass # Set our boldness - self._vte.set_allow_bold (self.reconf ('allow_bold')) + self._vte.set_allow_bold (self.conf.allow_bold) - # Set our color scheme, preferably from gconf settings - palette = self.reconf ('palette') - if self.gconf_client.get_bool (self.profile + "/use_theme_colors"): + # Set our color scheme + palette = self.conf.palette + if self.conf.use_theme_colors: fg_color = self._vte.get_style ().text[gtk.STATE_NORMAL] bg_color = self._vte.get_style ().base[gtk.STATE_NORMAL] else: - fg_color = gtk.gdk.color_parse (self.reconf ('foreground_color')) - bg_color = gtk.gdk.color_parse (self.reconf ('background_color')) + fg_color = gtk.gdk.color_parse (self.conf.foreground_color) + bg_color = gtk.gdk.color_parse (self.conf.background_color) colors = palette.split (':') palette = [] @@ -362,12 +234,12 @@ class TerminatorTerm: # Set our background image, transparency and type # Many thanks to the authors of gnome-terminal, on which this code is based. - background_type = self.reconf ('background_type') + background_type = self.conf.background_type # set background image settings if background_type == "image": - self._vte.set_background_image_file (self.reconf ('background_image')) - self._vte.set_scroll_background (self.reconf('scroll_background')) + self._vte.set_background_image_file (self.conf.background_image) + self._vte.set_scroll_background (self.conf.scroll_background) else: self._vte.set_background_image_file('') self._vte.set_scroll_background(False) @@ -375,8 +247,8 @@ class TerminatorTerm: # set transparency for the background (image) if background_type in ("image", "transparent"): self._vte.set_background_tint_color (bg_color) - self._vte.set_background_saturation(1 - (self.reconf ('background_darkness'))) - self._vte.set_opacity(int(self.reconf('background_darkness') * 65535)) + self._vte.set_background_saturation(1 - (self.conf.background_darkness)) + self._vte.set_opacity(int(self.conf.background_darkness * 65535)) else: self._vte.set_background_saturation(1) self._vte.set_opacity(65535) @@ -387,43 +259,39 @@ class TerminatorTerm: self._vte.set_background_transparent (False) # Set our cursor blinkiness - self._vte.set_cursor_blinks = (self.reconf ('cursor_blink')) + self._vte.set_cursor_blinks = (self.conf.cursor_blink) # Set our audible belliness - silent_bell = self.reconf ('silent_bell') + silent_bell = self.conf.silent_bell self._vte.set_audible_bell = not silent_bell self._vte.set_visible_bell = silent_bell # Set our scrolliness - self._vte.set_scrollback_lines (self.reconf ('scrollback_lines')) - self._vte.set_scroll_on_keystroke (self.reconf ('scroll_on_keystroke')) - self._vte.set_scroll_on_output (self.reconf ('scroll_on_output')) + self._vte.set_scrollback_lines (self.conf.scrollback_lines) + self._vte.set_scroll_on_keystroke (self.conf.scroll_on_keystroke) + self._vte.set_scroll_on_output (self.conf.scroll_on_output) - scrollbar_position = self.reconf ('scrollbar_position') + if self.scrollbar_position != self.conf.scrollbar_position: + self.scrollbar_position = self.conf.scrollbar_position - if scrollbar_position != self.scrollbar_position: - if scrollbar_position == 'hidden' or scrollbar_position == 'disabled': + if self.scrollbar_position == 'hidden' or self.scrollbar_position == 'disabled': self._scrollbar.hide () else: self._scrollbar.show () - if scrollbar_position == 'right': + if self.scrollbar_position == 'right': self._box.remove (self._scrollbar) self._box.remove (self._vte) self._box.pack_start (self._vte) self._box.pack_start (self._scrollbar) - elif scrollbar_position == 'left': + elif self.scrollbar_position == 'left': self._box.remove (self._vte) self._box.remove (self._scrollbar) self._box.pack_start(self._scrollbar) self._box.pack_start(self._vte) - self.scrollbar_position = scrollbar_position # Set our sloppiness - self.focus = self.gconf_client.get_string ("/apps/metacity/general/focus_mode") or self.defaults['focus'] - - def on_gconf_notification (self, client, cnxn_id, entry, what): - self.reconfigure_vte () + self.focus = self.conf.focus def on_composited_changed (self, widget): self.reconfigure_vte () @@ -612,7 +480,7 @@ class TerminatorTerm: return menu def on_vte_title_change(self, vte): - if self.reconf ('titletips'): + if self.conf.titletips: vte.set_property ("has-tooltip", True) vte.set_property ("tooltip-text", vte.get_window_title ()) #set the title anyhow, titlebars setting only show/hide the label @@ -639,11 +507,24 @@ class TerminatorTerm: class Terminator: def __init__ (self, profile, command = None, fullscreen = False, maximise = False, borderless = False): self.profile = profile - self.gconf_client = gconf.client_get_default () self.command = command self._fullscreen = False + stores = [] + stores.append (terminatorconfig.TerminatorConfValuestoreRC ()) + +# FIXME: enable this again, we should trap and discard broken gconf stuff +# try: + import gconf + store = terminatorconfig.TerminatorConfValuestoreGConf () + store.set_reconfigure_callback (self.reconfigure_vtes) + stores.append (store) +# except: +# pass + + self.conf = terminatorconfig.TerminatorConfig (stores) + self.window = gtk.Window () self.window.set_title (APP_NAME.capitalize()) @@ -874,9 +755,6 @@ class Terminator: #self.window.set_title(self.term_list[previous]._vte.get_window_title()) self.term_list[previous]._vte.grab_focus () - - - def resizeterm (self, widget, keyname): vertical = False @@ -893,23 +771,21 @@ class Terminator: #We have a corresponding parent pane # #allocation = parent.get_allocation() - + if keyname in ('Up', 'Down'): maxi = parent.get_child1().get_allocation().height + parent.get_child2().get_allocation().height - 1 - + else: maxi = parent.get_child1().get_allocation().width + parent.get_child2().get_allocation().width - 1 move = 10 if keyname in ('Up', 'Left'): move = -10 - - + move = max(2, parent.get_position() + move) move = min(maxi, move) - + parent.set_position(move) - - + def get_first_parent_paned (self, widget, vertical = None): """This method returns the first parent pane of a widget. if vertical is True returns the first VPaned @@ -925,14 +801,12 @@ class Terminator: elif isinstance (parent, gtk.HPaned) and not vertical: return parent return self.get_first_parent_paned(parent, vertical) - + + def reconfigure_vtes (self): + for term in self.term_list: + term.reconfigure_vte () + if __name__ == '__main__': - try: - if (gconf): - pass - except: - # Install a fake gconf setup - gconf = fakegconf () def execute_cb (option, opt, value, parser): assert value is None @@ -953,7 +827,6 @@ if __name__ == '__main__': parser.add_option ("-p", "--profile", dest="profile", help="Specify a GNOME Terminal profile to emulate") parser.add_option ("-e", "--command", dest="command", help="Execute the argument to this option inside the terminal") parser.add_option ("-x", "--execute", dest="execute", action="callback", callback=execute_cb, help="Execute the remainder of the command line inside the terminal") - parser.add_option ("-g", "--no-gconf", dest="nogconf", action="store_true", help="Disable gconf usage, falling back on ~/." + APP_NAME.capitalize() + "rc and defaults") (options, args) = parser.parse_args () if len (args) != 0: @@ -968,9 +841,6 @@ if __name__ == '__main__': command.append (options.command) if (options.execute): command = options.execute - if (options.nogconf): - del (gconf) - gconf = fakegconf () term = Terminator (options.profile, command, options.fullscreen, options.maximise, options.borderless) diff --git a/terminatorconfig.py b/terminatorconfig.py index 0b880fb0..bfbf8102 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -70,10 +70,6 @@ class TerminatorConfig: dbg ("Config: Out of sources") raise (AttributeError) - def set_reconfigure_callback (self, function): - self.reconfigure_callback = function - return (True) - class TerminatorConfValuestore: type = "Base" values = {} @@ -108,6 +104,12 @@ class TerminatorConfValuestore: 'palette' : [str, '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF'], 'word_chars' : [str, '-A-Za-z0-9,./?%&#:_'], 'mouse_autohide' : [bool, True], + 'update_records' : [bool, True], + 'login_shell' : [bool, False], + 'use_custom_command' : [bool, False], + 'custom_command' : [str, ''], + 'use_system_font' : [bool, True], + 'use_theme_colors' : [bool, True], } def __getattr__ (self, keyname): @@ -150,6 +152,8 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): def __init__ (self, profile = None): self.type = "GConf" + import gconf + self.client = gconf.client_get_default () # Grab a couple of values from base class to avoid recursing with our __getattr__ @@ -178,8 +182,15 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): self.client.add_dir ('/apps/metacity/general', gconf.CLIENT_PRELOAD_RECURSIVE) self.client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notify) + # FIXME: Do we need to watch more non-profile stuff here? + + def set_reconfigure_callback (self, function): + dbg ("Config: setting callback to: %s"%function) + self.reconfigure_callback = function + return (True) def on_gconf_notify (self, client, cnxn_id, entry, what): + dbg ("VSGConf: gconf changed, callback is: %s"%self.reconfigure_callback) if self.reconfigure_callback: self.reconfigure_callback () @@ -187,7 +198,12 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): ret = None dbg ('VSGConf: preparing: %s/%s'%(self.profile, key)) - value = self.client.get ('%s/%s'%(self.profile, key)) + + if key == 'font': + if self.use_system_font: + value = self.client.get ('/desktop/gnome/interface/monospace_font_name') + else: + value = self.client.get ('%s/%s'%(self.profile, key)) dbg ('VSGConf: getting: %s'%value) if value: funcname = "get_" + self.defaults[key][0].__name__ From 7ad18d591c6468a7251b107bd7942d7d67d6612f Mon Sep 17 00:00:00 2001 From: Nicolas Valcarcel Date: Wed, 2 Apr 2008 23:44:58 -0500 Subject: [PATCH 10/58] fixed terminator import on setup.py --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5278463c..2eccfe9a 100755 --- a/setup.py +++ b/setup.py @@ -4,11 +4,19 @@ from distutils.core import setup from distutils.command.install_data import install_data from distutils.dep_util import newer from distutils.log import info -from terminator import APP_VERSION import glob import os import sys +def import_terminator(): + from types import ModuleType + module = ModuleType('terminator') + module_file = open('terminator', 'r') + exec module_file in module.__dict__ + return module + +APP_VERSION = import_terminator().APP_VERSION + class InstallData(install_data): def run (self): self.data_files.extend (self._compile_po_files ()) From 2b94e955b3b298df3eaaca2926cbaa22e7257173 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 3 Apr 2008 07:17:58 +0100 Subject: [PATCH 11/58] update watch file for new launchpad layout --- debian/watch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/watch b/debian/watch index e1a61e46..649e09ec 100644 --- a/debian/watch +++ b/debian/watch @@ -1,2 +1,2 @@ version=3 -https://launchpad.net/terminator/+download .*/terminator_(.+)\.tar\.gz +https://launchpad.net/terminator/+download http://launchpad.net/terminator/.*/terminator_(.+)\.tar\.gz From 968df7a0df650ac460139d31a6e5a9a82871ebbb Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 21:35:41 +0100 Subject: [PATCH 12/58] Add Cory to README for the shiny new icon, and update the version number because it'll need doing eventually --- README | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README b/README index a111ce8b..bc7cd21d 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Terminator 0.8.1 +Terminator 0.9 by Chris Jones This is a little python script to give me lots of terminals in a single window, saving me valuable laptop screen space otherwise wasted on window decorations and not quite being able to fill the screen with terminals. @@ -20,4 +20,5 @@ the gedit terminal plugin is part of the gedit-plugins package, which is licence I am thus licensing Terminator as GPL v2 only. -Cristian Grada provided the icon under the same licence. +Cristian Grada provided the old icon under the same licence. +Cory Kontros provided the new icon under the CC-by-SA licence. From 4991b0ae212598f3a5eb056dfe4b7f98b9c5819e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 21:49:10 +0100 Subject: [PATCH 13/58] Improve configclass debug output a little, and be safer about a variable that might not exist --- terminatorconfig.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index bfbf8102..02154697 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -58,16 +58,16 @@ class TerminatorConfig: self.sources.append (source) def __getattr__ (self, keyname): - dbg ("Config: Looking for: %s"%keyname) + dbg ("TConfig: Looking for: '%s'"%keyname) for source in self.sources: try: val = getattr (source, keyname) - dbg ("Config: got: %s from a %s"%(val, source.type)) + dbg (" TConfig: got: '%s' from a '%s'"%(val, source.type)) return (val) except: - dbg ("Config: no value found in %s."%source.type) + dbg (" TConfig: no value found in '%s'."%source.type) pass - dbg ("Config: Out of sources") + dbg (" TConfig: Out of sources") raise (AttributeError) class TerminatorConfValuestore: @@ -140,7 +140,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): item = item.strip () if item and item[0] != '#': (key, value) = item.split ("=") - dbg ("VS_RCFile: Setting value %s to %s"%(key, value)) + dbg (" VS_RCFile: Setting value %s to %s"%(key, value)) self.values[key] = [self.defaults[key][0], self.defaults[key][0](value)] except: pass @@ -165,10 +165,10 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): profiles = self.client.get_list (self._gt_dir + '/global/profile_list','string') if profile in profiles: - dbg ("VSGConf: Found profile '%s' in profile_list"%profile) + dbg (" VSGConf: Found profile '%s' in profile_list"%profile) self.profile = '%s/%s'%(self._profile_dir, profile) elif "Default" in profiles: - dbg ("VSGConf: profile '%s' not found, but 'Default' exists"%profile) + dbg (" VSGConf: profile '%s' not found, but 'Default' exists"%profile) self.profile = '%s/%s'%(self._profile_dir, "Default") else: # We're a bit stuck, there is no profile in the list @@ -185,26 +185,27 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): # FIXME: Do we need to watch more non-profile stuff here? def set_reconfigure_callback (self, function): - dbg ("Config: setting callback to: %s"%function) + dbg (" VSConf: setting callback to: %s"%function) self.reconfigure_callback = function return (True) def on_gconf_notify (self, client, cnxn_id, entry, what): - dbg ("VSGConf: gconf changed, callback is: %s"%self.reconfigure_callback) + dbg (" VSGConf: gconf changed, callback is: %s"%self.reconfigure_callback) if self.reconfigure_callback: self.reconfigure_callback () def __getattr__ (self, key = ""): ret = None + value = None - dbg ('VSGConf: preparing: %s/%s'%(self.profile, key)) + dbg (' VSGConf: preparing: %s/%s'%(self.profile, key)) if key == 'font': if self.use_system_font: value = self.client.get ('/desktop/gnome/interface/monospace_font_name') else: value = self.client.get ('%s/%s'%(self.profile, key)) - dbg ('VSGConf: getting: %s'%value) + if value: funcname = "get_" + self.defaults[key][0].__name__ # Special case for str From 13cca0c1d966d1d06730fc1103217e360d222638 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Mon, 7 Apr 2008 22:38:15 +0100 Subject: [PATCH 14/58] Make URL regexps work on FreeBSD by applying the same changes FreeBSD ports make to gnome-terminal --- terminator | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/terminator b/terminator index eab7487b..b79dd11b 100755 --- a/terminator +++ b/terminator @@ -236,12 +236,12 @@ class TerminatorTerm: self._vte.add_events (gtk.gdk.ENTER_NOTIFY_MASK) self._vte.connect ("enter_notify_event", self.on_vte_notify_enter) - self.matches['full_uri'] = self._vte.match_add ('''\<(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)//([-A-Za-z0-9]+(:[-A-Za-z0-9,?;.:/!%$^*&~"#']+)?@)?[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?\>/?''') - self.matches['addr_only'] = self._vte.match_add ('''\<(www|ftp)[-A-Za-z0-9]*\.[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?\>/?''') + self.matches['full_uri'] = self._vte.match_add ('''[[:<:]](news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)//([-A-Za-z0-9]+(:[-A-Za-z0-9,?;.:/!%$^*&~"#']+)?@)?[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?[[:>:]]/?''') + self.matches['addr_only'] = self._vte.match_add ('''[[:<:]](www|ftp)[-A-Za-z0-9]*\.[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?[[:>:]]/?''') - self.matches['email'] = self._vte.match_add ('''\<(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+\>''') + self.matches['email'] = self._vte.match_add ('''[[:<:]](mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+[[:>:]]''') - self.matches['nntp'] = self._vte.match_add ('''\''') + self.matches['nntp'] = self._vte.match_add ('''[[:<:]]news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?[[:>:]]''') self.spawn_child () From 41ab710fbe0671c119774ef4623d83451899dcf1 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 22:46:26 +0100 Subject: [PATCH 15/58] add another ugly override for non-gnome-terminal gconf setting. this time it's focus --- terminatorconfig.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 02154697..80c863bb 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -65,8 +65,8 @@ class TerminatorConfig: dbg (" TConfig: got: '%s' from a '%s'"%(val, source.type)) return (val) except: - dbg (" TConfig: no value found in '%s'."%source.type) pass + dbg (" TConfig: Out of sources") raise (AttributeError) @@ -206,6 +206,9 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): else: value = self.client.get ('%s/%s'%(self.profile, key)) + if key == 'focus': + value = self.client.get ('/apps/metacity/general/focus_mode') + if value: funcname = "get_" + self.defaults[key][0].__name__ # Special case for str From e9b5a3dfb4212bef6ee2000e72e0ef624ad63720 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 23:26:51 +0100 Subject: [PATCH 16/58] Font special case was logically very broken --- terminatorconfig.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 80c863bb..c5f54d1f 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -199,16 +199,15 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = None dbg (' VSGConf: preparing: %s/%s'%(self.profile, key)) - - if key == 'font': - if self.use_system_font: - value = self.client.get ('/desktop/gnome/interface/monospace_font_name') + + # FIXME: Ugly special cases we should look to fix in some other way. + if key == 'font' and self.use_system_font:: + value = self.client.get ('/desktop/gnome/interface/monospace_font_name') + elif key == 'focus': + value = self.client.get ('/apps/metacity/general/focus_mode') else: value = self.client.get ('%s/%s'%(self.profile, key)) - if key == 'focus': - value = self.client.get ('/apps/metacity/general/focus_mode') - if value: funcname = "get_" + self.defaults[key][0].__name__ # Special case for str From 881d9e9d0d32fc7dc99d0cb8700b3c048b1ff9a4 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 23:28:11 +0100 Subject: [PATCH 17/58] oops, typo --- terminatorconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index c5f54d1f..b2584235 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -201,7 +201,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): dbg (' VSGConf: preparing: %s/%s'%(self.profile, key)) # FIXME: Ugly special cases we should look to fix in some other way. - if key == 'font' and self.use_system_font:: + if key == 'font' and self.use_system_font: value = self.client.get ('/desktop/gnome/interface/monospace_font_name') elif key == 'focus': value = self.client.get ('/apps/metacity/general/focus_mode') From 5f5d01a0033107a8df9cb991543f938d81f7911d Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 7 Apr 2008 23:50:01 +0100 Subject: [PATCH 18/58] vastly improve scrollbar handling --- terminator | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/terminator b/terminator index ef54b978..45d60ad1 100755 --- a/terminator +++ b/terminator @@ -278,17 +278,10 @@ class TerminatorTerm: self._scrollbar.hide () else: self._scrollbar.show () - if self.scrollbar_position == 'right': - self._box.remove (self._scrollbar) - self._box.remove (self._vte) - self._box.pack_start (self._vte) - self._box.pack_start (self._scrollbar) - elif self.scrollbar_position == 'left': - self._box.remove (self._vte) - self._box.remove (self._scrollbar) - self._box.pack_start(self._scrollbar) - self._box.pack_start(self._vte) - + if self.scrollbar_position == 'right': + self._termbox.reorder_child (self._vte, 0) + elif self.scrollbar_position == 'left': + self._termbox.reorder_child (self._scrollbar, 0) # Set our sloppiness self.focus = self.conf.focus From c5401d7d4b2c836951441518e65775e6ade07a48 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 8 Apr 2008 00:12:22 +0100 Subject: [PATCH 19/58] watch the system monospace font setting. Fixes LP #197960 --- terminatorconfig.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorconfig.py b/terminatorconfig.py index b2584235..3de51045 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -182,6 +182,8 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): self.client.add_dir ('/apps/metacity/general', gconf.CLIENT_PRELOAD_RECURSIVE) self.client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notify) + self.client.add_dir ('/desktop/gnome/interface', gconf.CLIENT_PRELOAD_RECURSIVE) + self.client.notify_add ('/desktop/gnome/interface/monospace_font_name', self.on_gconf_notify) # FIXME: Do we need to watch more non-profile stuff here? def set_reconfigure_callback (self, function): From 660344a8b71098b706b93e4218d8b5ea82d3ba39 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 8 Apr 2008 00:22:01 +0100 Subject: [PATCH 20/58] fall back to old regexps if the freebsd ones don't work --- terminator | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/terminator b/terminator index 45d60ad1..7706e56d 100755 --- a/terminator +++ b/terminator @@ -137,11 +137,20 @@ class TerminatorTerm: self._vte.connect ("enter_notify_event", self.on_vte_notify_enter) self.matches['full_uri'] = self._vte.match_add ('''[[:<:]](news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)//([-A-Za-z0-9]+(:[-A-Za-z0-9,?;.:/!%$^*&~"#']+)?@)?[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?[[:>:]]/?''') + if self.matches['full_uri'] == -1: + self.matches['full_uri'] = self._vte.match_add ('''\<(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)//([-A-Za-z0-9]+(:[-A-Za-z0-9,?;.:/!%$^*&~"#']+)?@)?[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?\>/?''') + self.matches['addr_only'] = self._vte.match_add ('''[[:<:]](www|ftp)[-A-Za-z0-9]*\.[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?[[:>:]]/?''') + if self.matches['addr_only'] == -1: + self.matches['addr_only'] = self._vte.match_add ('''\<(www|ftp)[-A-Za-z0-9]*\.[-A-Za-z0-9.]+(:[0-9]+)?(/[-A-Za-z0-9_$.+!*(),;:@&=?/~#%]*[^]'.}>) \t\r\n,\"])?\>/?''') self.matches['email'] = self._vte.match_add ('''[[:<:]](mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+[[:>:]]''') + if self.matches['email'] == -1: + self.matches['email'] = self._vte.match_add ('''\<(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+\>''') self.matches['nntp'] = self._vte.match_add ('''[[:<:]]news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?[[:>:]]''') + if self.matches['nntp'] == -1: + self.matches['nntp'] = self._vte.match_add ('''\''') self.spawn_child () @@ -381,7 +390,7 @@ class TerminatorTerm: def zoom (self, zoom_in): pangodesc = self._vte.get_font () - fontsize = pangodesc.get_size () + fontsize = pangodesc.get_size () if fontsize > pango.SCALE and not zoom_in: fontsize -= pango.SCALE From 61572e55315be9e3a75ca782273fbff3e2dc547c Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 8 Apr 2008 10:08:51 +0100 Subject: [PATCH 21/58] like the fixme says, re-enable handling of systems without gconf --- terminator | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/terminator b/terminator index 7706e56d..2aede4bf 100755 --- a/terminator +++ b/terminator @@ -516,14 +516,13 @@ class Terminator: stores = [] stores.append (terminatorconfig.TerminatorConfValuestoreRC ()) -# FIXME: enable this again, we should trap and discard broken gconf stuff -# try: - import gconf - store = terminatorconfig.TerminatorConfValuestoreGConf () - store.set_reconfigure_callback (self.reconfigure_vtes) - stores.append (store) -# except: -# pass + try: + import gconf + store = terminatorconfig.TerminatorConfValuestoreGConf () + store.set_reconfigure_callback (self.reconfigure_vtes) + stores.append (store) + except: + pass self.conf = terminatorconfig.TerminatorConfig (stores) From 39bcfa8d329975a72123105a732c7c029f47ce2c Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 9 Apr 2008 08:11:51 +0100 Subject: [PATCH 22/58] Make gettext optional; if it fails to load, define our own _() method that just returns the string. --- terminator | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/terminator b/terminator index 44e7a1c2..8bd6da69 100755 --- a/terminator +++ b/terminator @@ -25,8 +25,12 @@ APP_VERSION = '0.9' import os, platform, sys, string, time, math from optparse import OptionParser -import gettext -gettext.install (APP_NAME) +try: + import gettext + gettext.install (APP_NAME) +except: + def _ (text): + return text # import unix-lib import pwd From 4bae2687096d65b6e555d0bcea97b3199b1876bc Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 9 Apr 2008 22:14:23 +0100 Subject: [PATCH 23/58] Stop keeping metadate about the defaults that we don't need. Handle booleans in RC files. Start adding support for GNOME proxy settings. --- terminatorconfig.py | 116 +++++++++++++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 39 deletions(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 3de51045..cb08d7c2 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -76,45 +76,50 @@ class TerminatorConfValuestore: reconfigure_callback = None # Our settings - # FIXME: Is it acceptable to not explicitly store the type, but - # instead infer it from defaults[key].__class__.__name__ defaults = { - 'gt_dir' : [str, '/apps/gnome-terminal'], - 'profile_dir' : [str, '/apps/gnome-terminal/profiles'], - 'titlebars' : [bool, True], - 'titletips' : [bool, False], - 'allow_bold' : [bool, False], - 'silent_bell' : [bool, True], - 'background_color' : [str, '#000000'], - 'background_darkness' : [float, 0.5], - 'background_type' : [str, 'solid'], - 'backspace_binding' : [str, 'ascii-del'], - 'delete_binding' : [str, 'delete-sequence'], - 'cursor_blink' : [bool, False], - 'emulation' : [str, 'xterm'], - 'font' : [str, 'Serif 10'], - 'foreground_color' : [str, '#AAAAAA'], - 'scrollbar_position' : [str, "right"], - 'scroll_background' : [bool, True], - 'scroll_on_keystroke' : [bool, False], - 'scroll_on_output' : [bool, False], - 'scrollback_lines' : [int, 100], - 'focus' : [str, 'sloppy'], - 'exit_action' : [str, 'close'], - 'palette' : [str, '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF'], - 'word_chars' : [str, '-A-Za-z0-9,./?%&#:_'], - 'mouse_autohide' : [bool, True], - 'update_records' : [bool, True], - 'login_shell' : [bool, False], - 'use_custom_command' : [bool, False], - 'custom_command' : [str, ''], - 'use_system_font' : [bool, True], - 'use_theme_colors' : [bool, True], + 'gt_dir' : '/apps/gnome-terminal', + 'profile_dir' : '/apps/gnome-terminal/profiles', + 'titlebars' : True, + 'titletips' : False, + 'allow_bold' : False, + 'silent_bell' : True, + 'background_color' : '#000000', + 'background_darkness' : 0.5, + 'background_type' : 'solid', + 'backspace_binding' : 'ascii-del', + 'delete_binding' : 'delete-sequence', + 'cursor_blink' : False, + 'emulation' : 'xterm', + 'font' : 'Serif 10', + 'foreground_color' : '#AAAAAA', + 'scrollbar_position' : "right", + 'scroll_background' : True, + 'scroll_on_keystroke' : False, + 'scroll_on_output' : False, + 'scrollback_lines' : 100, + 'focus' : 'sloppy', + 'exit_action' : 'close', + 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', + 'word_chars' : '-A-Za-z0-9,./?%&#:_', + 'mouse_autohide' : True, + 'update_records' : True, + 'login_shell' : False, + 'use_custom_command' : False, + 'custom_command' : '', + 'use_system_font' : True, + 'use_theme_colors' : True, + 'use_http_proxy' : False, + 'use_authentication' : False, + 'host' : '', + 'port' : 0, + 'authentication_user' : '', + 'authentication_password': '', + 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], } def __getattr__ (self, keyname): if self.values.has_key (keyname): - return self.values[keyname][1] + return self.values[keyname] else: raise (AttributeError) @@ -141,8 +146,12 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): if item and item[0] != '#': (key, value) = item.split ("=") dbg (" VS_RCFile: Setting value %s to %s"%(key, value)) - self.values[key] = [self.defaults[key][0], self.defaults[key][0](value)] + if value == 'True': + self.values[key] = True + else: + self.values[key] = False except: + dbg (" VS_RCFile: Exception handling: %s"%item) pass class TerminatorConfValuestoreGConf (TerminatorConfValuestore): @@ -157,8 +166,8 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): self.client = gconf.client_get_default () # Grab a couple of values from base class to avoid recursing with our __getattr__ - self._gt_dir = self.defaults['gt_dir'][1] - self._profile_dir = self.defaults['profile_dir'][1] + self._gt_dir = self.defaults['gt_dir'] + self._profile_dir = self.defaults['profile_dir'] if not profile: profile = self.client.get_string (self._gt_dir + '/global/default_profile') @@ -184,6 +193,8 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): self.client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notify) self.client.add_dir ('/desktop/gnome/interface', gconf.CLIENT_PRELOAD_RECURSIVE) self.client.notify_add ('/desktop/gnome/interface/monospace_font_name', self.on_gconf_notify) + self.client.add_dir ('/system/http_proxy', gconf.CLIENT_PRELOAD_RECURSIVE) + self.client.notify_add ('/system/http_proxy', self.on_gconf_notify) # FIXME: Do we need to watch more non-profile stuff here? def set_reconfigure_callback (self, function): @@ -207,14 +218,31 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = self.client.get ('/desktop/gnome/interface/monospace_font_name') elif key == 'focus': value = self.client.get ('/apps/metacity/general/focus_mode') + elif key == 'use_http_proxy': + value = self.client.get ('/system/http_proxy/use_http_proxy') + elif key == 'use_authentication': + value = self.client.get ('/system/http_proxy/use_authentication') + elif key == 'host': + value = self.client.get ('/system/http_proxy/host') + elif key == 'port': + value = self.client.get ('/system/http_proxy/port') + elif key == 'authentication_user': + value = self.client.get ('/system/http_proxy/authentication_user') + elif key == 'authentication_password': + value = self.client.get ('/system/http_proxy/authentication_password') + elif key == 'ignore_hosts': + value = self.client.get ('/system/http_proxy/ignore_hosts') else: value = self.client.get ('%s/%s'%(self.profile, key)) if value: - funcname = "get_" + self.defaults[key][0].__name__ + funcname = "get_" + self.defaults[key].__class__.__name__ # Special case for str if funcname == "get_str": funcname = "get_string" + # Special case for strlist + if funcname == "get_strlist": + funcname = "get_list" typefunc = getattr (value, funcname) ret = typefunc () @@ -251,4 +279,14 @@ if __name__ == '__main__': print foo.titletips # This should raise AttributeError - print foo.blimnle + #print foo.blimnle + + debug = False + print "use proxy: %d"%foo.use_http_proxy + print "use proxy auth: %d"%foo.use_authentication + print "proxy host: %s"%foo.host + print "proxy port: %d"%foo.port + print "proxy user: %s"%foo.authentication_user + print "proxy pass: %s"%foo.authentication_password + for host in foo.ignore_hosts: + print "proxy ignore: %s"%host From f382c073d4d00ffd5a23c7393b1c1ea89fe537eb Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 10 Apr 2008 00:22:20 +0100 Subject: [PATCH 24/58] since the gnome proxy will always be accessible by gconf and anyone else can override with , we don't need to support defaults for all of these proxy related things, and we certainly have no need of watching them in gconf. Just work the string out and do it already --- terminator | 5 ++++- terminatorconfig.py | 51 ++++++++++++++++++--------------------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/terminator b/terminator index 2aede4bf..0a107c3c 100755 --- a/terminator +++ b/terminator @@ -130,7 +130,7 @@ class TerminatorTerm: self._vte.connect ("child-exited", self.spawn_child) # We need to support "left" because some buggy versions of gnome-terminal # set it in some situations - if exit_action in ("close", "left"): + elif exit_action in ("close", "left"): self._vte.connect ("child-exited", lambda close_term: self.terminator.closeterm (self)) self._vte.add_events (gtk.gdk.ENTER_NOTIFY_MASK) @@ -152,6 +152,9 @@ class TerminatorTerm: if self.matches['nntp'] == -1: self.matches['nntp'] = self._vte.match_add ('''\''') + env_proxy = os.getenv ('http_proxy') + if not env_proxy: + os.putenv ('http_proxy', self.conf.http_proxy) self.spawn_child () def spawn_child (self, event=None): diff --git a/terminatorconfig.py b/terminatorconfig.py index cb08d7c2..aec0020d 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -108,12 +108,7 @@ class TerminatorConfValuestore: 'custom_command' : '', 'use_system_font' : True, 'use_theme_colors' : True, - 'use_http_proxy' : False, - 'use_authentication' : False, - 'host' : '', - 'port' : 0, - 'authentication_user' : '', - 'authentication_password': '', + 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], } @@ -193,8 +188,6 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): self.client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notify) self.client.add_dir ('/desktop/gnome/interface', gconf.CLIENT_PRELOAD_RECURSIVE) self.client.notify_add ('/desktop/gnome/interface/monospace_font_name', self.on_gconf_notify) - self.client.add_dir ('/system/http_proxy', gconf.CLIENT_PRELOAD_RECURSIVE) - self.client.notify_add ('/system/http_proxy', self.on_gconf_notify) # FIXME: Do we need to watch more non-profile stuff here? def set_reconfigure_callback (self, function): @@ -218,25 +211,28 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = self.client.get ('/desktop/gnome/interface/monospace_font_name') elif key == 'focus': value = self.client.get ('/apps/metacity/general/focus_mode') - elif key == 'use_http_proxy': - value = self.client.get ('/system/http_proxy/use_http_proxy') - elif key == 'use_authentication': - value = self.client.get ('/system/http_proxy/use_authentication') - elif key == 'host': - value = self.client.get ('/system/http_proxy/host') - elif key == 'port': - value = self.client.get ('/system/http_proxy/port') - elif key == 'authentication_user': - value = self.client.get ('/system/http_proxy/authentication_user') - elif key == 'authentication_password': - value = self.client.get ('/system/http_proxy/authentication_password') - elif key == 'ignore_hosts': - value = self.client.get ('/system/http_proxy/ignore_hosts') + elif key == 'http_proxy': + if self.client.get_bool ('/system/http_proxy/use_http_proxy'): + dbg ('HACK: Mangling http_proxy') + + if self.client.get_bool ('use_authentication'): + dbg ('HACK: Using proxy authentication') + value = 'http://%s:%s@%s:%s/'%( + self.client.get_string ('/system/http_proxy/authentication_user'), + self.client.get_string ('/system/http_proxy/authentication_password'), + self.client.get_string ('/system/http_proxy/host'), + self.client.get_int ('/system/http_proxy/port')) + else: + dbg ('HACK: Not using proxy authentication') + value = 'http://%s:%s/'%( + self.client.get_string ('/system/http_proxy/host'), + self.client.get_int ('/system/http_proxy/port')) else: value = self.client.get ('%s/%s'%(self.profile, key)) if value: funcname = "get_" + self.defaults[key].__class__.__name__ + dbg (' GConf: picked function: %s'%funcname) # Special case for str if funcname == "get_str": funcname = "get_string" @@ -281,12 +277,5 @@ if __name__ == '__main__': # This should raise AttributeError #print foo.blimnle - debug = False - print "use proxy: %d"%foo.use_http_proxy - print "use proxy auth: %d"%foo.use_authentication - print "proxy host: %s"%foo.host - print "proxy port: %d"%foo.port - print "proxy user: %s"%foo.authentication_user - print "proxy pass: %s"%foo.authentication_password - for host in foo.ignore_hosts: - print "proxy ignore: %s"%host + # http_proxy is a value that is allowed to not exist + print "final proxy: %s"%foo.http_proxy From ff0e32df4ddbe1696a97c6de6237e2a5d7b9d47c Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 10 Apr 2008 00:29:40 +0100 Subject: [PATCH 25/58] space --- terminator | 1 + 1 file changed, 1 insertion(+) diff --git a/terminator b/terminator index 0a107c3c..2ec600b3 100755 --- a/terminator +++ b/terminator @@ -155,6 +155,7 @@ class TerminatorTerm: env_proxy = os.getenv ('http_proxy') if not env_proxy: os.putenv ('http_proxy', self.conf.http_proxy) + self.spawn_child () def spawn_child (self, event=None): From 08212b0bac5e38e1718b88784a336020bb126faa Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Thu, 10 Apr 2008 16:17:18 +0100 Subject: [PATCH 26/58] Add terminatorconfig --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 2eccfe9a..d9b27a0d 100755 --- a/setup.py +++ b/setup.py @@ -71,6 +71,7 @@ setup(name='Terminator', ('share/icons/hicolor/24x24/apps', glob.glob('data/icons/24x24/apps/*.png')), ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ], + py_modules=['terminatorconfig'], cmdclass={'install_data': InstallData} ) From 53f83bf39afc68267d96a085565e5f61db969556 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Thu, 10 Apr 2008 17:08:53 +0100 Subject: [PATCH 27/58] Move msgfmt bits into build, so users building as normal users and installing as root don't end up with root owned crap in the directory. Simplify a bit while I'm here. --- setup.py | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/setup.py b/setup.py index d9b27a0d..09cf0664 100755 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ from distutils.core import setup from distutils.command.install_data import install_data +from distutils.command.build import build from distutils.dep_util import newer from distutils.log import info import glob @@ -17,6 +18,32 @@ def import_terminator(): APP_VERSION = import_terminator().APP_VERSION +PO_DIR = 'po' +MO_DIR = os.path.join('build', 'mo') + +class BuildData(build): + def run (self): + build.run (self) + + if sys.platform == 'win32': + return + + for po in glob.glob (os.path.join (PO_DIR, '*.po')): + lang = os.path.basename(po[:-3]) + mo = os.path.join(MO_DIR, lang + '.mo') + + directory = os.path.dirname(mo) + if not os.path.exists(directory): + info('creating %s' % directory) + os.makedirs(directory) + + if newer(po, mo): + cmd = 'msgfmt -o %s %s' % (mo, po) + info('compiling %s -> %s' % (po, mo)) + if os.system(cmd) != 0: + raise SystemExit('Error while running msgfmt') + + class InstallData(install_data): def run (self): self.data_files.extend (self._compile_po_files ()) @@ -29,25 +56,10 @@ class InstallData(install_data): if sys.platform == 'win32': return data_files - PO_DIR = 'po' - for po in glob.glob (os.path.join (PO_DIR,'*.po')): - lang = os.path.basename(po[:-3]) - mo = os.path.join('build', 'mo', lang, 'terminator.mo') - - directory = os.path.dirname(mo) - if not os.path.exists(directory): - info('creating %s' % directory) - os.makedirs(directory) - - if newer(po, mo): - # True if mo doesn't exist - cmd = 'msgfmt -o %s %s' % (mo, po) - info('compiling %s -> %s' % (po, mo)) - if os.system(cmd) != 0: - raise SystemExit('Error while running msgfmt') - - dest = os.path.dirname(os.path.join('share', 'locale', lang, 'LC_MESSAGES', 'terminator.mo')) - data_files.append((dest, [mo])) + for mo in glob.glob (os.path.join (MO_DIR, '*.mo')): + lang = os.path.basename(mo[:-3]) + dest = os.path.dirname(os.path.join('share', 'locale', lang, 'LC_MESSAGES', 'terminator.mo')) + data_files.append((dest, [mo])) return data_files @@ -72,6 +84,6 @@ setup(name='Terminator', ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ], py_modules=['terminatorconfig'], - cmdclass={'install_data': InstallData} + cmdclass={'build': BuildData, 'install_data': InstallData} ) From 296119cf791e29912d812b3fac837fe05ddd1018 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 11 Apr 2008 13:09:34 +0100 Subject: [PATCH 28/58] Add caching to gconf --- terminatorconfig.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/terminatorconfig.py b/terminatorconfig.py index aec0020d..12a3b78e 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -152,6 +152,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): class TerminatorConfValuestoreGConf (TerminatorConfValuestore): profile = "" client = None + cache = {} def __init__ (self, profile = None): self.type = "GConf" @@ -196,11 +197,17 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): return (True) def on_gconf_notify (self, client, cnxn_id, entry, what): + dbg (" VSGConf: invalidating cache") + self.cache = {} dbg (" VSGConf: gconf changed, callback is: %s"%self.reconfigure_callback) if self.reconfigure_callback: self.reconfigure_callback () def __getattr__ (self, key = ""): + if self.cache.has_key (key): + dbg (" VSGConf: returning cached value: %s"%self.cache[key]) + return (self.cache[key]) + ret = None value = None @@ -242,6 +249,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): typefunc = getattr (value, funcname) ret = typefunc () + self.cache[key] = ret return (ret) else: raise (AttributeError) From 64062536ce10dcf70ca96d1b25c7330388941269 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 11 Apr 2008 14:56:54 +0100 Subject: [PATCH 29/58] try not to parse most rc settings as False --- terminatorconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 12a3b78e..8f8632de 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -143,7 +143,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): dbg (" VS_RCFile: Setting value %s to %s"%(key, value)) if value == 'True': self.values[key] = True - else: + elif value == 'False': self.values[key] = False except: dbg (" VS_RCFile: Exception handling: %s"%item) From 488099c948c8649e8ebd522189f4abeba01b6e2e Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 16 Apr 2008 21:43:25 +0100 Subject: [PATCH 30/58] Add WITHOUT_NLS support. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 09cf0664..a611dd46 100755 --- a/setup.py +++ b/setup.py @@ -20,12 +20,13 @@ APP_VERSION = import_terminator().APP_VERSION PO_DIR = 'po' MO_DIR = os.path.join('build', 'mo') +WITHOUT_NLS = sys.platform == 'win32' or os.environ.has_key("WITHOUT_NLS") class BuildData(build): def run (self): build.run (self) - if sys.platform == 'win32': + if WITHOUT_NLS: return for po in glob.glob (os.path.join (PO_DIR, '*.po')): @@ -53,7 +54,7 @@ class InstallData(install_data): data_files = [] # Don't install language files on win32 - if sys.platform == 'win32': + if WITHOUT_NLS: return data_files for mo in glob.glob (os.path.join (MO_DIR, '*.mo')): From 484b403cadcc9c021f7fd0e9e0b4e6464ee53426 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 16 Apr 2008 21:51:14 +0100 Subject: [PATCH 31/58] Use os.expanduser and os.path.join instead of getuid, getpwuid and + --- terminatorconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 8f8632de..e056c952 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -129,7 +129,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): # that can be re-used when rc changes. def __init__ (self): self.type = "RCFile" - self.rcfilename = pwd.getpwuid (os.getuid ())[5] + "/.terminatorrc" + self.rcfilename = os.path.join(os.path.expanduser("~"), ".terminatorrc") if os.path.exists (self.rcfilename): rcfile = open (self.rcfilename) rc = rcfile.readlines () From 4b7b1f37e4a060bc79ba941c43335fab52c62f23 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Sat, 10 May 2008 13:08:20 +0100 Subject: [PATCH 32/58] Fix redundant title when there is only one TerminatorTerm * closes LP#215210 https://bugs.launchpad.net/terminator/+bug/215210 --- terminator | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/terminator b/terminator index 93d6661c..2f5034cc 100755 --- a/terminator +++ b/terminator @@ -103,7 +103,9 @@ class TerminatorTerm: self._box.show() self._box.pack_start(self._titlebox, False) self._box.pack_start(self._termbox) - if self.conf.titlebars: + if len(self.terminator.term_list) > 0 and self.conf.titlebars: + if len(self.terminator.term_list) == 1: + self.terminator.term_list[0]._titlebox.show() self._titlebox.show() else: self._titlebox.hide() @@ -526,7 +528,7 @@ class Terminator: self.command = command self._fullscreen = False - + self.term_list = [] stores = [] stores.append (terminatorconfig.TerminatorConfValuestoreRC ()) @@ -745,6 +747,8 @@ class Terminator: else: if index == 0: index = 1 self.term_list[index - 1]._vte.grab_focus () + if len(self.term_list) == 1: + self.term_list[0]._titlebox.hide() return From f888b0533dd805f3f036a6cf622a3eae42532b31 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 15 May 2008 00:44:05 +0100 Subject: [PATCH 33/58] fix fullscreen --- terminator | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminator b/terminator index 2f5034cc..9ef10f34 100755 --- a/terminator +++ b/terminator @@ -586,7 +586,7 @@ class Terminator: """ Maximize the Terminator window.""" self.window.maximize () - def toggle_fullscreen (self): + def fullscreen_toggle (self): """ Toggle the fullscreen state of the window. If it is in fullscreen state, it will be unfullscreened. If it is not, it will be set to fullscreen state. @@ -646,7 +646,7 @@ class Terminator: mask = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK if (keyname == 'F11'): - self.toggle_fullscreen () + self.fullscreen_toggle () return (True) if (event.state & mask) == mask: From 24278a3be06a2870140116a5c422e08a9e5e169b Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 07:41:00 +0100 Subject: [PATCH 34/58] starting with encoding --- TODO | 4 ++++ terminator | 37 ++++++++++++++++++++++++++++++++++--- terminatorconfig.py | 8 +++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 3e66cca9..2ef0b4e7 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,6 @@ * Edit doc/terminatorrc.5 manpage to contain the information about the options * Write a Tab feature for terminator + +* handling encoding +print self._vte.get_encoding () +actually defaults to UTF-8 diff --git a/terminator b/terminator index 2f5034cc..932e32f7 100755 --- a/terminator +++ b/terminator @@ -103,6 +103,7 @@ class TerminatorTerm: self._box.show() self._box.pack_start(self._titlebox, False) self._box.pack_start(self._termbox) + if len(self.terminator.term_list) > 0 and self.conf.titlebars: if len(self.terminator.term_list) == 1: self.terminator.term_list[0]._titlebox.show() @@ -310,7 +311,13 @@ class TerminatorTerm: # Set our sloppiness self.focus = self.conf.focus - + + def on_encoding_change (self, widget, encoding): + current = self._vte.get_encoding() + if current != encoding: + print ('Setting Encoding to ' + encoding) + self._vte.set_encoding(encoding) + def on_composited_changed (self, widget): self.reconfigure_vte () @@ -487,16 +494,40 @@ class TerminatorTerm: item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True)) menu.append (item) + self._do_encoding_items(menu) + item = gtk.MenuItem () menu.append (item) - + item = gtk.ImageMenuItem (gtk.STOCK_CLOSE) item.connect ("activate", lambda menu_item: self.terminator.closeterm (self)) menu.append (item) menu.show_all () return menu - + + def _do_encoding_items(self, menu): + + + item = gtk.MenuItem (_("Encoding")) + menu.append(item) + submenu = gtk.Menu() + item.set_submenu(submenu) + + + current_encoding = self._vte.get_encoding () + group = None + for encoding in self.conf.active_encodings: + radioitem = gtk.RadioMenuItem(group, _(encoding)) + if group is None: + group = radioitem + + if encoding == current_encoding: + radioitem.set_active(True) + + radioitem.connect('activate', self.on_encoding_change, encoding) + submenu.append(radioitem) + def on_vte_title_change(self, vte): if self.conf.titletips: vte.set_property ("has-tooltip", True) diff --git a/terminatorconfig.py b/terminatorconfig.py index e056c952..337b7ed2 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -110,6 +110,8 @@ class TerminatorConfValuestore: 'use_theme_colors' : True, 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], + 'encoding' : 'UTF-8', + 'active_encodings' : ['UTF-8', 'ISO-8859-1'], } def __getattr__ (self, keyname): @@ -212,7 +214,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = None dbg (' VSGConf: preparing: %s/%s'%(self.profile, key)) - + # FIXME: Ugly special cases we should look to fix in some other way. if key == 'font' and self.use_system_font: value = self.client.get ('/desktop/gnome/interface/monospace_font_name') @@ -234,8 +236,12 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = 'http://%s:%s/'%( self.client.get_string ('/system/http_proxy/host'), self.client.get_int ('/system/http_proxy/port')) + elif key == 'active_encodings': + value = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string') else: value = self.client.get ('%s/%s'%(self.profile, key)) + + if value: funcname = "get_" + self.defaults[key].__class__.__name__ From 476e88934506e01542e2d19b09d5e9858e43bc2d Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 17:03:57 +0100 Subject: [PATCH 35/58] Added a specific config rule for active_encodings --- terminatorconfig.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index 337b7ed2..f7a8f82d 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -111,7 +111,7 @@ class TerminatorConfValuestore: 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'encoding' : 'UTF-8', - 'active_encodings' : ['UTF-8', 'ISO-8859-1'], + 'active_encodings' : ['UTF-8', 'ISO-8859-1', 'UTF-16'], } def __getattr__ (self, keyname): @@ -171,6 +171,10 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): profile = self.client.get_string (self._gt_dir + '/global/default_profile') profiles = self.client.get_list (self._gt_dir + '/global/profile_list','string') + #set up the active encoding list + self.active_encodings = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string') + + #need to handle the list of Gconf.value if profile in profiles: dbg (" VSGConf: Found profile '%s' in profile_list"%profile) self.profile = '%s/%s'%(self._profile_dir, profile) @@ -236,8 +240,6 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = 'http://%s:%s/'%( self.client.get_string ('/system/http_proxy/host'), self.client.get_int ('/system/http_proxy/port')) - elif key == 'active_encodings': - value = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string') else: value = self.client.get ('%s/%s'%(self.profile, key)) From 54d7b5d6690b2a472adafdf50a7894d8a2fdabc7 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 17:19:20 +0100 Subject: [PATCH 36/58] removing testing utf-16 value from default --- terminatorconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorconfig.py b/terminatorconfig.py index f7a8f82d..d5679dc2 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -111,7 +111,7 @@ class TerminatorConfValuestore: 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'encoding' : 'UTF-8', - 'active_encodings' : ['UTF-8', 'ISO-8859-1', 'UTF-16'], + 'active_encodings' : ['UTF-8', 'ISO-8859-1'], } def __getattr__ (self, keyname): From 5001490021cc917719646d2c11758904444bc6f7 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 19:02:09 +0100 Subject: [PATCH 37/58] Adding *full* encoding support taken from gnome-terminal's src/encoding.[ch] --- terminator | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 198 insertions(+), 8 deletions(-) diff --git a/terminator b/terminator index 0112051d..894b4f26 100755 --- a/terminator +++ b/terminator @@ -72,6 +72,164 @@ def openurl (url): except: pass +class Encoding: + TERMINAL_ENCODING_CURRENT_LOCALE,\ + TERMINAL_ENCODING_ISO_8859_1,\ + TERMINAL_ENCODING_ISO_8859_2,\ + TERMINAL_ENCODING_ISO_8859_3,\ + TERMINAL_ENCODING_ISO_8859_4,\ + TERMINAL_ENCODING_ISO_8859_5,\ + TERMINAL_ENCODING_ISO_8859_6,\ + TERMINAL_ENCODING_ISO_8859_7,\ + TERMINAL_ENCODING_ISO_8859_8,\ + TERMINAL_ENCODING_ISO_8859_8_I,\ + TERMINAL_ENCODING_ISO_8859_9,\ + TERMINAL_ENCODING_ISO_8859_10,\ + TERMINAL_ENCODING_ISO_8859_13,\ + TERMINAL_ENCODING_ISO_8859_14,\ + TERMINAL_ENCODING_ISO_8859_15,\ + TERMINAL_ENCODING_ISO_8859_16,\ + TERMINAL_ENCODING_UTF_7,\ + TERMINAL_ENCODING_UTF_8,\ + TERMINAL_ENCODING_UTF_16,\ + TERMINAL_ENCODING_UCS_2,\ + TERMINAL_ENCODING_UCS_4,\ + TERMINAL_ENCODING_ARMSCII_8,\ + TERMINAL_ENCODING_BIG5,\ + TERMINAL_ENCODING_BIG5_HKSCS,\ + TERMINAL_ENCODING_CP_866,\ + TERMINAL_ENCODING_EUC_JP,\ + TERMINAL_ENCODING_EUC_KR,\ + TERMINAL_ENCODING_EUC_TW,\ + TERMINAL_ENCODING_GB18030,\ + TERMINAL_ENCODING_GB2312,\ + TERMINAL_ENCODING_GBK,\ + TERMINAL_ENCODING_GEOSTD8,\ + TERMINAL_ENCODING_HZ,\ + TERMINAL_ENCODING_IBM_850,\ + TERMINAL_ENCODING_IBM_852,\ + TERMINAL_ENCODING_IBM_855,\ + TERMINAL_ENCODING_IBM_857,\ + TERMINAL_ENCODING_IBM_862,\ + TERMINAL_ENCODING_IBM_864,\ + TERMINAL_ENCODING_ISO_2022_JP,\ + TERMINAL_ENCODING_ISO_2022_KR,\ + TERMINAL_ENCODING_ISO_IR_111,\ + TERMINAL_ENCODING_JOHAB,\ + TERMINAL_ENCODING_KOI8_R,\ + TERMINAL_ENCODING_KOI8_U,\ + TERMINAL_ENCODING_MAC_ARABIC,\ + TERMINAL_ENCODING_MAC_CE,\ + TERMINAL_ENCODING_MAC_CROATIAN,\ + TERMINAL_ENCODING_MAC_CYRILLIC,\ + TERMINAL_ENCODING_MAC_DEVANAGARI,\ + TERMINAL_ENCODING_MAC_FARSI,\ + TERMINAL_ENCODING_MAC_GREEK,\ + TERMINAL_ENCODING_MAC_GUJARATI,\ + TERMINAL_ENCODING_MAC_GURMUKHI,\ + TERMINAL_ENCODING_MAC_HEBREW,\ + TERMINAL_ENCODING_MAC_ICELANDIC,\ + TERMINAL_ENCODING_MAC_ROMAN,\ + TERMINAL_ENCODING_MAC_ROMANIAN,\ + TERMINAL_ENCODING_MAC_TURKISH,\ + TERMINAL_ENCODING_MAC_UKRAINIAN,\ + TERMINAL_ENCODING_SHIFT_JIS,\ + TERMINAL_ENCODING_TCVN,\ + TERMINAL_ENCODING_TIS_620,\ + TERMINAL_ENCODING_UHC,\ + TERMINAL_ENCODING_VISCII,\ + TERMINAL_ENCODING_WINDOWS_1250,\ + TERMINAL_ENCODING_WINDOWS_1251,\ + TERMINAL_ENCODING_WINDOWS_1252,\ + TERMINAL_ENCODING_WINDOWS_1253,\ + TERMINAL_ENCODING_WINDOWS_1254,\ + TERMINAL_ENCODING_WINDOWS_1255,\ + TERMINAL_ENCODING_WINDOWS_1256,\ + TERMINAL_ENCODING_WINDOWS_1257,\ + TERMINAL_ENCODING_WINDOWS_1258,\ + TERMINAL_ENCODING_LAST = range(75) + + encodings = [ + [True, None, _("Current Locale")], + [False, "ISO-8859-1", _("Western")], + [False, "ISO-8859-2", _("Central European")], + [ False, "ISO-8859-3", _("South European") ], + [False, "ISO-8859-4", _("Baltic") ], + [False,"ISO-8859-5", _("Cyrillic") ], + [False, "ISO-8859-6", _("Arabic") ], + [False, "ISO-8859-7", _("Greek") ], + [False, "ISO-8859-8", _("Hebrew Visual") ], + [False, "ISO-8859-8-I", _("Hebrew") ], + [False, "ISO-8859-9", _("Turkish") ], + [False, "ISO-8859-10", _("Nordic") ], + [False, "ISO-8859-13", _("Baltic") ], + [False, "ISO-8859-14", _("Celtic") ], + [False, "ISO-8859-15", _("Western") ], + [False, "ISO-8859-16", _("Romanian") ], + [False, "UTF-7", _("Unicode") ], + [False, "UTF-8", _("Unicode") ], + [False, "UTF-16", _("Unicode") ], + [False, "UCS-2", _("Unicode") ], + [False, "UCS-4", _("Unicode") ], + [False, "ARMSCII-8", _("Armenian") ], + [False, "BIG5", _("Chinese Traditional") ], + [False, "BIG5-HKSCS", _("Chinese Traditional") ], + [False, "CP866", _("Cyrillic/Russian") ], + [False, "EUC-JP", _("Japanese") ], + [False, "EUC-KR", _("Korean") ], + [False, "EUC-TW", _("Chinese Traditional") ], + [False, "GB18030", _("Chinese Simplified") ], + [False, "GB2312", _("Chinese Simplified") ], + [False, "GBK", _("Chinese Simplified") ], + [False, "GEORGIAN-PS", _("Georgian") ], + [False, "HZ", _("Chinese Simplified") ], + [False, "IBM850", _("Western") ], + [False, "IBM852", _("Central European") ], + [False, "IBM855", _("Cyrillic") ], + [False, "IBM857", _("Turkish") ], + [False, "IBM862", _("Hebrew") ], + [False, "IBM864", _("Arabic") ], + [False, "ISO2022JP", _("Japanese") ], + [False, "ISO2022KR", _("Korean") ], + [False, "ISO-IR-111", _("Cyrillic") ], + [False, "JOHAB", _("Korean") ], + [False, "KOI8-R", _("Cyrillic") ], + [False, "KOI8-U", _("Cyrillic/Ukrainian") ], + [False, "MAC_ARABIC", _("Arabic") ], + [False, "MAC_CE", _("Central European") ], + [False, "MAC_CROATIAN", _("Croatian") ], + [False, "MAC-CYRILLIC", _("Cyrillic") ], + [False, "MAC_DEVANAGARI", _("Hindi") ], + [False, "MAC_FARSI", _("Persian") ], + [False, "MAC_GREEK", _("Greek") ], + [False, "MAC_GUJARATI", _("Gujarati") ], + [False, "MAC_GURMUKHI", _("Gurmukhi") ], + [False, "MAC_HEBREW", _("Hebrew") ], + [False, "MAC_ICELANDIC", _("Icelandic") ], + [False, "MAC_ROMAN", _("Western") ], + [False, "MAC_ROMANIAN", _("Romanian") ], + [False, "MAC_TURKISH", _("Turkish") ], + [False, "MAC_UKRAINIAN", _("Cyrillic/Ukrainian") ], + [False, "SHIFT-JIS", _("Japanese") ], + [False, "TCVN", _("Vietnamese") ], + [False, "TIS-620", _("Thai") ], + [False, "UHC", _("Korean") ], + [False, "VISCII", _("Vietnamese") ], + [False, "WINDOWS-1250", _("Central European") ], + [False, "WINDOWS-1251", _("Cyrillic") ], + [False, "WINDOWS-1252", _("Western") ], + [False, "WINDOWS-1253", _("Greek") ], + [False, "WINDOWS-1254", _("Turkish") ], + [False, "WINDOWS-1255", _("Hebrew") ], + [False, "WINDOWS-1256", _("Arabic") ], + [False, "WINDOWS-1257", _("Baltic") ], + [False, "WINDOWS-1258", _("Vietnamese") ] + ] + + def get_list(): + return Encoding.encodings + get_list = staticmethod(get_list) + class TerminatorTerm: matches = {} @@ -312,12 +470,6 @@ class TerminatorTerm: # Set our sloppiness self.focus = self.conf.focus - def on_encoding_change (self, widget, encoding): - current = self._vte.get_encoding() - if current != encoding: - print ('Setting Encoding to ' + encoding) - self._vte.set_encoding(encoding) - def on_composited_changed (self, widget): self.reconfigure_vte () @@ -505,11 +657,18 @@ class TerminatorTerm: menu.show_all () return menu - + + + def on_encoding_change (self, widget, encoding): + current = self._vte.get_encoding() + if current != encoding: + print ('Setting Encoding to ' + encoding) + self._vte.set_encoding(encoding) + def _do_encoding_items(self, menu): - item = gtk.MenuItem (_("Encoding")) + item = gtk.MenuItem (_("Encodings")) menu.append(item) submenu = gtk.Menu() item.set_submenu(submenu) @@ -527,6 +686,37 @@ class TerminatorTerm: radioitem.connect('activate', self.on_encoding_change, encoding) submenu.append(radioitem) + + item = gtk.MenuItem (_("Other Encodings")) + submenu.append(item) + #second level + + submenu = gtk.Menu() + item.set_submenu(submenu) + encodings = Encoding().get_list() + encodings.sort(lambda x, y: cmp(x[2].lower(), y[2].lower())) + group = None + for encoding in encodings: + if encoding[1] in self.conf.active_encodings: + #already in active_encodings + continue + label = "" + if encoding[1] is None: + label = encoding[2]+" "+self._vte.get_encoding() + else: + label = encoding[2]+" "+encoding[1] + + radioitem = gtk.RadioMenuItem(group, label) + if group is None: + group = radioitem + + if encoding[1] == current_encoding: + radioitem.set_active(True) + + radioitem.connect('activate', self.on_encoding_change, encoding[1]) + submenu.append(radioitem) + + def on_vte_title_change(self, vte): if self.conf.titletips: From abdb18163f5026e6eb85a195257c604ca0419794 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 19:12:06 +0100 Subject: [PATCH 38/58] removed *to be useless* enum --- terminator | 77 +----------------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/terminator b/terminator index 894b4f26..c1b9579e 100755 --- a/terminator +++ b/terminator @@ -73,87 +73,12 @@ def openurl (url): pass class Encoding: - TERMINAL_ENCODING_CURRENT_LOCALE,\ - TERMINAL_ENCODING_ISO_8859_1,\ - TERMINAL_ENCODING_ISO_8859_2,\ - TERMINAL_ENCODING_ISO_8859_3,\ - TERMINAL_ENCODING_ISO_8859_4,\ - TERMINAL_ENCODING_ISO_8859_5,\ - TERMINAL_ENCODING_ISO_8859_6,\ - TERMINAL_ENCODING_ISO_8859_7,\ - TERMINAL_ENCODING_ISO_8859_8,\ - TERMINAL_ENCODING_ISO_8859_8_I,\ - TERMINAL_ENCODING_ISO_8859_9,\ - TERMINAL_ENCODING_ISO_8859_10,\ - TERMINAL_ENCODING_ISO_8859_13,\ - TERMINAL_ENCODING_ISO_8859_14,\ - TERMINAL_ENCODING_ISO_8859_15,\ - TERMINAL_ENCODING_ISO_8859_16,\ - TERMINAL_ENCODING_UTF_7,\ - TERMINAL_ENCODING_UTF_8,\ - TERMINAL_ENCODING_UTF_16,\ - TERMINAL_ENCODING_UCS_2,\ - TERMINAL_ENCODING_UCS_4,\ - TERMINAL_ENCODING_ARMSCII_8,\ - TERMINAL_ENCODING_BIG5,\ - TERMINAL_ENCODING_BIG5_HKSCS,\ - TERMINAL_ENCODING_CP_866,\ - TERMINAL_ENCODING_EUC_JP,\ - TERMINAL_ENCODING_EUC_KR,\ - TERMINAL_ENCODING_EUC_TW,\ - TERMINAL_ENCODING_GB18030,\ - TERMINAL_ENCODING_GB2312,\ - TERMINAL_ENCODING_GBK,\ - TERMINAL_ENCODING_GEOSTD8,\ - TERMINAL_ENCODING_HZ,\ - TERMINAL_ENCODING_IBM_850,\ - TERMINAL_ENCODING_IBM_852,\ - TERMINAL_ENCODING_IBM_855,\ - TERMINAL_ENCODING_IBM_857,\ - TERMINAL_ENCODING_IBM_862,\ - TERMINAL_ENCODING_IBM_864,\ - TERMINAL_ENCODING_ISO_2022_JP,\ - TERMINAL_ENCODING_ISO_2022_KR,\ - TERMINAL_ENCODING_ISO_IR_111,\ - TERMINAL_ENCODING_JOHAB,\ - TERMINAL_ENCODING_KOI8_R,\ - TERMINAL_ENCODING_KOI8_U,\ - TERMINAL_ENCODING_MAC_ARABIC,\ - TERMINAL_ENCODING_MAC_CE,\ - TERMINAL_ENCODING_MAC_CROATIAN,\ - TERMINAL_ENCODING_MAC_CYRILLIC,\ - TERMINAL_ENCODING_MAC_DEVANAGARI,\ - TERMINAL_ENCODING_MAC_FARSI,\ - TERMINAL_ENCODING_MAC_GREEK,\ - TERMINAL_ENCODING_MAC_GUJARATI,\ - TERMINAL_ENCODING_MAC_GURMUKHI,\ - TERMINAL_ENCODING_MAC_HEBREW,\ - TERMINAL_ENCODING_MAC_ICELANDIC,\ - TERMINAL_ENCODING_MAC_ROMAN,\ - TERMINAL_ENCODING_MAC_ROMANIAN,\ - TERMINAL_ENCODING_MAC_TURKISH,\ - TERMINAL_ENCODING_MAC_UKRAINIAN,\ - TERMINAL_ENCODING_SHIFT_JIS,\ - TERMINAL_ENCODING_TCVN,\ - TERMINAL_ENCODING_TIS_620,\ - TERMINAL_ENCODING_UHC,\ - TERMINAL_ENCODING_VISCII,\ - TERMINAL_ENCODING_WINDOWS_1250,\ - TERMINAL_ENCODING_WINDOWS_1251,\ - TERMINAL_ENCODING_WINDOWS_1252,\ - TERMINAL_ENCODING_WINDOWS_1253,\ - TERMINAL_ENCODING_WINDOWS_1254,\ - TERMINAL_ENCODING_WINDOWS_1255,\ - TERMINAL_ENCODING_WINDOWS_1256,\ - TERMINAL_ENCODING_WINDOWS_1257,\ - TERMINAL_ENCODING_WINDOWS_1258,\ - TERMINAL_ENCODING_LAST = range(75) encodings = [ [True, None, _("Current Locale")], [False, "ISO-8859-1", _("Western")], [False, "ISO-8859-2", _("Central European")], - [ False, "ISO-8859-3", _("South European") ], + [False, "ISO-8859-3", _("South European") ], [False, "ISO-8859-4", _("Baltic") ], [False,"ISO-8859-5", _("Cyrillic") ], [False, "ISO-8859-6", _("Arabic") ], From b3e45b8646975086c88852e9d9ed20968a804e53 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Thu, 15 May 2008 22:12:03 +0100 Subject: [PATCH 39/58] moved encoding into its own file : terminatorencoding.py added terminatorencoding.py into setup's pymodule --- setup.py | 1 + terminator | 87 ++-------------------------------- terminatorencoding.py | 108 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 83 deletions(-) create mode 100644 terminatorencoding.py diff --git a/setup.py b/setup.py index a611dd46..94790290 100755 --- a/setup.py +++ b/setup.py @@ -85,6 +85,7 @@ setup(name='Terminator', ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ], py_modules=['terminatorconfig'], + py_modules=['terminatorencoding'], cmdclass={'build': BuildData, 'install_data': InstallData} ) diff --git a/terminator b/terminator index c1b9579e..dc2528fb 100755 --- a/terminator +++ b/terminator @@ -38,6 +38,9 @@ import pwd # import our configuration loader import terminatorconfig +#import encoding list +from terminatorencoding import TerminatorEncoding + # import gtk libs # check just in case anyone runs it on a non-gnome system. try: @@ -72,89 +75,7 @@ def openurl (url): except: pass -class Encoding: - - encodings = [ - [True, None, _("Current Locale")], - [False, "ISO-8859-1", _("Western")], - [False, "ISO-8859-2", _("Central European")], - [False, "ISO-8859-3", _("South European") ], - [False, "ISO-8859-4", _("Baltic") ], - [False,"ISO-8859-5", _("Cyrillic") ], - [False, "ISO-8859-6", _("Arabic") ], - [False, "ISO-8859-7", _("Greek") ], - [False, "ISO-8859-8", _("Hebrew Visual") ], - [False, "ISO-8859-8-I", _("Hebrew") ], - [False, "ISO-8859-9", _("Turkish") ], - [False, "ISO-8859-10", _("Nordic") ], - [False, "ISO-8859-13", _("Baltic") ], - [False, "ISO-8859-14", _("Celtic") ], - [False, "ISO-8859-15", _("Western") ], - [False, "ISO-8859-16", _("Romanian") ], - [False, "UTF-7", _("Unicode") ], - [False, "UTF-8", _("Unicode") ], - [False, "UTF-16", _("Unicode") ], - [False, "UCS-2", _("Unicode") ], - [False, "UCS-4", _("Unicode") ], - [False, "ARMSCII-8", _("Armenian") ], - [False, "BIG5", _("Chinese Traditional") ], - [False, "BIG5-HKSCS", _("Chinese Traditional") ], - [False, "CP866", _("Cyrillic/Russian") ], - [False, "EUC-JP", _("Japanese") ], - [False, "EUC-KR", _("Korean") ], - [False, "EUC-TW", _("Chinese Traditional") ], - [False, "GB18030", _("Chinese Simplified") ], - [False, "GB2312", _("Chinese Simplified") ], - [False, "GBK", _("Chinese Simplified") ], - [False, "GEORGIAN-PS", _("Georgian") ], - [False, "HZ", _("Chinese Simplified") ], - [False, "IBM850", _("Western") ], - [False, "IBM852", _("Central European") ], - [False, "IBM855", _("Cyrillic") ], - [False, "IBM857", _("Turkish") ], - [False, "IBM862", _("Hebrew") ], - [False, "IBM864", _("Arabic") ], - [False, "ISO2022JP", _("Japanese") ], - [False, "ISO2022KR", _("Korean") ], - [False, "ISO-IR-111", _("Cyrillic") ], - [False, "JOHAB", _("Korean") ], - [False, "KOI8-R", _("Cyrillic") ], - [False, "KOI8-U", _("Cyrillic/Ukrainian") ], - [False, "MAC_ARABIC", _("Arabic") ], - [False, "MAC_CE", _("Central European") ], - [False, "MAC_CROATIAN", _("Croatian") ], - [False, "MAC-CYRILLIC", _("Cyrillic") ], - [False, "MAC_DEVANAGARI", _("Hindi") ], - [False, "MAC_FARSI", _("Persian") ], - [False, "MAC_GREEK", _("Greek") ], - [False, "MAC_GUJARATI", _("Gujarati") ], - [False, "MAC_GURMUKHI", _("Gurmukhi") ], - [False, "MAC_HEBREW", _("Hebrew") ], - [False, "MAC_ICELANDIC", _("Icelandic") ], - [False, "MAC_ROMAN", _("Western") ], - [False, "MAC_ROMANIAN", _("Romanian") ], - [False, "MAC_TURKISH", _("Turkish") ], - [False, "MAC_UKRAINIAN", _("Cyrillic/Ukrainian") ], - [False, "SHIFT-JIS", _("Japanese") ], - [False, "TCVN", _("Vietnamese") ], - [False, "TIS-620", _("Thai") ], - [False, "UHC", _("Korean") ], - [False, "VISCII", _("Vietnamese") ], - [False, "WINDOWS-1250", _("Central European") ], - [False, "WINDOWS-1251", _("Cyrillic") ], - [False, "WINDOWS-1252", _("Western") ], - [False, "WINDOWS-1253", _("Greek") ], - [False, "WINDOWS-1254", _("Turkish") ], - [False, "WINDOWS-1255", _("Hebrew") ], - [False, "WINDOWS-1256", _("Arabic") ], - [False, "WINDOWS-1257", _("Baltic") ], - [False, "WINDOWS-1258", _("Vietnamese") ] - ] - def get_list(): - return Encoding.encodings - get_list = staticmethod(get_list) - class TerminatorTerm: matches = {} @@ -618,7 +539,7 @@ class TerminatorTerm: submenu = gtk.Menu() item.set_submenu(submenu) - encodings = Encoding().get_list() + encodings = TerminatorEncoding().get_list() encodings.sort(lambda x, y: cmp(x[2].lower(), y[2].lower())) group = None for encoding in encodings: diff --git a/terminatorencoding.py b/terminatorencoding.py new file mode 100644 index 00000000..5851b6be --- /dev/null +++ b/terminatorencoding.py @@ -0,0 +1,108 @@ +#!/usr/bin/python +# TerminatorEncoding - charset encoding classes +# Copyright (C) 2006-2008 chantra@debuntu.org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 2 only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +"""TerminatorEncoding by Emmanuel Bretelle + +TerminatorEncoding supplies a list of possible encoding + values. +This list is taken from gnome-terminal's src/encoding.h + and src/encoding.c +""" + +class TerminatorEncoding: + + encodings = [ + [True, None, _("Current Locale")], + [False, "ISO-8859-1", _("Western")], + [False, "ISO-8859-2", _("Central European")], + [False, "ISO-8859-3", _("South European") ], + [False, "ISO-8859-4", _("Baltic") ], + [False,"ISO-8859-5", _("Cyrillic") ], + [False, "ISO-8859-6", _("Arabic") ], + [False, "ISO-8859-7", _("Greek") ], + [False, "ISO-8859-8", _("Hebrew Visual") ], + [False, "ISO-8859-8-I", _("Hebrew") ], + [False, "ISO-8859-9", _("Turkish") ], + [False, "ISO-8859-10", _("Nordic") ], + [False, "ISO-8859-13", _("Baltic") ], + [False, "ISO-8859-14", _("Celtic") ], + [False, "ISO-8859-15", _("Western") ], + [False, "ISO-8859-16", _("Romanian") ], + [False, "UTF-7", _("Unicode") ], + [False, "UTF-8", _("Unicode") ], + [False, "UTF-16", _("Unicode") ], + [False, "UCS-2", _("Unicode") ], + [False, "UCS-4", _("Unicode") ], + [False, "ARMSCII-8", _("Armenian") ], + [False, "BIG5", _("Chinese Traditional") ], + [False, "BIG5-HKSCS", _("Chinese Traditional") ], + [False, "CP866", _("Cyrillic/Russian") ], + [False, "EUC-JP", _("Japanese") ], + [False, "EUC-KR", _("Korean") ], + [False, "EUC-TW", _("Chinese Traditional") ], + [False, "GB18030", _("Chinese Simplified") ], + [False, "GB2312", _("Chinese Simplified") ], + [False, "GBK", _("Chinese Simplified") ], + [False, "GEORGIAN-PS", _("Georgian") ], + [False, "HZ", _("Chinese Simplified") ], + [False, "IBM850", _("Western") ], + [False, "IBM852", _("Central European") ], + [False, "IBM855", _("Cyrillic") ], + [False, "IBM857", _("Turkish") ], + [False, "IBM862", _("Hebrew") ], + [False, "IBM864", _("Arabic") ], + [False, "ISO2022JP", _("Japanese") ], + [False, "ISO2022KR", _("Korean") ], + [False, "ISO-IR-111", _("Cyrillic") ], + [False, "JOHAB", _("Korean") ], + [False, "KOI8-R", _("Cyrillic") ], + [False, "KOI8-U", _("Cyrillic/Ukrainian") ], + [False, "MAC_ARABIC", _("Arabic") ], + [False, "MAC_CE", _("Central European") ], + [False, "MAC_CROATIAN", _("Croatian") ], + [False, "MAC-CYRILLIC", _("Cyrillic") ], + [False, "MAC_DEVANAGARI", _("Hindi") ], + [False, "MAC_FARSI", _("Persian") ], + [False, "MAC_GREEK", _("Greek") ], + [False, "MAC_GUJARATI", _("Gujarati") ], + [False, "MAC_GURMUKHI", _("Gurmukhi") ], + [False, "MAC_HEBREW", _("Hebrew") ], + [False, "MAC_ICELANDIC", _("Icelandic") ], + [False, "MAC_ROMAN", _("Western") ], + [False, "MAC_ROMANIAN", _("Romanian") ], + [False, "MAC_TURKISH", _("Turkish") ], + [False, "MAC_UKRAINIAN", _("Cyrillic/Ukrainian") ], + [False, "SHIFT-JIS", _("Japanese") ], + [False, "TCVN", _("Vietnamese") ], + [False, "TIS-620", _("Thai") ], + [False, "UHC", _("Korean") ], + [False, "VISCII", _("Vietnamese") ], + [False, "WINDOWS-1250", _("Central European") ], + [False, "WINDOWS-1251", _("Cyrillic") ], + [False, "WINDOWS-1252", _("Western") ], + [False, "WINDOWS-1253", _("Greek") ], + [False, "WINDOWS-1254", _("Turkish") ], + [False, "WINDOWS-1255", _("Hebrew") ], + [False, "WINDOWS-1256", _("Arabic") ], + [False, "WINDOWS-1257", _("Baltic") ], + [False, "WINDOWS-1258", _("Vietnamese") ] + ] + + def get_list(): + return TerminatorEncoding.encodings + get_list = staticmethod(get_list) + \ No newline at end of file From ada09ea57005a33fc8c4bcbf5d7b2e2af139aced Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 15 May 2008 22:16:28 +0100 Subject: [PATCH 40/58] Do the very best we can to find a useful shell, then fail if we can't --- terminator | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/terminator b/terminator index 9ef10f34..0840cd77 100755 --- a/terminator +++ b/terminator @@ -173,6 +173,8 @@ class TerminatorTerm: def spawn_child (self, event=None): update_records = self.conf.update_records login = self.conf.login_shell + args = [] + shell = '' if self.command: args = self.command @@ -180,9 +182,30 @@ class TerminatorTerm: elif self.conf.use_custom_command: args = self.conf.custom_command.split () shell = args[0] - else: - shell = pwd.getpwuid (os.getuid ())[6] - args = [os.path.basename (shell)] + + if not os.path.exists (shell): + shell = os.getenv ('SHELL') or '' + if not os.path.exists (shell): + shell = pwd.getpwuid (os.getuid ())[6] or '' + if not os.path.exists (shell): + for i in ['bash','zsh','tcsh','ksh','csh','sh']: + shell = '/usr/bin/%s'%i + if not os.path.exists (shell): + shell = '/bin/%s'%i + if not os.path.exists (shell): + continue + else: + break + else: + break; + + if not os.path.exists (shell): + # Give up, we're completely stuck + print >> sys.stderr, _('Unable to find a shell') + exit (1) + + if not args: + args.append (shell) self._pid = self._vte.fork_command (command = shell, argv = args, envv = [], directory=self.cwd, loglastlog = login, logwtmp = update_records, logutmp = update_records) From 57a8d943397eb6f5e271471a74e4e94a1dfa03a0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 15 May 2008 22:21:25 +0100 Subject: [PATCH 41/58] Also handle the chosen shell failing to spawn. There's not much else we can do than die --- terminator | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminator b/terminator index 0840cd77..c178f770 100755 --- a/terminator +++ b/terminator @@ -209,6 +209,10 @@ class TerminatorTerm: self._pid = self._vte.fork_command (command = shell, argv = args, envv = [], directory=self.cwd, loglastlog = login, logwtmp = update_records, logutmp = update_records) + if self._pid == -1: + print >>sys.stderr, _('Unable to start shell: ') + shell + exit (1) + def get_cwd (self): """ Return the current working directory of the subprocess. This function requires OS specific behaviours From 7b52be076b4fc9f7deb6066ec4d33ee1475edff1 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 15 May 2008 23:09:01 +0100 Subject: [PATCH 42/58] Make failing shells be handled more gracefully --- terminator | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/terminator b/terminator index c178f770..9574ba30 100755 --- a/terminator +++ b/terminator @@ -148,7 +148,9 @@ class TerminatorTerm: if not env_proxy: os.putenv ('http_proxy', self.conf.http_proxy) - self.spawn_child () + if self.spawn_child () == -1: + # We failed to usefully create a child shell, we need to kill ourself + gobject.timeout_add (100, self.terminator.closeterm, self) def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"): userchars = "-A-Za-z0-9" @@ -202,7 +204,7 @@ class TerminatorTerm: if not os.path.exists (shell): # Give up, we're completely stuck print >> sys.stderr, _('Unable to find a shell') - exit (1) + return (-1) if not args: args.append (shell) @@ -211,20 +213,21 @@ class TerminatorTerm: if self._pid == -1: print >>sys.stderr, _('Unable to start shell: ') + shell - exit (1) + return (-1) def get_cwd (self): """ Return the current working directory of the subprocess. This function requires OS specific behaviours """ + cwd = None system = platform.system () if system == 'Linux': - cwd = os.path.realpath ('/proc/%s/cwd' % self._pid) - else: - # We don't have a child cwd getter for this platform, so let - # TerminatorTerm use its default - cwd = None + try: + cwd = os.path.realpath ('/proc/%s/cwd' % self._pid) + except: + pass + return (cwd) def reconfigure_vte (self): From 7b730da177c955d09ce4d22839f9a93d64962ad0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 15 May 2008 23:22:27 +0100 Subject: [PATCH 43/58] Apply patch from Jesse Michael which should fix bugs #189116 and #230373 --- terminator | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminator b/terminator index 9574ba30..3d96c068 100755 --- a/terminator +++ b/terminator @@ -446,8 +446,8 @@ class TerminatorTerm: pangodesc.set_size (fontsize) self._vte.set_font (pangodesc) - def on_vte_popup_menu (self, term): - self.do_popup () + def on_vte_popup_menu (self, term, event): + self.do_popup (event) def do_popup (self, event = None): menu = self.create_popup_menu (event) From 0d6c018d935775dfeede388e5f9347e2a4fa13c2 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 16 May 2008 13:26:45 +0100 Subject: [PATCH 44/58] Allow ctrl-click to open URLs. Patch from Emilio Pozuelo Monfort in LP bug #211079 --- terminator | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/terminator b/terminator index 3d96c068..c679e3b6 100755 --- a/terminator +++ b/terminator @@ -345,6 +345,19 @@ class TerminatorTerm: self.reconfigure_vte () def on_vte_button_press (self, term, event): + # Left mouse button + Ctrl while over a link should open it + mask = gtk.gdk.CONTROL_MASK + if (event.state & mask) == mask: + if event.button == 1: + url = self._vte.match_check (int (event.x / self._vte.get_char_width ()), int (event.y / self._vte.get_char_height ())) + if url: + if (url[0][0:7] != "mailto:") & (url[1] == self.matches['email']): + address = "mailto:" + url[0] + else: + address = url[0] + openurl ( address ) + return False + # Left mouse button should transfer focus to this vte widget if event.button == 1: self._vte.grab_focus () From 6296fe871f95f58285c03c901fd07bcf849cb170 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 17 May 2008 23:20:17 +0100 Subject: [PATCH 45/58] share the love --- doc/terminator.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/terminator.1 b/doc/terminator.1 index 5a3d5366..9dd051d0 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -85,7 +85,7 @@ Toggle fullscreen .SH "SEE ALSO" .BR gnome\-terminal(1),terminatorrc(5) .SH "AUTHOR" -Terminator was written by Chris Jones +Terminator was written by Chris Jones and others. .PP This manual page was written by Chris Jones for the Ubuntu project (but may be used by others). From 67c0d0bb8426ed312ab90ad8e7956daa641ee55e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 19 May 2008 00:42:08 +0100 Subject: [PATCH 46/58] Make TerminatorTerm extend gtk.VBox rather than having hacks to behave like it. Patch by Chris Oattes. Allows us to beging removing get_box() --- terminator | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/terminator b/terminator index c679e3b6..9713fe74 100755 --- a/terminator +++ b/terminator @@ -72,11 +72,12 @@ def openurl (url): except: pass -class TerminatorTerm: +class TerminatorTerm (gtk.VBox): matches = {} def __init__ (self, terminator, profile = None, command = None, cwd = None): + gtk.VBox.__init__ (self) self.terminator = terminator self.conf = terminator.conf self.command = command @@ -99,10 +100,9 @@ class TerminatorTerm: self._title.show() self._titlebox = gtk.EventBox() self._titlebox.add(self._title) - self._box = gtk.VBox () - self._box.show() - self._box.pack_start(self._titlebox, False) - self._box.pack_start(self._termbox) + self..show() + self.pack_start(self._titlebox, False) + self.pack_start(self._termbox) if len(self.terminator.term_list) > 0 and self.conf.titlebars: if len(self.terminator.term_list) == 1: self.terminator.term_list[0]._titlebox.show() @@ -563,7 +563,7 @@ class TerminatorTerm: self.terminator.set_window_title("%s: %s" %(APP_NAME.capitalize(), vte.get_window_title ())) def get_box (self): - return self._box + return self class Terminator: def __init__ (self, profile, command = None, fullscreen = False, maximise = False, borderless = False): From 3854bc2f6e725fe9c498536d6faf2670977ddea2 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 19 May 2008 00:44:59 +0100 Subject: [PATCH 47/58] update copyright file --- debian/copyright | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/copyright b/debian/copyright index 79527aef..9ada8f11 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,6 +9,9 @@ Upstream Authors: Huang He Kees Cook Thomas Meire + Nicolas Valcarcel + Emmanuel Bretelle + Chris Oattes Artwork: Cristian Grada - Drew our icon and licenced it to us under this licence From 78ca918f74b94c0ae305732e1b9118340be20532 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 19 May 2008 00:47:56 +0100 Subject: [PATCH 48/58] love for cory too --- debian/copyright | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/copyright b/debian/copyright index 9ada8f11..3998c2f0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -14,7 +14,8 @@ Upstream Authors: Chris Oattes Artwork: - Cristian Grada - Drew our icon and licenced it to us under this licence + Cory Kontros - Produced our current icon + Cristian Grada - Drew our original icon and licenced it to us under this licence Translations: Thomas Meire From 549f046904983767eedcd23c06a0cf2633742123 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 19 May 2008 00:50:38 +0100 Subject: [PATCH 49/58] fix a typo in a previous commit, and remove all references to get_box() --- terminator | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/terminator b/terminator index 9713fe74..f1370743 100755 --- a/terminator +++ b/terminator @@ -100,7 +100,7 @@ class TerminatorTerm (gtk.VBox): self._title.show() self._titlebox = gtk.EventBox() self._titlebox.add(self._title) - self..show() + self.show() self.pack_start(self._titlebox, False) self.pack_start(self._termbox) if len(self.terminator.term_list) > 0 and self.conf.titlebars: @@ -562,9 +562,6 @@ class TerminatorTerm (gtk.VBox): if vte.get_window_title (): self.terminator.set_window_title("%s: %s" %(APP_NAME.capitalize(), vte.get_window_title ())) - def get_box (self): - return self - class Terminator: def __init__ (self, profile, command = None, fullscreen = False, maximise = False, borderless = False): self.profile = profile @@ -622,7 +619,7 @@ class Terminator: term = (TerminatorTerm (self, self.profile, self.command)) self.term_list = [term] - self.window.add (term.get_box ()) + self.window.add (term) self.window.show () def maximize (self): @@ -708,14 +705,14 @@ class Terminator: pane = (vertical) and gtk.VPaned () or gtk.HPaned () # get the parent of the provided terminal - parent = widget.get_box ().get_parent () + parent = widget.get_parent () if isinstance (parent, gtk.Window): # We have just one term - widget.get_box ().reparent (pane) + widget.reparent (pane) - pane.pack1 (widget.get_box (), True, True) - pane.pack2 (terminal.get_box (), True, True) + pane.pack1 (widget, True, True) + pane.pack2 (terminal, True, True) parent.add (pane) @@ -724,23 +721,23 @@ class Terminator: if isinstance (parent, gtk.Paned): # We are inside a split term - position = (vertical) and widget.get_box().allocation.height \ - or widget.get_box().allocation.width + position = (vertical) and widget.allocation.height \ + or widget.allocation.width - if (widget.get_box () == parent.get_child1 ()): - widget.get_box ().reparent (pane) + if (widget == parent.get_child1 ()): + widget.reparent (pane) parent.pack1 (pane, True, True) else: - widget.get_box ().reparent (pane) + widget.reparent (pane) parent.pack2 (pane, True, True) - pane.pack1 (widget.get_box (), True, True) - pane.pack2 (terminal.get_box (), True, True) + pane.pack1 (widget, True, True) + pane.pack2 (terminal, True, True) # show all, set position of the divider pane.show () pane.set_position (position / 2) - terminal.get_box ().show () + terminal.show () # insert the term reference into the list index = self.term_list.index (widget) @@ -752,7 +749,7 @@ class Terminator: return (terminal) def closeterm (self, widget): - parent = widget.get_box ().get_parent () + parent = widget.get_parent () sibling = None if isinstance (parent, gtk.Window): @@ -766,9 +763,9 @@ class Terminator: grandparent = parent.get_parent () # Discover sibling while all objects exist - if widget.get_box () == parent.get_child1 (): + if widget == parent.get_child1 (): sibling = parent.get_child2 () - if widget.get_box () == parent.get_child2 (): + if widget == parent.get_child2 (): sibling = parent.get_child1 () if not sibling: @@ -779,12 +776,12 @@ class Terminator: self.term_list.remove (widget) grandparent.remove (parent) sibling.reparent (grandparent) - widget.get_box ().destroy () + widget.destroy () parent.destroy () if not isinstance (sibling, gtk.Paned): for term in self.term_list: - if term.get_box () == sibling: + if term == sibling: term._vte.grab_focus () break else: @@ -826,7 +823,7 @@ class Terminator: vertical = False else: return - parent = self.get_first_parent_paned(widget.get_box (),vertical) + parent = self.get_first_parent_paned(widget,vertical) if parent == None: return From 0e20e435f4bf00745143a0aef0c2118bae1738be Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 19 May 2008 23:05:10 +0100 Subject: [PATCH 50/58] don't set when it's empty --- terminator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminator b/terminator index f1370743..6d0181a4 100755 --- a/terminator +++ b/terminator @@ -145,7 +145,7 @@ class TerminatorTerm (gtk.VBox): self.add_matches() env_proxy = os.getenv ('http_proxy') - if not env_proxy: + if not env_proxy and self.conf.http_proxy: os.putenv ('http_proxy', self.conf.http_proxy) if self.spawn_child () == -1: From 8d1209ac0d314c2c28a637a004cc6af57a675a09 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 20 May 2008 00:46:34 +0100 Subject: [PATCH 51/58] move child spawning outside TerminatorTerm.__init__ mainly so we can set WINDOWID for children --- terminator | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/terminator b/terminator index 6d0181a4..29e10695 100755 --- a/terminator +++ b/terminator @@ -148,9 +148,7 @@ class TerminatorTerm (gtk.VBox): if not env_proxy and self.conf.http_proxy: os.putenv ('http_proxy', self.conf.http_proxy) - if self.spawn_child () == -1: - # We failed to usefully create a child shell, we need to kill ourself - gobject.timeout_add (100, self.terminator.closeterm, self) + os.putenv ('COLORTERM', 'gnome-terminal') def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"): userchars = "-A-Za-z0-9" @@ -204,11 +202,14 @@ class TerminatorTerm (gtk.VBox): if not os.path.exists (shell): # Give up, we're completely stuck print >> sys.stderr, _('Unable to find a shell') + gobject.timeout_add (100, self.terminator.closeterm, self) return (-1) if not args: args.append (shell) + os.putenv ('WINDOWID', '%s'%self._vte.get_parent_window().xid) + self._pid = self._vte.fork_command (command = shell, argv = args, envv = [], directory=self.cwd, loglastlog = login, logwtmp = update_records, logutmp = update_records) if self._pid == -1: @@ -621,6 +622,7 @@ class Terminator: self.window.add (term) self.window.show () + term.spawn_child () def maximize (self): """ Maximize the Terminator window.""" @@ -738,6 +740,7 @@ class Terminator: pane.show () pane.set_position (position / 2) terminal.show () + terminal.spawn_child () # insert the term reference into the list index = self.term_list.index (widget) From 2c970a7aec8d25dcd687549d96add777003049c6 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 21 May 2008 00:10:54 +0100 Subject: [PATCH 52/58] whitespace fail, also ignore pyc files --- .bzrignore | 1 + terminatorconfig.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .bzrignore diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 00000000..0d20b648 --- /dev/null +++ b/.bzrignore @@ -0,0 +1 @@ +*.pyc diff --git a/terminatorconfig.py b/terminatorconfig.py index e056c952..e6e4950a 100755 --- a/terminatorconfig.py +++ b/terminatorconfig.py @@ -212,7 +212,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore): value = None dbg (' VSGConf: preparing: %s/%s'%(self.profile, key)) - + # FIXME: Ugly special cases we should look to fix in some other way. if key == 'font' and self.use_system_font: value = self.client.get ('/desktop/gnome/interface/monospace_font_name') From dc4f1ebd303d82d7ef0c23b3992b4ed47feedb1e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 21 May 2008 00:42:43 +0100 Subject: [PATCH 53/58] remove some redundancy --- terminator | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terminator b/terminator index ab062b82..be021fea 100755 --- a/terminator +++ b/terminator @@ -584,9 +584,8 @@ class TerminatorTerm (gtk.VBox): for encoding in encodings: if encoding[1] in active_encodings: - #already in active_encodings continue - label = "" + if encoding[1] is None: label = "%s %s"%(encoding[2], self._vte.get_encoding ()) else: From 4c7d047a8421b17a94a7934da87c8229344a9743 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Wed, 21 May 2008 02:43:08 +0100 Subject: [PATCH 54/58] including dbg function to terminator --- terminator | 1 + 1 file changed, 1 insertion(+) diff --git a/terminator b/terminator index be021fea..aa1c8074 100755 --- a/terminator +++ b/terminator @@ -37,6 +37,7 @@ import pwd # import our configuration loader import terminatorconfig +from terminatorconfig import dbg #import encoding list from terminatorencoding import TerminatorEncoding From 9ef585a7b76c70eed261cb4e774c709fe466a89c Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 21 May 2008 11:17:55 +0100 Subject: [PATCH 55/58] Move terminator*.pyc to terminatorlib. Teach setup.py about the change. --- setup.py | 2 +- terminator | 12 ++++++------ terminatorlib/__init__.py | 0 terminatorconfig.py => terminatorlib/config.py | 0 terminatorencoding.py => terminatorlib/encoding.py | 0 5 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 terminatorlib/__init__.py rename terminatorconfig.py => terminatorlib/config.py (100%) rename terminatorencoding.py => terminatorlib/encoding.py (100%) diff --git a/setup.py b/setup.py index f3d07f4c..842107e5 100755 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ setup(name='Terminator', ('share/icons/hicolor/24x24/apps', glob.glob('data/icons/24x24/apps/*.png')), ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ], - py_modules=['terminatorconfig', 'terminatorencoding'], + packages=['terminatorlib'], cmdclass={'build': BuildData, 'install_data': InstallData} ) diff --git a/terminator b/terminator index aa1c8074..89815c45 100755 --- a/terminator +++ b/terminator @@ -36,11 +36,11 @@ except: import pwd # import our configuration loader -import terminatorconfig -from terminatorconfig import dbg +from terminatorlib import config +from terminatorlib.config import dbg #import encoding list -from terminatorencoding import TerminatorEncoding +from terminatorlib.encoding import TerminatorEncoding # import gtk libs # check just in case anyone runs it on a non-gnome system. @@ -632,17 +632,17 @@ class Terminator: self._fullscreen = False self.term_list = [] stores = [] - stores.append (terminatorconfig.TerminatorConfValuestoreRC ()) + stores.append (config.TerminatorConfValuestoreRC ()) try: import gconf - store = terminatorconfig.TerminatorConfValuestoreGConf () + store = config.TerminatorConfValuestoreGConf () store.set_reconfigure_callback (self.reconfigure_vtes) stores.append (store) except: pass - self.conf = terminatorconfig.TerminatorConfig (stores) + self.conf = config.TerminatorConfig (stores) self.window = gtk.Window () self.window.set_title (APP_NAME.capitalize()) diff --git a/terminatorlib/__init__.py b/terminatorlib/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/terminatorconfig.py b/terminatorlib/config.py similarity index 100% rename from terminatorconfig.py rename to terminatorlib/config.py diff --git a/terminatorencoding.py b/terminatorlib/encoding.py similarity index 100% rename from terminatorencoding.py rename to terminatorlib/encoding.py From a239876d99bd2db4a3edb15ca911e1977493d112 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Wed, 21 May 2008 11:39:30 +0100 Subject: [PATCH 56/58] Move cwd detection code about a bit, add FreeBSD support code that'll currently only do anything on 7-STABLE as of last month. --- terminator | 22 ++++++----- terminatorlib/freebsd.py | 83 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 10 deletions(-) create mode 100644 terminatorlib/freebsd.py diff --git a/terminator b/terminator index 89815c45..21a7dcd4 100755 --- a/terminator +++ b/terminator @@ -42,6 +42,17 @@ from terminatorlib.config import dbg #import encoding list from terminatorlib.encoding import TerminatorEncoding +# Sort out cwd detection code, if available +pid_get_cwd = lambda pid: None +if platform.system() == 'FreeBSD': + try: + from terminatorlib import freebsd + pid_get_cwd = lambda pid: freebsd.get_process_cwd(pid) + except: + pass +elif platform.system == 'Linux': + pid_get_cwd = lambda pid: os.path.realpath ('/proc/%s/cwd' % pid) + # import gtk libs # check just in case anyone runs it on a non-gnome system. try: @@ -224,16 +235,7 @@ class TerminatorTerm (gtk.VBox): """ Return the current working directory of the subprocess. This function requires OS specific behaviours """ - cwd = None - system = platform.system () - - if system == 'Linux': - try: - cwd = os.path.realpath ('/proc/%s/cwd' % self._pid) - except: - pass - - return (cwd) + return (pid_get_cwd(self._pid)) def reconfigure_vte (self): # Set our emulation diff --git a/terminatorlib/freebsd.py b/terminatorlib/freebsd.py new file mode 100644 index 00000000..221d5146 --- /dev/null +++ b/terminatorlib/freebsd.py @@ -0,0 +1,83 @@ +#!/usr/local/bin/python +# +# Use sysctl() to retrieve the cwd of an arbitrary process on FreeBSD. +# Tested on FreeBSD 7-STABLE/amd64 from April 11 2008. +# +# Be prepared for excitement if the structs are changed. +# +# Blame: Thomas Hurst +# + +from ctypes import * + +# This is padded awkwardly, see /usr/include/sys/socket.h +class sockaddr_storage(Structure): + _fields_ = [ + ('ss_len', c_char), + ('ss_family', c_char), # /usr/include/sys/_types.h; _uint8_t + ('__ss_pad1', c_char * 6), # (sizeof(int64) - sizeof(char) - sizeof(ss_family_t)) + ('__ss_align', c_longlong), + ('__ss_pad2', c_char * 112), # (128(maxsize) - sizeof(char) - sizeof(ss_family_t) - + # sizeof(ss_pad1) - sizeof(int64)) + ] + +# struct kinfo_file, defined in /usr/include/sys/user.h +class kinfo_file(Structure): + _fields_ = [ + ('kf_structsize', c_int), + ('kf_type', c_int), + ('kf_fd', c_int), + ('kf_ref_count', c_int), + ('kf_flags', c_int), + ('kf_offset', c_long), # this is a off_t, a pointer + ('kf_vnode_type', c_int), + ('kf_sock_domain', c_int), + ('kf_sock_type', c_int), + ('kf_sock_protocol', c_int), + ('kf_path', c_char * 1024), # PATH_MAX + ('kf_sa_local', sockaddr_storage), + ('kf_sa_peer', sockaddr_storage), + ] + + +def get_process_cwd(pid): + libc = CDLL('libc.so') + + len = c_uint(sizeof(c_uint)) + ver = c_uint(0) + + if (libc.sysctlbyname('kern.osreldate', byref(ver), byref(len), None, 0) < 0): + return None + + # kern.proc.filedesc added for procstat(1) after these __FreeBSD_versions + if ver.value < 700104 and ver.value < 800019: + return None + + # /usr/include/sys/sysctl.h + # CTL_KERN, KERN_PROC, KERN_PROC_FILEDESC + oid = (c_uint * 4)(1, 14, 14, pid) + + if libc.sysctl(oid, 4, None, byref(len), None, 0) < 0: + return None + + buf = c_char_p(" " * len.value) + if libc.sysctl(oid, 4, buf, byref(len), None, 0) < 0: + return None + + kifs = cast(buf, POINTER(kinfo_file)) + for i in range(0, len.value / sizeof(kinfo_file)): + kif = kifs[i] + if kif.kf_fd == -1: # KF_FD_TYPE_CWD + return kif.kf_path + +if __name__ == '__main__': + import os, sys + print " => %d cwd = %s" % (os.getpid(), get_process_cwd(os.getpid())) + for pid in sys.argv: + try: + pid = int(pid) + except: + pass + else: + print " => %d cwd = %s" % (pid, get_process_cwd(pid)) + From 2d9f2142322282f071174edb8de78707f0c99add Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 21 May 2008 17:34:44 +0100 Subject: [PATCH 57/58] damn tabs --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ae60bf5..4f3ae2c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,8 +3,8 @@ terminator 0.9: * Added kwybindings for terms size and scrollbar manipulation. Thanks Emmanuel Bretelle. * Completely revamped config system which now transparently makes use - of gconf settings if they are available, falls back to sensible - defaults if not, and can be overridden entirely by ~/.terminatorrc + of gconf settings if they are available, falls back to sensible + defaults if not, and can be overridden entirely by ~/.terminatorrc terminator 0.8.1: * Fixed ChangeLog From d0dd28c4d4127261dc69984e56f3fc6a51e43dd8 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 21 May 2008 17:36:09 +0100 Subject: [PATCH 58/58] mention the icon licence --- debian/copyright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/copyright b/debian/copyright index 3998c2f0..70c0d016 100644 --- a/debian/copyright +++ b/debian/copyright @@ -14,7 +14,7 @@ Upstream Authors: Chris Oattes Artwork: - Cory Kontros - Produced our current icon + Cory Kontros - Produced our current icon under the CC-by-SA licence Cristian Grada - Drew our original icon and licenced it to us under this licence Translations: