Skip to content
Snippets Groups Projects
Commit c71aed25 authored by Nathan_SR's avatar Nathan_SR
Browse files

On branch master

 Initial commit
 Changes to be committed:
	new file:   copyright
	new file:   helpman
	new file:   helpman.1.gz
	new file:   helpman.desktop
	new file:   helpman.glade
	new file:   helpman.png
	new file:   helpman_small.png
	new file:   info_24x24.png
	new file:   setup.py
parents
Branches
Tags
No related merge requests found
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Contact: cquickcal@gmail.com
Source: https://mentors.debian.net/package/helpman
Files: *
Copyright: 2017 Nathan SR <cquickcal@gmail.com>
License: GPL-3+
Files: debian/*
Copyright: 1995-1997, Chris Fearnley <cjf@netaxs.com>
1998-2006, James Troup <james@nocrew.org>
2008-2010, Arthur Loiret <aloiret@debian.org>
2011-2014, Jeroen Schot <schot@a-eskwadraat.nl>
License: GPL-3+
License: GPL-3+
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, either version 3 of the License, or
(at your option) any later version.
.
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, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file `/usr/share/common-licenses/GPL-3'.
helpman 0 → 100755
#!/usr/bin/python
# -*- coding: utf-8 -*-
# helpman - Manuals / Guides / Tutorials
# Copyright (C) 2017 Nathan SR <cquickcal@gmail.com>
# License:
# helpman 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, either version 3 of the License, or
# (at your option) any later version.
#
# helpman 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 helpman. If not, see <http://www.gnu.org/licenses/>.
# Necessary Imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
import subprocess
import re
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)
(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())
def execute_command_II(full_command):
proc = subprocess.Popen(full_command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
(out, err) = proc.communicate()
# if err:
# result.set_text(err)
# else:
if out:
textbuffer.set_text(out)
result.set_text("")
textview.grab_focus()
start = textbuffer.get_start_iter()
end = textbuffer.get_end_iter()
textbuffer.place_cursor(start)
else:
textbuffer.set_text("")
if smentry.get_text():
result.set_text("No manual entry for " + smentry.get_text())
else:
result.set_text("")
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("")
textbuffer.set_text("")
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("")
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 !")
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("")
def detailsbutton(self, button):
ouraboutwindow.set_transient_for(window)
ouraboutwindow.run()
ouraboutwindow.hide()
# ouraboutwindow.destroy()
builder = Gtk.Builder()
builder.add_from_file("/usr/lib/helpman/helpman.glade")
# builder.add_from_file("helpman.glade")
builder.connect_signals(Handler())
window = builder.get_object("window1")
textview = builder.get_object("textview1")
textbuffer = textview.get_buffer()
textview.modify_font(Pango.FontDescription('Verdana 14'))
bgcolor = Gdk.RGBA()
bgcolor.parse('#edd2a4')
# fgcolor = Gdk.RGBA()
# fgcolor.parse('#AACCFF')
# crcolor = Gdk.RGBA()
# crcolor.parse('#FFFFFF')
textview.override_background_color(Gtk.StateFlags.NORMAL, bgcolor)
# textview.override_color(Gtk.StateFlags.NORMAL, fgcolor)
# textview.override_cursor(crcolor, fgcolor)
manual_type_cbtext_I = builder.get_object("manual_type_cbtext_1")
manual_type_cbtext_I.modify_font(Pango.FontDescription('Verdana 14'))
manual_type_cbtext_I.grab_focus()
starting_with_cbtext_II = builder.get_object("starting_with_cbtext_2")
starting_with_cbtext_II.modify_font(Pango.FontDescription('Verdana 14'))
select_manual_cbtext_III = builder.get_object("select_manual_cbtext_3")
select_manual_cbtext_III.modify_font(Pango.FontDescription('Verdana 14'))
# Following specifies the combo box text values and populates the same
default_textI = ["Executable programs or shell commands", "System calls (functions provided by the kernel)", "Library calls (functions within program libraries)", "Special files (usually found in /dev)", "File formats and conventions eg /etc/passwd", "Games", "Miscellaneous (including macro packages and conventions)", "System administration commands (usually only for root)"]
for x in default_textI:
# print x
manual_type_cbtext_I.append_text(x)
default_textII = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "[0-9]", "others", "all"]
for y in default_textII:
starting_with_cbtext_II.append_text(y)
result = builder.get_object("result1")
result.modify_font(Pango.FontDescription('Verdana 14'))
smentry = builder.get_object("smentry1")
smentry.modify_font(Pango.FontDescription('Verdana 14'))
ouraboutwindow = builder.get_object("aboutdialog1")
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()
File added
[Desktop Entry]
Name=Helpman Manuals / Guides / Tutorials
Comment=quick & easy access to 4000+ manuals / guides / tutorials
Keywords=manuals;guides;tutorials
Exec=helpman
Icon=helpman
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAboutDialog" id="aboutdialog1">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="title" translatable="yes">Helpman</property>
<property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
<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="copyright" translatable="yes">Files: *
Copyright: 2017 Nathan SR &lt;cquickcal@gmail.com&gt;
License: GPL-3+</property>
<property name="comments" translatable="yes">quick &amp; easy access to 4000+ manuals / guides / tutorials
Helpman provides a classified access to the manuals,
installed by user / system programs, automatically.
It also supports typing a program / manual name,
in the Select Manual: text / combo box directly,
to display it quickly. Error Messages will be shown
below, if a manual is not found.
The Manual Type list box, shows sections 1 to 8,
useful for specific display of a version of the
manual. Say for example, if you see, CRON(8) in
a manual, it means the CRON manual in the
8th section. So a user should choose appropriately.
</property>
<property name="website">https://sourceforge.net/projects/helpman-1/</property>
<property name="website_label" translatable="yes">Program Website</property>
<property name="license" translatable="yes">License: GPL-3+
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, either version 3 of the License, or
(at your option) any later version.
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, see &lt;http://www.gnu.org/licenses/&gt;.
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file `/usr/share/common-licenses/GPL-3'.</property>
<property name="authors">Helpman : Nathan SR &lt;cquickcal@gmail.com&gt; </property>
<property name="logo">/usr/share/pixmaps/helpman_small.png</property>
<property name="license_type">custom</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">/usr/share/pixmaps/info_24x24.png</property>
</object>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">HelpMan Manuals / Guides / Tutorials</property>
<property name="window_position">center</property>
<property name="icon">/usr/share/pixmaps/helpman.png</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes"> Welcome to HelpMan Manuals / Guides / Tutorials !</property>
<attributes>
<attribute name="font-desc" value="Sans 14"/>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image1</property>
<property name="image_position">right</property>
<signal name="clicked" handler="detailsbutton" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">80</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes"> Manual Type: </property>
<attributes>
<attribute name="font-desc" value="Sans 14"/>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="manual_type_cbtext_1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="manual_type_cbtext_1_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes"> Starting With: </property>
<attributes>
<attribute name="font-desc" value="Sans 14"/>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="starting_with_cbtext_2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="starting_with_cbtext_2_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes"> Select Manual: </property>
<attributes>
<attribute name="font-desc" value="Sans 14"/>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="select_manual_cbtext_3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="select_manual_cbtext_3_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="smentry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Manual View</property>
<attributes>
<attribute name="font-desc" value="Sans 12"/>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">882</property>
<property name="height_request">434</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="textview1">
<property name="width_request">882</property>
<property name="height_request">434</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkEntry" id="result1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="placeholder_text" translatable="yes">Error Messages If Any</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
</interface>
helpman.png

127 KiB

helpman_small.png

5.97 KiB

info_24x24.png

1.53 KiB

setup.py 0 → 100644
from distutils.core import setup
setup(name = "helpman",
version = "1.0",
description = "helpman gives quick & easy access to 4000+ manuals / guides / tutorials",
author = "Nathan SR",
author_email = "cquickcal@gmail.com",
url = "https://sourceforge.net/projects/helpman-1/",
license='GPLv3',
scripts=['helpman'],
data_files = [ ("lib/helpman", ["helpman.glade"]),
("share/pixmaps", ["helpman.png"]),
("share/pixmaps", ["helpman_small.png"]),
("share/pixmaps", ["info_24x24.png"]),
("share/man/man1", ["helpman.1.gz"]),
("share/doc/helpman", ["copyright"]),
("share/applications", ["helpman.desktop"]) ] )
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment