Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Move the delay stuff into the main preferences dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
zachtib committed Jun 13, 2011
1 parent f9f829d commit 929a65c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 173 deletions.
7 changes: 1 addition & 6 deletions lookit.desktop
Expand Up @@ -9,7 +9,7 @@ Terminal=false
Type=Application
Categories=Utility;
MimeType=image/gif;image/jpeg;image/png;
X-Ayatana-Desktop-Shortcuts=CaptureArea;CaptureScreen;CaptureActiveWindow;DelayCapture;Preferences;About;
X-Ayatana-Desktop-Shortcuts=CaptureArea;CaptureScreen;CaptureActiveWindow;Preferences;About;

[CaptureArea Shortcut Group]
Name=Capture Area
Expand All @@ -26,11 +26,6 @@ Name=Capture Window
Exec=/usr/bin/lookit --capture-window
TargetEnvironment=Unity

[DelayCapture Shortcut Group]
Name=Delayed Capture
Exec=/usr/bin/lookit --delay-ui
TargetEnvironment=Unity

[Preferences Shortcut Group]
Name=Preferences
Exec=/usr/bin/lookit --preferences
Expand Down
96 changes: 0 additions & 96 deletions src/data/delay.xml

This file was deleted.

54 changes: 48 additions & 6 deletions src/data/pref.xml
Expand Up @@ -7,6 +7,11 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">10</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
</object>
<object class="GtkDialog" id="pref_dialog">
<property name="width_request">400</property>
<property name="height_request">360</property>
Expand Down Expand Up @@ -158,6 +163,43 @@
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Delay:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHScale" id="delayscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
<property name="round_digits">1</property>
<property name="digits">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
<child type="tab">
Expand Down Expand Up @@ -232,12 +274,6 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
Expand Down Expand Up @@ -269,6 +305,12 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
Expand Down
44 changes: 0 additions & 44 deletions src/delay.py

This file was deleted.

Expand Up @@ -44,10 +44,6 @@ LookitButton.prototype = {
this._menuItem.connect('activate', Lang.bind(this, _captureActive));
this.menu.addMenuItem(this._menuItem)

this._menuItem = new PopupMenu.PopupMenuItem('Delay Capture');
this._menuItem.connect('activate', Lang.bind(this, _captureDelay));
this.menu.addMenuItem(this._menuItem)

this._menuItem = new PopupMenu.PopupMenuItem('Preferences');
this._menuItem.connect('activate', Lang.bind(this, _preferences));
this.menu.addMenuItem(this._menuItem)
Expand All @@ -74,10 +70,6 @@ function _captureScreen() {
GLib.spawn_command_line_async('lookit --capture-screen')
}

function _captureDelay() {
GLib.spawn_command_line_async('lookit --delay-ui')
}

function _preferences() {
GLib.spawn_command_line_async('lookit --preferences')
}
Expand Down
4 changes: 0 additions & 4 deletions src/liblookit.py
Expand Up @@ -3,7 +3,6 @@
import time

import about
import delay
import lookitconfig
import preferences
import screencapper
Expand Down Expand Up @@ -63,9 +62,6 @@ def do_capture_screen():
pb = screencapper.capture_screen()
uploader.upload_pixbuf(pb)

def do_delay_ui():
delay.DelayDialog().run()

def do_preferences():
preferences.PrefDialog().run()

Expand Down
5 changes: 0 additions & 5 deletions src/lookit
Expand Up @@ -47,9 +47,6 @@ if __name__ == '__main__':
parser.add_argument('--capture-screen', action='store_const',
const='CAPTURE_SCREEN', dest='command',
help='Capture and upload the entire screen')
parser.add_argument('--delay-ui', action='store_const',
const='DELAY_UI', dest='command',
help='Show the delayed capture dialog')
parser.add_argument('--preferences', action='store_const',
const='SHOW_PREFERENCES', dest='command',
help='Configure Lookit')
Expand Down Expand Up @@ -78,8 +75,6 @@ if __name__ == '__main__':
liblookit.do_capture_window()
elif args.command == 'CAPTURE_SCREEN':
liblookit.do_capture_screen()
elif args.command == 'DELAY_UI':
liblookit.do_delay_ui()
elif args.command == 'SHOW_PREFERENCES':
liblookit.do_preferences()
elif args.command == 'SHOW_ABOUT':
Expand Down
5 changes: 1 addition & 4 deletions src/lookitindicator.py
Expand Up @@ -6,7 +6,7 @@

from liblookit import enum
cmd = enum('CAPTURE_AREA', 'CAPTURE_ACTIVE_WINDOW', 'CAPTURE_SCREEN',
'DELAY_UI', 'SHOW_PREFERENCES', 'SHOW_ABOUT', 'EXIT')
'SHOW_PREFERENCES', 'SHOW_ABOUT', 'EXIT')

class LookitIndicator:

Expand All @@ -21,7 +21,6 @@ def __init__(self):
self.add_menu_item('Capture Area', cmd.CAPTURE_AREA)
self.add_menu_item('Capture Entire Screen', cmd.CAPTURE_SCREEN)
self.add_menu_item('Capture Active Window', cmd.CAPTURE_ACTIVE_WINDOW)
self.add_menu_item('Adjust Delay', cmd.DELAY_UI)
self.add_menu_separator()
self.add_menu_item('Preferences', cmd.SHOW_PREFERENCES)
self.add_menu_item('About', cmd.SHOW_ABOUT)
Expand All @@ -48,8 +47,6 @@ def handle_menu_item(self, widget=None, command=None):
liblookit.do_capture_window()
elif command == cmd.CAPTURE_SCREEN:
liblookit.do_capture_screen()
elif command == cmd.DELAY_UI:
liblookit.do_delay_ui()
elif command == cmd.SHOW_PREFERENCES:
liblookit.do_preferences()
elif command == cmd.SHOW_ABOUT:
Expand Down
3 changes: 3 additions & 0 deletions src/preferences.py
Expand Up @@ -33,6 +33,7 @@ def __init__(self):
self.shortenurl = builder.get_object("shortenurl")
self.savedir = builder.get_object("savedir")
self.autostart = builder.get_object("autostart")
self.delayscale = builder.get_object("delayscale")

self.combobox = builder.get_object("combobox")
connections = gtk.ListStore(str)
Expand Down Expand Up @@ -63,6 +64,7 @@ def run(self):
self.shortenurl.set_active(self.config.getboolean('General', 'shortenurl'))
self.savedir.set_filename(self.config.get('General', 'savedir'))
self.autostart.set_active(self.config.getboolean('General', 'autostart'))
self.delayscale.set_value(self.config.getint('General', 'delay'))
self.capturearea.set_text(self.config.get('Hotkeys', 'capturearea'))
self.capturescreen.set_text(self.config.get('Hotkeys', 'capturescreen'))
self.capturewindow.set_text(self.config.get('Hotkeys', 'capturewindow'))
Expand Down Expand Up @@ -115,6 +117,7 @@ def on_pref_dialog_response(self, widget, data=None):
self.config.set('General', 'shortenurl', self.shortenurl.get_active())
self.config.set('General', 'savedir', self.savedir.get_filename())
self.config.set('General', 'autostart', self.autostart.get_active())
self.config.set('General', 'delay', int(self.delayscale.get_value()))
self.config.set('Hotkeys', 'capturearea', self.capturearea.get_text())
self.config.set('Hotkeys', 'capturescreen', self.capturescreen.get_text())
self.config.set('Hotkeys', 'capturewindow', self.capturewindow.get_text())
Expand Down

0 comments on commit 929a65c

Please sign in to comment.