Replace 'result' plugin type with 'feedback'
This commit is contained in:
parent
1466438938
commit
92bb65a049
2 changed files with 8 additions and 30 deletions
18
clipboard.py
18
clipboard.py
|
@ -18,17 +18,11 @@ from sshare.plugins.config import Flag
|
||||||
from sshare.plugins.config import NoDefault
|
from sshare.plugins.config import NoDefault
|
||||||
from sshare.plugins.source import Raw
|
from sshare.plugins.source import Raw
|
||||||
|
|
||||||
plugin_type = { "source", "result" }
|
plugin_type = { "source", "feedback" }
|
||||||
|
|
||||||
activate = {
|
activate = {
|
||||||
"source": { "from_clipboard" },
|
"source": { "from_clipboard" },
|
||||||
"result": { "to_clipboard" },
|
"feedback": { "to_clipboard" },
|
||||||
}
|
|
||||||
config = {
|
|
||||||
"protocol": "https",
|
|
||||||
"host": NoDefault,
|
|
||||||
"port": None,
|
|
||||||
"path": "",
|
|
||||||
}
|
}
|
||||||
args = {
|
args = {
|
||||||
"from_clipboard": Flag(
|
"from_clipboard": Flag(
|
||||||
|
@ -47,9 +41,5 @@ def get_source():
|
||||||
logger.info("Uploading contents of clipboard")
|
logger.info("Uploading contents of clipboard")
|
||||||
return Raw("txt", pyclip.paste())
|
return Raw("txt", pyclip.paste())
|
||||||
|
|
||||||
def result(name):
|
def give_feedback(location):
|
||||||
if config.port:
|
pyclip.copy(location)
|
||||||
config.port = f":{config.port}"
|
|
||||||
else:
|
|
||||||
config.port = ""
|
|
||||||
pyclip.copy(f"{config.protocol}://{config.host}{config.port}{config.path}/{name}")
|
|
||||||
|
|
|
@ -12,20 +12,14 @@
|
||||||
# You should have received a copy of the GNU General Public License along with
|
# You should have received a copy of the GNU General Public License along with
|
||||||
# SSHare. If not, see <https://www.gnu.org/licenses/>.
|
# SSHare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from desktop_notifier import DesktopNotifierSync, Urgency, Button
|
from desktop_notifier import DesktopNotifierSync
|
||||||
|
|
||||||
from sshare.plugins.config import Flag
|
from sshare.plugins.config import Flag
|
||||||
from sshare.plugins.config import NoDefault
|
from sshare.plugins.config import NoDefault
|
||||||
|
|
||||||
plugin_type = "result"
|
plugin_type = "feedback"
|
||||||
|
|
||||||
activate = { "notify" }
|
activate = { "notify" }
|
||||||
config = {
|
|
||||||
"protocol": "https",
|
|
||||||
"host": NoDefault,
|
|
||||||
"port": None,
|
|
||||||
"path": "",
|
|
||||||
}
|
|
||||||
args = {
|
args = {
|
||||||
"notify": Flag(
|
"notify": Flag(
|
||||||
short="n",
|
short="n",
|
||||||
|
@ -35,14 +29,8 @@ args = {
|
||||||
|
|
||||||
_notifier = DesktopNotifierSync()
|
_notifier = DesktopNotifierSync()
|
||||||
|
|
||||||
def result(name):
|
def give_feedback(location):
|
||||||
if config.port:
|
|
||||||
config.port = f":{config.port}"
|
|
||||||
else:
|
|
||||||
config.port = ""
|
|
||||||
url = f"{config.protocol}://{config.host}{config.port}{config.path}/{name}"
|
|
||||||
|
|
||||||
_notifier.send(
|
_notifier.send(
|
||||||
title="SSHare - Upload Complete",
|
title="SSHare - Upload Complete",
|
||||||
message=f"Uploaded to {url}",
|
message=f"Uploaded to {location}",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue