Skip to content

Commit

Permalink
Ability to substitute with recorded filename, fixes mhsabbagh#142
Browse files Browse the repository at this point in the history
  • Loading branch information
dvershinin committed May 17, 2020
1 parent 9f8540a commit 2a3f38f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
/dist

/dist/*
!/dist/green-recorder.spec
!/dist/green-recorder.spec

/ui/#ui.glade#
3 changes: 3 additions & 0 deletions recorder/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# -*- coding: utf-8 -*-

__version__ = '3.2.4'
__copyright__ = "\n".join(['© 2019 M.Hanny Sabbagh', '© 2020 Danila Vershinin'])
3 changes: 3 additions & 0 deletions recorder/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import recorder

recorder.main()
19 changes: 8 additions & 11 deletions recorder/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# along with Green Recorder. If not, see <http://www.gnu.org/licenses/>.

import os
import time

from .__about__ import __version__
from .__about__ import __version__, __copyright__

# Force GDK backend to be X11 because Wayland applications are not allowed to
# know their window positions, which we need for selecting an area to record!
Expand All @@ -31,12 +32,7 @@
from pydbus import SessionBus
import subprocess, signal, threading, datetime, gettext, locale, sys

try:
# Python 3
from configparser import ConfigParser
except ImportError:
# Python 2
from ConfigParser import SafeConfigParser as ConfigParser
from configparser import ConfigParser

try:
# Python 3
Expand Down Expand Up @@ -260,7 +256,7 @@ def RecordGnome():


def stoprecording(_):
subprocess.call(["sleep", "1"]) # Wait ffmpeg.
time.sleep(1) # Wait ffmpeg.
window.present()

playbutton.set_sensitive(True)
Expand Down Expand Up @@ -309,7 +305,7 @@ def stoprecording(_):
subprocess.call(["rm", RecorderAbsPathName + ".tmp"])

window.present()
CommandToRun = command.get_text()
CommandToRun = command.get_text().replace('$1', RecorderAbsPathName)
subprocess.Popen([CommandToRun], shell=True)


Expand Down Expand Up @@ -385,11 +381,12 @@ def showabout(self):

# Import the glade file and its widgets.
builder = Gtk.Builder()
# TODO: make configurable instead?
possible_ui_file_locations = [
os.path.join(os.getcwd(), "ui", "ui.glade"),
"/usr/share/green-recorder/ui.glade",
"/usr/local/share/green-recorder/ui.glade",
os.path.join(os.path.dirname(__file__), "ui", "ui.glade"),
os.path.join(os.getcwd(), "ui", "ui.glade"),
]
for filename in possible_ui_file_locations:
if os.path.exists(filename):
Expand Down Expand Up @@ -455,7 +452,7 @@ def showabout(self):
aboutdialog.set_transient_for(window)
aboutdialog.set_program_name(_("Green Recorder"))
aboutdialog.set_version(__version__)
aboutdialog.set_copyright("© 2019 M.Hanny Sabbagh")
aboutdialog.set_copyright(__copyright__)
aboutdialog.set_wrap_license(True)
aboutdialog.set_license(
"Green Recorder 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.\n\nGreen Recorder 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.\n\nSee the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Green Recorder. If not, see <http://www.gnu.org/licenses/>.")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PyGObject~=3.34.0
pydbus~=0.6.0
setuptools~=46.4.0
setuptools
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

data_files.extend(locales)

install_requires = ['pydbus', 'PyGObject', 'appdirs']
install_requires = [
'pydbus',
'PyGObject',
'appdirs',
'configparser>=3.7.1',
]
tests_requires = ["pytest>=4.4.0", "flake8", "pytest-xdist"]

with open("README.md", "r") as fh:
Expand Down
2 changes: 1 addition & 1 deletion ui/ui.glade
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="logo_icon_name">green-recorder</property>
<property name="license_type">gpl-3-0</property>
<child>
<placeholder/>
</child>
Expand Down Expand Up @@ -88,7 +89,6 @@
<child>
<object class="GtkButton" id="recordbutton">
<property name="label">gtk-media-record</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
Expand Down

0 comments on commit 2a3f38f

Please sign in to comment.