Add some defines for the sliding parameters

This commit is contained in:
Marco Pesenti Gritti 2006-06-20 03:34:14 -04:00
parent 028b15d3df
commit 7e20f07b6c

View File

@ -3,6 +3,16 @@ pygtk.require('2.0')
import gtk import gtk
import gobject import gobject
SM_SPACE_PROPORTIONAL = 0
SM_STEP = 1
SLIDING_TIMEOUT = 50
SLIDING_MODE = SM_SPACE_PROPORTIONAL
#SLIDING_TIMEOUT = 10
#SLIDING_MODE = SM_STEP
#SLIDING_STEP = 0.05
class WindowManager: class WindowManager:
__managers_list = [] __managers_list = []
@ -94,8 +104,11 @@ class WindowManager:
if self._sliding_pos == 0: if self._sliding_pos == 0:
self._window.show() self._window.show()
if SLIDING_MODE == SM_SPACE_PROPORTIONAL:
space_to_go = 1.0 - self._sliding_pos space_to_go = 1.0 - self._sliding_pos
self._sliding_pos += (space_to_go / 2) self._sliding_pos += (space_to_go / 2)
else:
self._sliding_pos += SLIDING_STEP
if self._sliding_pos > .999: if self._sliding_pos > .999:
self._sliding_pos = 1.0 self._sliding_pos = 1.0
@ -110,8 +123,11 @@ class WindowManager:
def __slide_out_timeout_cb(self): def __slide_out_timeout_cb(self):
self._window.show() self._window.show()
if SLIDING_MODE == SM_SPACE_PROPORTIONAL:
space_to_go = self._sliding_pos space_to_go = self._sliding_pos
self._sliding_pos -= (space_to_go / 2) self._sliding_pos -= (space_to_go / 2)
else:
self._sliding_pos -= SLIDING_STEP
if self._sliding_pos < .001: if self._sliding_pos < .001:
self._sliding_pos = 0 self._sliding_pos = 0
@ -126,11 +142,11 @@ class WindowManager:
def slide_window_in(self): def slide_window_in(self):
self._sliding_pos = 0 self._sliding_pos = 0
gobject.timeout_add(50, self.__slide_in_timeout_cb) gobject.timeout_add(SLIDING_TIMEOUT, self.__slide_in_timeout_cb)
def slide_window_out(self): def slide_window_out(self):
self._sliding_pos = 1.0 self._sliding_pos = 1.0
gobject.timeout_add(50, self.__slide_out_timeout_cb) gobject.timeout_add(SLIDING_TIMEOUT, self.__slide_out_timeout_cb)
def show(self): def show(self):
self._window.show() self._window.show()