__pretty_app_name__ = "Multilist"
__app_name__ = "multilist"
-__version__ = "0.3.2"
-__build__ = 1
+__version__ = "0.3.3"
+__build__ = 0
_data_path_ = os.path.join(os.path.expanduser("~"), ".multilist")
__app_magic__ = 0xdeadbeef
_user_logpath_ = "%s/multilist.log" % _data_path_
hildonize_text_entry = _null_hildonize_text_entry
-def _hildon_mark_window_rotatable(window):
- # gtk documentation is unclear whether this does a "=" or a "|="
- window.set_flags(hildon.HILDON_PORTRAIT_MODE_SUPPORT)
-
-
-def _null_mark_window_rotatable(window):
- pass
-
-
-try:
- hildon.HILDON_PORTRAIT_MODE_SUPPORT
- mark_window_rotatable = _hildon_mark_window_rotatable
-except AttributeError:
- mark_window_rotatable = _null_mark_window_rotatable
-
-
def _hildon_window_to_portrait(window):
# gtk documentation is unclear whether this does a "=" or a "|="
- window.set_flags(hildon.HILDON_PORTRAIT_MODE_SUPPORT)
+ flags = hildon.PORTRAIT_MODE_SUPPORT | hildon.PORTRAIT_MODE_REQUEST
+ hildon.hildon_gtk_window_set_portrait_flags(window, flags)
def _hildon_window_to_landscape(window):
# gtk documentation is unclear whether this does a "=" or a "&= ~"
- window.unset_flags(hildon.HILDON_PORTRAIT_MODE_REQUEST)
+ flags = hildon.PORTRAIT_MODE_SUPPORT
+ hildon.hildon_gtk_window_set_portrait_flags(window, flags)
def _null_window_to_portrait(window):
try:
- hildon.HILDON_PORTRAIT_MODE_SUPPORT
- hildon.HILDON_PORTRAIT_MODE_REQUEST
+ hildon.PORTRAIT_MODE_SUPPORT
+ hildon.PORTRAIT_MODE_REQUEST
+ hildon.hildon_gtk_window_set_portrait_flags
window_to_portrait = _hildon_window_to_portrait
window_to_landscape = _hildon_window_to_landscape
button.connect("clicked", self.del_item, None)
buttonHBox.pack_start(button, expand = True, fill = True, padding = 3)
+ def set_orientation(self, orientation):
+ if orientation == gtk.ORIENTATION_HORIZONTAL:
+ pass
+ elif orientation == gtk.ORIENTATION_VERTICAL:
+ pass
+ else:
+ raise NotImplementedError(orientation)
+
@gtk_toolbox.log_exception(_moduleLogger)
def new_item(self, widget = None, data1 = None, data2 = None):
window = gtk_toolbox.find_parent_window(self)
_moduleLogger.info("libSelection, init")
- label = gtk.Label(_("List:"))
- self.pack_start(label, expand = False, fill = True, padding = 0)
+ self.__listLabel = gtk.Label(_("List:"))
+ self.pack_start(self.__listLabel, expand = False, fill = True, padding = 0)
self.__lists = []
self.__listButton = gtk.Button("")
self.__listButton.connect("clicked", self._on_list_selector)
self.pack_start(self.__listButton, expand = True, fill = True, padding = 0)
- label = gtk.Label(_(" Category:"))
- self.pack_start(label, expand = False, fill = True, padding = 0)
+ self.__catLabel = gtk.Label(_(" Category:"))
+ self.pack_start(self.__catLabel, expand = False, fill = True, padding = 0)
self.__categories = []
self.__categoryButton = gtk.Button("")
self.__categoryButton.connect("clicked", self._on_category_selector)
self.pack_start(self.__categoryButton, expand = True, fill = True, padding = 0)
+ def set_orientation(self, orientation):
+ if orientation == gtk.ORIENTATION_HORIZONTAL:
+ self.__listLabel.show()
+ self.__catLabel.show()
+ elif orientation == gtk.ORIENTATION_VERTICAL:
+ self.__listLabel.hide()
+ self.__catLabel.hide()
+ else:
+ raise NotImplementedError(orientation)
+
def load(self):
del self.__lists[:]
@gtk_toolbox.log_exception(_moduleLogger)
def do_set_property(self, property, value):
- if getattr(self, property.name) == value:
+ if getattr(self, property.name) == value or value is None:
return
setattr(self, property.name, value)
self.db = libspeichern.Speichern()
self.window_in_fullscreen = False #The window isn't in full screen mode initially.
+ self.__isLandscape = True
#Haupt vbox für alle Elemente
self.window = gtk.Window()
else:
self._search.show()
+ def set_orientation(self, orientation):
+ if orientation == gtk.ORIENTATION_VERTICAL:
+ hildonize.window_to_portrait(self.window)
+ self.bottombar.set_orientation(gtk.ORIENTATION_VERTICAL)
+ self.selection.set_orientation(gtk.ORIENTATION_VERTICAL)
+ self.__isLandscape = False
+ elif orientation == gtk.ORIENTATION_HORIZONTAL:
+ hildonize.window_to_landscape(self.window)
+ self.bottombar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
+ self.selection.set_orientation(gtk.ORIENTATION_HORIZONTAL)
+ self.__isLandscape = True
+ else:
+ raise NotImplementedError(orientation)
+
+ def get_orientation(self):
+ return gtk.ORIENTATION_HORIZONTAL if self.__isLandscape else gtk.ORIENTATION_VERTICAL
+
+ def _toggle_rotate(self):
+ if self.__isLandscape:
+ self.set_orientation(gtk.ORIENTATION_VERTICAL)
+ else:
+ self.set_orientation(gtk.ORIENTATION_HORIZONTAL)
+
@gtk_toolbox.log_exception(_moduleLogger)
def _on_checkout_all(self, widget):
self.liststorehandler.checkout_rows()
else:
self.window.fullscreen ()
return True
+ elif event.keyval == gtk.keysyms.r and isCtrl:
+ self._toggle_rotate()
+ return True
elif event.keyval == gtk.keysyms.f and isCtrl:
self._toggle_search()
return True
__version__ = constants.__version__
__build__ = constants.__build__
__changelog__ = """
+0.3.3
+* Rotation support
+
0.3.2
* Massive code cleanup
* Re-arrangement of GTK Menus