From 995f564cb877954db4f108481fa6148d73df3072 Mon Sep 17 00:00:00 2001 From: Nathan_SR <cquickcal@gmail.com> Date: Sun, 17 Dec 2017 00:32:05 +0530 Subject: [PATCH] On branch master modified: helpman modified: helpman.1.gz modified: helpman.glade modified: setup.py --- helpman | 104 ++++++++++++++++++++++++++------------------------ helpman.1.gz | Bin 603 -> 603 bytes helpman.glade | 2 +- setup.py | 6 +-- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/helpman b/helpman index f63688a..e27417e 100755 --- a/helpman +++ b/helpman @@ -32,25 +32,31 @@ import os, errno import datetime import time import sys -import StringIO # Following executes os commands passed on to it def execute_command_I(full_command): - proc = subprocess.Popen(full_command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True) + proc = subprocess.Popen(full_command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True,universal_newlines=True) (out, err) = proc.communicate() if err: result.set_text(err) else: - select_manual_cbtext_III.remove_all() - s = StringIO.StringIO(out) - for line in s: - select_manual_cbtext_III.append_text(line.strip()) + select_manual_cbtext_III.remove_all() + try: + import StringIO + # from StringIO import StringIO + s = StringIO.StringIO(out) + except ImportError: + import io + from io import StringIO + s = io.StringIO(out) + for line in s: + select_manual_cbtext_III.append_text(line.strip()) def execute_command_II(full_command): - proc = subprocess.Popen(full_command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True) + proc = subprocess.Popen(full_command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True,universal_newlines=True) (out, err) = proc.communicate() # if err: # result.set_text(err) @@ -64,9 +70,9 @@ def execute_command_II(full_command): textbuffer.place_cursor(start) else: textbuffer.set_text("") - if smentry.get_text(): - result.set_text("No manual entry for " + smentry.get_text()) - else: + if smentry.get_text(): + result.set_text("No manual entry for " + smentry.get_text()) + else: result.set_text("") class Handler: @@ -74,56 +80,56 @@ class Handler: # Helpman comboboxtext and their respective changed actions. Calls the functions above with their respective parameters. def manual_type_cbtext_1_changed(self, comboboxtext): - result.set_text("") - smentry.set_text("") + result.set_text("") + smentry.set_text("") textbuffer.set_text("") - starting_with_cbtext_II.set_active(-1) - select_manual_cbtext_III.remove_all() + starting_with_cbtext_II.set_active(-1) + select_manual_cbtext_III.remove_all() def starting_with_cbtext_2_changed(self, comboboxtext): - result.set_text("") - smentry.set_text("") + result.set_text("") + smentry.set_text("") textbuffer.set_text("") - select_manual_cbtext_III.remove_all() - if manual_type_cbtext_I.get_active_text() and starting_with_cbtext_II.get_active_text(): - if starting_with_cbtext_II.get_active_text() == 'others': - dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -v '^[A-Za-z0-9]'" - # print dynamic_command - result.set_text("") - execute_command_I(dynamic_command) - elif starting_with_cbtext_II.get_active_text() == 'all': - dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -v '^$'" - # print dynamic_command - result.set_text("") - execute_command_I(dynamic_command) - else: - dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -i '^" + starting_with_cbtext_II.get_active_text() + "'" - # print dynamic_command - result.set_text("") - execute_command_I(dynamic_command) - elif not manual_type_cbtext_I.get_active_text(): - result.set_text("Please Select Manual Type First !") + select_manual_cbtext_III.remove_all() + if manual_type_cbtext_I.get_active_text() and starting_with_cbtext_II.get_active_text(): + if starting_with_cbtext_II.get_active_text() == 'others': + dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -v '^[A-Za-z0-9]'" + # print dynamic_command + result.set_text("") + execute_command_I(dynamic_command) + elif starting_with_cbtext_II.get_active_text() == 'all': + dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -v '^$'" + # print dynamic_command + result.set_text("") + execute_command_I(dynamic_command) + else: + dynamic_command = "(LC_COLLATE=en_US.utf8 && export LC_COLLATE && ls /usr/share/man/man" + str(manual_type_cbtext_I.get_active() + 1) + " ) | sed 's/\." + str(manual_type_cbtext_I.get_active() + 1) + ".*gz$//' | grep -i '^" + starting_with_cbtext_II.get_active_text() + "'" + # print dynamic_command + result.set_text("") + execute_command_I(dynamic_command) + elif not manual_type_cbtext_I.get_active_text(): + result.set_text("Please Select Manual Type First !") def select_manual_cbtext_3_changed(self, comboboxtext): if select_manual_cbtext_III.get_active_text(): - if manual_type_cbtext_I.get_active_text(): - dynamic_command = "man --sections=" + str(manual_type_cbtext_I.get_active() + 1) + " " + select_manual_cbtext_III.get_active_text() + "|tee" - # print dynamic_command - execute_command_II(dynamic_command) - else: - dynamic_command = "man " + select_manual_cbtext_III.get_active_text() + "|tee" - # print dynamic_command - execute_command_II(dynamic_command) - else: - result.set_text("") + if manual_type_cbtext_I.get_active_text(): + dynamic_command = "man --sections=" + str(manual_type_cbtext_I.get_active() + 1) + " " + select_manual_cbtext_III.get_active_text() + "|tee" + # print dynamic_command + execute_command_II(dynamic_command) + else: + dynamic_command = "man " + select_manual_cbtext_III.get_active_text() + "|tee" + # print dynamic_command + execute_command_II(dynamic_command) + else: + result.set_text("") def detailsbutton(self, button): - ouraboutwindow.set_transient_for(window) - ouraboutwindow.run() - ouraboutwindow.hide() - # ouraboutwindow.destroy() + ouraboutwindow.set_transient_for(window) + ouraboutwindow.run() + ouraboutwindow.hide() + # ouraboutwindow.destroy() builder = Gtk.Builder() diff --git a/helpman.1.gz b/helpman.1.gz index 7c8461c95395868b28cff56b7481c6da90be8dfe..7f502f391d495501c41488598000c40218770637 100644 GIT binary patch delta 586 zcmV-Q0=50y1lt4$ABzYGeLyvl2OfVFf(ju-X(JMeBvm#&Aob#SCy7<BZESCw{r7$L zCKU%Rt6h6$zBg}XtA`OSr1f&ov~z(DY<w$iB`RFpIGdzOr2ckVJt}E_>|3c#rCdwN zk#Zq0t~mr3A|X5V-bLhYW`rViL8H%f%Ze^17hgs+x~wL6o)9G>b4Q}8XS9F3UQEUL z>fr+wB)uV)u_vh%$C#O)CX>ngoZ3kf=_Bns-Ee+MU2;L=uvDx6ELV5+ygpYfhqu%E zW<9^#%vVb>JCS^FPo;t+Wn_$cr@8rumkxZUjY()5lQaeq+n&0}0pQrj#BDCL53)s+ zgpyV!4ZloZiFqO<JBpq6E~I~$P11G`;3)+)1_D{x@)(dpt=VLA7v<_JB|auZ!uqYF ztvgbqv-zfnEa+@>^hWli)8HJ)G|h9N1v-Jtk)E|Nv}KA1_iV+Mje8!G-a*I-uOnHP zum+uNDj_xyG0<t#dnTh}%H(mW5Gew$osAeX1YC^;4B2(2tWor=V5NV0)#Wnhi9<w2 z{y>Lfz*bb_J}2=}w%%|N)w>P=yx*)>%ePnWNLz6hI?i3TEP>8O<%ri72JggGI-K>P zz5}~V3&K0okUBUQnWV=AJeDSL9+bE<ST@EU<ju=vwB5n$E+uHr0$UfD8cz5J@|I(z zR%M%B*Nhs+gNaE#0$@7PxGyFR;q`P%*T3tPC|^JCf7N2?=+R;z;OtLP*Y}&*YAu#B Y9Z<4f)3^WpfZs`o7vQRl<Glj_0GDbNq5uE@ delta 586 zcmV-Q0=50y1lt4$ABzYG*(@iK2OfV2L4^>aq!Eckk}8`Xka}^vlf;VGHnz9z{(GLi zNyUN7YS*5b@6DUp>S07nX}vr!?OmWF8{bM>i3%4}XOmQk)SphPlal89p_STH%C(dn zDHj6cnnQ3Q60%e8T}1A7PAEcGH2Orhtmwn!>hp+3SJed1GonOf?nqSioK}A~%bB=b zJ-nlWq*uf;_9T_!7&G(ZWHNc1Q#)xQy{AK`8_qAOOD<>}mTL9y)%vbp)R&6o@OD;D zH;cRNV!aacGsy?{SSm<TM#iZ3nwx)k>Btw_n1r@5Nn;SP>#2(z0FHf3+~z`uAX`L9 zC~0NV@XPd-SR_KSqu6=xLW+OcByA4>o>Nd`Adr<Uj{zyvnoTx$S+2fN;^%}&Sif_$ zbI;W1Y`*Cs3pyJey^%fXG&lz`&GKAmiB8~hq$h0*?U>@xJz241<DSN(_YiW%>qyom ztU+g+N{B5)40PJ|p2_H#GI?AoM2f&`XCuZ80oP*zL-w61YZN^zSgC(rbh*rV<PedO zKhU8Vuocy~&q@3&TW`3C>Rkr_-lv=O>h<*-(pFrAj&qkSOQ5q+IpU>-!8>uCju(BX z@4zn8g7D5Xq>j!-Ch0K&kEKbR2PN(dmW{CodGm4^ZTIlHO9`5@z}5w(h7<mQyyaM_ zb=jtuHKWGyU}BOd04zEh_r;_kyq?YI=2yKI<?F}&&swY;oh$|d&fy$&bHAOhH)18z Y5hd#lef`f5_>F}43)V2Mq`d<G04z8r2><{9 diff --git a/helpman.glade b/helpman.glade index af6c6cd..43eb7e7 100644 --- a/helpman.glade +++ b/helpman.glade @@ -11,7 +11,7 @@ <property name="icon">/usr/share/pixmaps/helpman.png</property> <property name="type_hint">dialog</property> <property name="has_resize_grip">True</property> - <property name="program_name">Helpman 1.0</property> + <property name="program_name">Helpman</property> <property name="copyright" translatable="yes">Files: * Copyright: 2017 Nathan SR <cquickcal@gmail.com> License: GPL-3+</property> diff --git a/setup.py b/setup.py index a7065be..b17d678 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ from distutils.core import setup setup(name = "helpman", -version = "1.0", -description = "helpman gives quick & easy access to 4000+ manuals / guides / tutorials", +version = "2.0", +description = "quick & easy access to 4000+ manuals / guides / tutorials", author = "Nathan SR", author_email = "cquickcal@gmail.com", -url = "https://sourceforge.net/projects/helpman-1/", +url = "https://git.fosscommunity.in/SRNathan/Helpman", license='GPLv3', scripts=['helpman'], data_files = [ ("lib/helpman", ["helpman.glade"]), -- GitLab