-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
35 lines (26 loc) · 988 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from PythonQt.QtCore import QFile
from PythonQt.QtGui import QDesktopServices, QMessageBox
import ScreenCloud
from pynoelshack import NoelShack, NoelShackError
import time
class NoelShackUploader():
def showSettingsUI(self, parentWidget):
QMessageBox.information(parentWidget,
'NoelShack',
'This plugin has no settings.')
def isConfigured(self):
return True
def getFilename(self):
return ScreenCloud.formatFilename('screenshot')
def upload(self, screenshot, name):
temp = QDesktopServices.storageLocation(QDesktopServices.TempLocation)
file = temp + '/' + name
screenshot.save(QFile(file), ScreenCloud.getScreenshotFormat())
ns = NoelShack()
try:
url = ns.upload(file)
except NoelShackError as e:
ScreenCloud.setError(str(e))
return False
ScreenCloud.setUrl(url)
return True