mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Make Cocoa use the new FTP report-sender
This commit is contained in:
parent
1104e24408
commit
60ca27b5e1
@ -15,7 +15,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
@property (readwrite, retain) NSTextView *contentTextView;
|
@property (readwrite, retain) NSTextView *contentTextView;
|
||||||
|
|
||||||
+ (void)showErrorReportWithContent:(NSString *)content;
|
// True if the user wants to send the report
|
||||||
|
+ (BOOL)showErrorReportWithContent:(NSString *)content;
|
||||||
- (id)initWithContent:(NSString *)content;
|
- (id)initWithContent:(NSString *)content;
|
||||||
|
|
||||||
- (void)send;
|
- (void)send;
|
||||||
|
@ -13,11 +13,12 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
@synthesize contentTextView;
|
@synthesize contentTextView;
|
||||||
|
|
||||||
+ (void)showErrorReportWithContent:(NSString *)content
|
+ (BOOL)showErrorReportWithContent:(NSString *)content
|
||||||
{
|
{
|
||||||
HSErrorReportWindow *report = [[HSErrorReportWindow alloc] initWithContent:content];
|
HSErrorReportWindow *report = [[HSErrorReportWindow alloc] initWithContent:content];
|
||||||
[NSApp runModalForWindow:[report window]];
|
NSInteger result = [NSApp runModalForWindow:[report window]];
|
||||||
[report release];
|
[report release];
|
||||||
|
return result == NSOKButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithContent:(NSString *)content
|
- (id)initWithContent:(NSString *)content
|
||||||
@ -31,11 +32,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
- (void)send
|
- (void)send
|
||||||
{
|
{
|
||||||
NSString *text = [[contentTextView textStorage] string];
|
|
||||||
NSString *URL = [NSString stringWithFormat:@"mailto:support@hardcoded.net?SUBJECT=Error Report&BODY=%@",text];
|
|
||||||
NSString *encodedURL = [URL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:encodedURL]];
|
|
||||||
|
|
||||||
[[self window] orderOut:self];
|
[[self window] orderOut:self];
|
||||||
[NSApp stopModalWithCode:NSOKButton];
|
[NSApp stopModalWithCode:NSOKButton];
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
- (NSString *)url2path:(NSString *)url;
|
- (NSString *)url2path:(NSString *)url;
|
||||||
- (void)createPool;
|
- (void)createPool;
|
||||||
- (void)destroyPool;
|
- (void)destroyPool;
|
||||||
- (void)reportCrash:(NSString *)crashReport;
|
- (BOOL)reportCrash:(NSString *)crashReport;
|
||||||
- (void)log:(NSString *)s;
|
- (void)log:(NSString *)s;
|
||||||
- (NSDictionary *)readExifData:(NSString *)imagePath;
|
- (NSDictionary *)readExifData:(NSString *)imagePath;
|
||||||
@end
|
@end
|
@ -143,9 +143,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)reportCrash:(NSString *)crashReport
|
- (BOOL)reportCrash:(NSString *)crashReport
|
||||||
{
|
{
|
||||||
[HSErrorReportWindow showErrorReportWithContent:crashReport];
|
return [HSErrorReportWindow showErrorReportWithContent:crashReport];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)log:(NSString *)s
|
- (void)log:(NSString *)s
|
||||||
|
@ -12,6 +12,7 @@ import traceback
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from hscommon.error_report import send_error_report
|
||||||
from .CocoaProxy import CocoaProxy
|
from .CocoaProxy import CocoaProxy
|
||||||
|
|
||||||
proxy = CocoaProxy()
|
proxy = CocoaProxy()
|
||||||
@ -97,7 +98,8 @@ def report_crash(type, value, tb):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
# This can happen if something went wrong with the grep (permission errors?)
|
# This can happen if something went wrong with the grep (permission errors?)
|
||||||
pass
|
pass
|
||||||
proxy.reportCrash_(s)
|
if proxy.reportCrash_(s):
|
||||||
|
send_error_report(s)
|
||||||
|
|
||||||
def install_exception_hook():
|
def install_exception_hook():
|
||||||
sys.excepthook = report_crash
|
sys.excepthook = report_crash
|
||||||
|
@ -10,14 +10,18 @@ import ftplib
|
|||||||
import io
|
import io
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
import logging
|
||||||
|
|
||||||
def send_error_report(text):
|
def send_error_report(text):
|
||||||
def do():
|
def do():
|
||||||
conn = ftplib.FTP('drop.hardcoded.net')
|
try:
|
||||||
conn.login()
|
conn = ftplib.FTP('drop.hardcoded.net')
|
||||||
conn.cwd('/drop')
|
conn.login()
|
||||||
textfp = io.BytesIO(text.encode('utf-8'))
|
conn.cwd('/drop')
|
||||||
cmd = 'STOR report%d.txt' % time.time()
|
textfp = io.BytesIO(text.encode('utf-8'))
|
||||||
conn.storbinary(cmd, textfp)
|
cmd = 'STOR report%d.txt' % time.time()
|
||||||
|
conn.storbinary(cmd, textfp)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning("Couldn't send error report: %s", e)
|
||||||
|
|
||||||
threading.Thread(target=do).start()
|
threading.Thread(target=do).start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user