Beispiel #1
0
    def updateDisplay(self):
        """Update window display from settings."""
        self.launchAtStartup.setState_(get_pref('launchAtStartup'))
        self.iconset.selectCellWithTag_(1 if get_pref('iconset') ==
                                        'grayscale' else 0)

        self.randomize.setState_(get_pref('randomize'))
        self.copyonly.setState_(get_pref('copyonly'))
        self.copyonly.setState_(get_pref('retinascale'))

        dropboxdir = detect_dropbox_folder()
        self.dropboxdir.setStringValue_(dropboxdir
                                        or u'None. Install Dropbox?')
        self.dropboxid.setStringValue_(get_pref('dropboxid'))

        customurl = get_pref('customurl')
        if not customurl:  # Default.
            self.url_select.selectCellWithTag_(0)
            self.url_text.setEnabled_(False)
            self.url_text.setStringValue_('')
            self.url_example.setStringValue_(
                share_url(EXAMPLE_FILENAME, url=''))
        else:  # Custom.
            self.url_select.selectCellWithTag_(1)
            self.url_text.setEnabled_(True)
            self.url_text.setStringValue_(customurl)
            self.url_example.setStringValue_(
                share_url(EXAMPLE_FILENAME, url=customurl))
Beispiel #2
0
    def updateDisplay(self):
        """Update window display from settings."""
        self.launchAtStartup.setState_(get_pref('launchAtStartup'))
        self.iconset.selectCellWithTag_(
            1 if get_pref('iconset') == 'grayscale' else 0)

        self.randomize.setState_(get_pref('randomize'))
        self.copyonly.setState_(get_pref('copyonly'))
        self.copyonly.setState_(get_pref('retinascale'))

        dropboxdir = detect_dropbox_folder()
        self.dropboxdir.setStringValue_(
            dropboxdir or u'None. Install Dropbox?')
        self.dropboxid.setStringValue_(get_pref('dropboxid'))

        customurl = get_pref('customurl')
        if not customurl:  # Default.
            self.url_select.selectCellWithTag_(0)
            self.url_text.setEnabled_(False)
            self.url_text.setStringValue_('')
            self.url_example.setStringValue_(share_url(EXAMPLE_FILENAME,
                                                       url=''))
        else:  # Custom.
            self.url_select.selectCellWithTag_(1)
            self.url_text.setEnabled_(True)
            self.url_text.setStringValue_(customurl)
            self.url_example.setStringValue_(share_url(EXAMPLE_FILENAME,
                                                       url=customurl))
Beispiel #3
0
    def updateDisplay(self):
        """Update window display from settings."""
        self.randomize.setState_(get_pref('randomize'))
        self.copyonly.setState_(get_pref('copyonly'))
        self.launchAtStartup.setState_(get_pref('launchAtStartup'))

        dropboxdir = detect_dropbox_folder()
        self.dropboxdir.setStringValue_(dropboxdir
                                        or u'None. Install Dropbox?')
        self.dropboxid.setStringValue_(get_pref('dropboxid'))
Beispiel #4
0
    def updateDisplay(self):
        """Update window display from settings."""
        self.randomize.setState_(get_pref('randomize'))
        self.copyonly.setState_(get_pref('copyonly'))
        self.launchAtStartup.setState_(get_pref('launchAtStartup'))

        dropboxdir = detect_dropbox_folder()
        self.dropboxdir.setStringValue_(
            dropboxdir or u'None. Install Dropbox?')
        self.dropboxid.setStringValue_(get_pref('dropboxid'))
Beispiel #5
0
    def updateDisplay(self):
        """Update window display from settings."""
        self.launchAtStartup.setState_(get_pref("launchAtStartup"))
        self.iconset.selectCellWithTag_(1 if get_pref("iconset") == "grayscale" else 0)

        self.randomize.setState_(get_pref("randomize"))
        self.copyonly.setState_(get_pref("copyonly"))

        dropboxdir = detect_dropbox_folder()
        self.dropboxdir.setStringValue_(dropboxdir or u"None. Install Dropbox?")
        self.dropboxid.setStringValue_(get_pref("dropboxid"))

        customurl = get_pref("customurl")
        if not customurl:  # Default.
            self.url_select.selectCellWithTag_(0)
            self.url_text.setEnabled_(False)
            self.url_text.setStringValue_("")
            self.url_example.setStringValue_(share_url(EXAMPLE_FILENAME, url=""))
        else:  # Custom.
            self.url_select.selectCellWithTag_(1)
            self.url_text.setEnabled_(True)
            self.url_text.setStringValue_(customurl)
            self.url_example.setStringValue_(share_url(EXAMPLE_FILENAME, url=customurl))
Beispiel #6
0
from AppKit import *
from PyObjCTools import AppHelper

from watchdog.events import FileCreatedEvent, FileMovedEvent, FileSystemEventHandler
from watchdog.observers import Observer

import Preferences
from lib import utils
from lib.notifications import Growler
from lib.windows import alert

SCREENSHOT_DIR = utils.get_pref(domain='com.apple.screencapture',
                                key='location',
                                default=os.path.join(os.environ['HOME'],
                                                     'Desktop'))
DROPBOX_DIR = utils.detect_dropbox_folder()
PUBLIC_DIR = os.path.join(DROPBOX_DIR or '', 'Public')
SHARE_DIR = os.path.join(PUBLIC_DIR, 'Screenshots')

HOMEPAGE_URL = 'http://upshot.it'
DROPBOX_PUBLIC_INFO = 'https://www.dropbox.com/help/16'

TIME_THRESHOLD = 15  # How many seconds after creation do we handle a file?

# Set up logging
LOG_LEVEL = logging.DEBUG
logging.basicConfig(level=LOG_LEVEL)
log = logging.getLogger('upshot')

# Local settings
try:
Beispiel #7
0
from PyObjCTools import AppHelper

from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer

import DropboxDetect
import Preferences
from lib import utils
from lib.notifications import Growler
from lib.windows import alert


SCREENSHOT_DIR = utils.get_pref(
    domain='com.apple.screencapture', key='location',
    default=os.path.join(os.environ['HOME'], 'Desktop'))
DROPBOX_DIR = utils.detect_dropbox_folder()
SHARE_DIR = os.path.join(DROPBOX_DIR or '', 'Public', 'Screenshots')

HOMEPAGE_URL = 'http://github.com/fwenzel/upshot'

SHARE_URL = 'http://dl.dropbox.com/u/{dropboxid}/Screenshots/'

# Set up logging
LOG_LEVEL = logging.DEBUG
logging.basicConfig(level=LOG_LEVEL)
log = logging.getLogger('upshot')

# Local settings
try:
    from settings_local import *
except ImportError:
Beispiel #8
0
 def openDropboxFolder_(self, sender):
     sw = NSWorkspace.sharedWorkspace()
     sw.openFile_(os.path.join(detect_dropbox_folder(), 'Public'))
Beispiel #9
0
 def openDropboxFolder_(self, sender):
     sw = NSWorkspace.sharedWorkspace()
     sw.openFile_(os.path.join(detect_dropbox_folder(), 'Public'))