Import elm enums from the relevent modules, not from package.

This allows python-efl to deprecate this usage in the interest of faster efl.elementary package initialization.
This commit is contained in:
Kai Huuhko 2013-11-19 21:44:28 +02:00
parent a9f57df2b7
commit 9450ea22b9
1 changed files with 16 additions and 9 deletions

View File

@ -20,14 +20,18 @@ try:
import efl.edje as edje import efl.edje as edje
from efl.dbus_mainloop import DBusEcoreMainLoop from efl.dbus_mainloop import DBusEcoreMainLoop
import efl.elementary as elm import efl.elementary as elm
from efl.elementary.window import Window from efl.elementary import ELM_POLICY_QUIT, \
ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
from efl.elementary.window import Window, ELM_WIN_BASIC, \
ELM_WIN_DIALOG_BASIC
from efl.elementary.background import Background from efl.elementary.background import Background
from efl.elementary.box import Box from efl.elementary.box import Box
from efl.elementary.label import Label from efl.elementary.label import Label
from efl.elementary.naviframe import Naviframe from efl.elementary.naviframe import Naviframe
from efl.elementary.popup import Popup from efl.elementary.popup import Popup
from efl.elementary.button import Button from efl.elementary.button import Button
from efl.elementary.scroller import Scroller from efl.elementary.scroller import Scroller, ELM_SCROLLER_POLICY_OFF, \
ELM_SCROLLER_POLICY_AUTO
from efl.elementary.check import Check from efl.elementary.check import Check
from efl.elementary.progressbar import Progressbar from efl.elementary.progressbar import Progressbar
from efl.elementary.genlist import Genlist, GenlistItemClass from efl.elementary.genlist import Genlist, GenlistItemClass
@ -36,13 +40,16 @@ try:
from efl.elementary.entry import Entry from efl.elementary.entry import Entry
from efl.elementary.icon import Icon from efl.elementary.icon import Icon
from efl.elementary.layout import Layout from efl.elementary.layout import Layout
from efl.elementary.theme import Theme
except: except:
import elementary as elm import elementary as elm
import evas, e_dbus, ecore, edje import evas, e_dbus, ecore, edje
from e_dbus import DBusEcoreMainLoop from e_dbus import DBusEcoreMainLoop
from elementary import Window, Background, Box, Label, Naviframe, Popup, \ from elementary import Window, Background, Box, Label, Naviframe, Popup, \
Button, Scroller, Check, Progressbar, Genlist, GenlistItemClass, \ Button, Scroller, Check, Progressbar, Genlist, GenlistItemClass, \
SegmentControl, Frame, Entry, Icon, Layout SegmentControl, Frame, Entry, Icon, Layout, Theme, ELM_WIN_BASIC, \
ELM_WIN_DIALOG_BASIC, ELM_POLICY_QUIT, ELM_SCROLLER_POLICY_OFF, \
ELM_SCROLLER_POLICY_AUTO, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
dbus_ml = DBusEcoreMainLoop() dbus_ml = DBusEcoreMainLoop()
@ -125,8 +132,8 @@ class ObjectView(object):
self.obj = Scroller(parent) self.obj = Scroller(parent)
self.obj.on_del_add(self._deleted) self.obj.on_del_add(self._deleted)
self.obj.size_hint_weight = EXPAND_BOTH self.obj.size_hint_weight = EXPAND_BOTH
self.obj.policy_set(elm.ELM_SCROLLER_POLICY_OFF, self.obj.policy_set(ELM_SCROLLER_POLICY_OFF,
elm.ELM_SCROLLER_POLICY_AUTO) ELM_SCROLLER_POLICY_AUTO)
self.obj.bounce_set(False, True) self.obj.bounce_set(False, True)
self.obj.content_min_limit(True, False) self.obj.content_min_limit(True, False)
@ -1359,7 +1366,7 @@ class Agent(dbus.service.Object):
on_done(response) on_done(response)
w.delete() w.delete()
self.dialog = w = Window("econnman-agent", elm.ELM_WIN_DIALOG_BASIC) self.dialog = w = Window("econnman-agent", ELM_WIN_DIALOG_BASIC)
w.title = "ConnMan Requested Input" w.title = "ConnMan Requested Input"
w.icon_name = "econnman" w.icon_name = "econnman"
w.autodel = True w.autodel = True
@ -1480,13 +1487,13 @@ if __name__ == "__main__":
log.setLevel(level) log.setLevel(level)
elm.init() elm.init()
elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED) elm.policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
for td in ("./data/theme/default.edj", "@PKGDATADIR@/theme/default.edj"): for td in ("./data/theme/default.edj", "@PKGDATADIR@/theme/default.edj"):
if os.path.exists(td): if os.path.exists(td):
elm.theme_extension_add(td) Theme(default=True).extension_add(td)
win = Window("econnman", elm.ELM_WIN_BASIC) win = Window("econnman", ELM_WIN_BASIC)
win.title = "EConnMan" win.title = "EConnMan"
win.icon_name = "econnman" win.icon_name = "econnman"
win.autodel = True win.autodel = True