All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] More fixes for Hob
@ 2012-03-22 15:37 Shane Wang
  2012-03-22 15:38 ` [PATCH 1/8] command.py: Change parseConfigurationFiles API from async to sync Shane Wang
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:37 UTC (permalink / raw)
  To: bitbake-devel

These patches are to:
  - change parse_config API from async to sync for image types and remembering layers
  - fix the image types
  - add proxy support
  - remember settings and layers between Hob runs with template
  - fix two UI bugs in the build log screen
  - extend the timeout for piping.
  - etc.

The following changes since commit 8dda137c12d284304a5b3e6693732b00f2b5553f:

  Hob: Revert interfaces of callbacks for layer_button, view_recipes_button, and view_packages_button. (2012-03-22 14:43:51 +0000)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib shane/hob-fixes-continue
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=shane/hob-fixes-continue

Dongxiao Xu (4):
  command.py: Change parseConfigurationFiles API from async to sync
  process.py: Increase the timeout value for polling commands
  Hob: Change parseConfigurationFiles API usage
  Hob: Fix the workaround to get image types

Liming An (2):
  Hob: reset the policy to forbid the horizontal scrolling for building
    log
  Hob: add auto scroll to rows which be new appended in hob building
    log page

Shane Wang (2):
  Hob: allow users to setup the proxies
  Hob: remember the settings between Hob sessions

 bitbake/lib/bb/command.py                    |   17 ++--
 bitbake/lib/bb/server/process.py             |    2 +-
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   17 +++-
 bitbake/lib/bb/ui/crumbs/builder.py          |  139 +++++++++++++++++++++++--
 bitbake/lib/bb/ui/crumbs/hig.py              |   94 +++++++++++++++--
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py  |   28 ++++--
 bitbake/lib/bb/ui/crumbs/hobwidget.py        |   24 +++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py     |    7 +-
 bitbake/lib/bb/ui/crumbs/template.py         |   55 +++++++---
 bitbake/lib/bb/ui/hob.py                     |    3 +-
 10 files changed, 319 insertions(+), 67 deletions(-)

-- 
1.7.6




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] command.py: Change parseConfigurationFiles API from async to sync
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 2/8] process.py: Increase the timeout value for polling commands Shane Wang
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Dongxiao Xu <dongxiao.xu@intel.com>

parseConfigurationFiles will not cost much time and move it to the
CommandSync class.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 bitbake/lib/bb/command.py |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 1799f1c..febc90f 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -186,6 +186,14 @@ class CommandsSync:
         event = params[0]
         bb.event.fire(eval(event), command.cooker.configuration.data)
 
+    def parseConfigurationFiles(self, command, params):
+        """
+        Parse the configuration files
+        """
+        prefiles = params[0]
+        postfiles = params[1]
+        command.cooker.parseConfigurationFiles(prefiles, postfiles)
+
 class CommandsAsync:
     """
     A class of asynchronous commands
@@ -350,12 +358,3 @@ class CommandsAsync:
             command.finishAsyncCommand()
     compareRevisions.needcache = True
 
-    def parseConfigurationFiles(self, command, params):
-        """
-        Parse the configuration files
-        """
-        prefiles = params[0]
-        postfiles = params[1]
-        command.cooker.parseConfigurationFiles(prefiles, postfiles)
-        command.finishAsyncCommand()
-    parseConfigurationFiles.needcache = False
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] process.py: Increase the timeout value for polling commands
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
  2012-03-22 15:38 ` [PATCH 1/8] command.py: Change parseConfigurationFiles API from async to sync Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 3/8] Hob: Change parseConfigurationFiles API usage Shane Wang
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Dongxiao Xu <dongxiao.xu@intel.com>

The parseConfigurationFiles commands needs more time for piping,
thus change the polling timeout value from 0.5s to 1s.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 bitbake/lib/bb/server/process.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index ba91336..946af05 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -45,7 +45,7 @@ class ServerCommunicator():
         while True:
             # don't let the user ctrl-c while we're waiting for a response
             try:
-                if self.connection.poll(.5):
+                if self.connection.poll(1):
                     return self.connection.recv()
                 else:
                     return None
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] Hob: Change parseConfigurationFiles API usage
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
  2012-03-22 15:38 ` [PATCH 1/8] command.py: Change parseConfigurationFiles API from async to sync Shane Wang
  2012-03-22 15:38 ` [PATCH 2/8] process.py: Increase the timeout value for polling commands Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 4/8] Hob: Fix the workaround to get image types Shane Wang
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Dongxiao Xu <dongxiao.xu@intel.com>

parseConfigurationFiles API is changed to sync mode, therefore make
accordingly changes in Hob part.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 07cc039..e9d10c5 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -62,7 +62,7 @@ class HobHandler(gobject.GObject):
                                      (gobject.TYPE_PYOBJECT,)),
     }
 
-    (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_CONFIG, PARSE_BBFILES, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(13)
+    (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_BBFILES, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(12)
     (LAYERS_REFRESH, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)
 
     def __init__(self, server, recipe_model, package_model):
@@ -134,8 +134,6 @@ class HobHandler(gobject.GObject):
             self.server.runCommand(["findConfigFiles", "MACHINE-SDK"])
         elif next_command == self.FILES_MATCH_CLASS:
             self.server.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
-        elif next_command == self.PARSE_CONFIG:
-            self.server.runCommand(["parseConfigurationFiles", "", ""])
         elif next_command == self.PARSE_BBFILES:
             self.server.runCommand(["parseFiles"])
         elif next_command == self.GENERATE_TGTS:
@@ -265,10 +263,13 @@ class HobHandler(gobject.GObject):
     def init_cooker(self):
         self.server.runCommand(["initCooker"])
 
+    def parse_config(self):
+        self.server.runCommand(["parseConfigurationFiles", "", ""])
+
     def refresh_layers(self, bblayers):
         self.server.runCommand(["initCooker"])
         self.server.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)])
-        self.commands_async.append(self.PARSE_CONFIG)
+        self.parse_config()
         self.commands_async.append(self.CFG_FILES_DISTRO)
         self.commands_async.append(self.CFG_FILES_MACH)
         self.commands_async.append(self.CFG_FILES_SDKMACH)
@@ -336,7 +337,7 @@ class HobHandler(gobject.GObject):
         self.run_next_command(self.POPULATE_PACKAGEINFO)
 
     def generate_recipes(self):
-        self.commands_async.append(self.PARSE_CONFIG)
+        self.parse_config()
         self.commands_async.append(self.GENERATE_TGTS)
         self.run_next_command(self.GENERATE_RECIPES)
                  
@@ -344,7 +345,7 @@ class HobHandler(gobject.GObject):
         targets = []
         targets.extend(tgts)
         self.recipe_queue = targets
-        self.commands_async.append(self.PARSE_CONFIG)
+        self.parse_config()
         self.commands_async.append(self.PARSE_BBFILES)
         self.commands_async.append(self.BUILD_TARGET_RECIPES)
         self.run_next_command(self.GENERATE_PACKAGES)
@@ -352,7 +353,7 @@ class HobHandler(gobject.GObject):
     def generate_image(self, tgts, toolchain_build=False):
         self.package_queue = tgts
         self.toolchain_build = toolchain_build
-        self.commands_async.append(self.PARSE_CONFIG)
+        self.parse_config()
         self.commands_async.append(self.PARSE_BBFILES)
         self.commands_async.append(self.BUILD_TARGET_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] Hob: Fix the workaround to get image types
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
                   ` (2 preceding siblings ...)
  2012-03-22 15:38 ` [PATCH 3/8] Hob: Change parseConfigurationFiles API usage Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 5/8] Hob: allow users to setup the proxies Shane Wang
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Dongxiao Xu <dongxiao.xu@intel.com>

Inherit image_types.bbclass before getting parameters to fix the
original workaround.

Besides, kick the handler things off after Builder is initialized.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    8 ++++++--
 bitbake/lib/bb/ui/hob.py                    |    3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index e9d10c5..fe7b5d5 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -379,6 +379,11 @@ class HobHandler(gobject.GObject):
         self.build.reset()
 
     def get_parameters(self):
+        # inherit image_types.bbclass
+        self.init_cooker()
+        self.set_extra_inherit("image_types")
+        self.parse_config()
+    
         # retrieve the parameters from bitbake
         params = {}
         params["core_base"] = self.server.runCommand(["getVariable", "COREBASE"]) or ""
@@ -444,8 +449,7 @@ class HobHandler(gobject.GObject):
 
         params["image_fstypes"] = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"]) or ""
 
-        # walkaround
-        params["image_types"] = " ".join(hcc.SUPPORTED_IMAGE_TYPES.keys()).lstrip(" ")
+        params["image_types"] = self.server.runCommand(["getVariable", "IMAGE_TYPES"]) or ""
 
         params["conf_version"] = self.server.runCommand(["getVariable", "CONF_VERSION"]) or ""
         params["lconf_version"] = self.server.runCommand(["getVariable", "LCONF_VERSION"]) or ""
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index daa708b..4c3e572 100755
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -56,9 +56,10 @@ def main (server = None, eventHandler = None):
     package_model = PackageListModel()
 
     hobHandler = HobHandler(server, recipe_model, package_model)
+    builder = Builder(hobHandler, recipe_model, package_model)
+
     if hobHandler.kick() == False:
         return 1
-    builder = Builder(hobHandler, recipe_model, package_model)
 
     # This timeout function regularly probes the event queue to find out if we
     # have any messages waiting for us.
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] Hob: allow users to setup the proxies
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
                   ` (3 preceding siblings ...)
  2012-03-22 15:38 ` [PATCH 4/8] Hob: Fix the workaround to get image types Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 6/8] Hob: remember the settings between Hob sessions Shane Wang
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

This patch is to set os.environ to allow users to set the environment variables for all_proxy, http_proxy, https_proxy and ftp_proxy.

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py |   52 +++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/hig.py     |   94 ++++++++++++++++++++++++++++++----
 2 files changed, 135 insertions(+), 11 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 5a292e7..12bfc59 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -39,6 +39,7 @@ from bb.ui.crumbs.hig import CrumbsMessageDialog, BinbDialog, \
 
 class Configuration:
     '''Represents the data structure of configuration.'''
+    __dummy_proxy__ = "myproxy.example.com:8010"
 
     def __init__(self, params):
         # Settings
@@ -67,6 +68,25 @@ class Configuration:
         self.selected_recipes = []
         self.selected_packages = []
 
+        # proxy settings
+        self.all_proxy = self.get_os_proxy("all_proxy")
+        self.http_proxy = self.get_os_proxy("http_proxy")
+        self.ftp_proxy = self.get_os_proxy("ftp_proxy")
+        self.https_proxy = self.get_os_proxy("https_proxy")
+        self.enable_proxy = False
+
+    def get_os_proxy(self, proxy_key):
+        if proxy_key in os.environ.keys():
+            return os.environ[proxy_key]
+        return self.__dummy_proxy__
+
+    def set_os_proxy(self, proxy_key, proxy):
+        if (not proxy or proxy.lstrip() == "" or proxy == self.__dummy_proxy__) \
+            and proxy_key in os.environ.keys():
+            del os.environ[proxy_key]
+        else:
+            os.environ[proxy_key] = proxy
+
     def load(self, template):
         self.curr_mach = template.getVar("MACHINE")
         self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip()
@@ -92,6 +112,12 @@ class Configuration:
         self.selected_image = template.getVar("__SELECTED_IMAGE__")
         self.selected_recipes = template.getVar("DEPENDS").split()
         self.selected_packages = template.getVar("IMAGE_INSTALL").split()
+        # proxy
+        self.all_proxy = template.getVar("all_proxy")
+        self.http_proxy = template.getVar("http_proxy")
+        self.ftp_proxy = template.getVar("ftp_proxy")
+        self.https_proxy = template.getVar("https_proxy")
+        self.enable_proxy = (template.getVar("enable_proxy") == "True")
 
     def save(self, template, filename):
         # bblayers.conf
@@ -119,6 +145,12 @@ class Configuration:
         template.setVar("__SELECTED_IMAGE__", self.selected_image)
         template.setVar("DEPENDS", self.selected_recipes)
         template.setVar("IMAGE_INSTALL", self.selected_packages)
+        # proxy
+        template.setVar("all_proxy", self.all_proxy)
+        template.setVar("http_proxy", self.http_proxy)
+        template.setVar("ftp_proxy", self.ftp_proxy)
+        template.setVar("https_proxy", self.https_proxy)
+        template.setVar("enable_proxy", ("%s" % self.enable_proxy))
 
 class Parameters:
     '''Represents other variables like available machines, etc.'''
@@ -732,6 +764,13 @@ class Builder(gtk.Window):
 
         dialog.destroy()
 
+    def _setup_proxy(self):
+        if self.configuration.enable_proxy:
+            self.configuration.set_os_proxy("all_proxy", self.configuration.all_proxy)
+            self.configuration.set_os_proxy("http_proxy", self.configuration.http_proxy)
+            self.configuration.set_os_proxy("https_proxy", self.configuration.https_proxy)
+            self.configuration.set_os_proxy("ftp_proxy", self.configuration.ftp_proxy)
+
     def show_adv_settings_dialog(self):
         dialog = AdvancedSettingDialog(title = "Settings",
             configuration = copy.deepcopy(self.configuration),
@@ -740,6 +779,11 @@ class Builder(gtk.Window):
             all_distros = self.parameters.all_distros,
             all_sdk_machines = self.parameters.all_sdk_machines,
             max_threads = self.parameters.max_threads,
+            all_proxy = self.configuration.all_proxy,
+            http_proxy = self.configuration.http_proxy,
+            https_proxy = self.configuration.https_proxy,
+            ftp_proxy = self.configuration.ftp_proxy,
+            enable_proxy = self.configuration.enable_proxy,
             parent = self,
             flags = gtk.DIALOG_MODAL
                     | gtk.DIALOG_DESTROY_WITH_PARENT
@@ -749,6 +793,14 @@ class Builder(gtk.Window):
         response = dialog.run()
         if response == gtk.RESPONSE_YES:
             self.configuration = dialog.configuration
+            # setup the proxy
+            self.configuration.enable_proxy = dialog.enable_proxy
+            if self.configuration.enable_proxy:
+                self.configuration.all_proxy = dialog.all_proxy
+                self.configuration.http_proxy = dialog.http_proxy
+                self.configuration.https_proxy = dialog.https_proxy
+                self.configuration.ftp_proxy = dialog.ftp_proxy
+                self._setup_proxy()
             # DO reparse recipes
             if dialog.settings_changed:
                 if self.configuration.curr_mach == "":
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 652226c..b555196 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -170,20 +170,23 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         dialog.destroy()
 
-    def gen_entry_widget(self, content, parent, tooltip=""):
+    def gen_entry_widget(self, content, parent, tooltip="", need_button=True):
         hbox = gtk.HBox(False, 12)
         entry = gtk.Entry()
         entry.set_text(content)
 
-        table = gtk.Table(1, 10, True)
-        hbox.pack_start(table, expand=True, fill=True)
-        table.attach(entry, 0, 9, 0, 1)
-        image = gtk.Image()
-        image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
-        open_button = gtk.Button()
-        open_button.set_image(image)
-        open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
-        table.attach(open_button, 9, 10, 0, 1)
+        if need_button:
+            table = gtk.Table(1, 10, True)
+            hbox.pack_start(table, expand=True, fill=True)
+            table.attach(entry, 0, 9, 0, 1)
+            image = gtk.Image()
+            image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
+            open_button = gtk.Button()
+            open_button.set_image(image)
+            open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
+            table.attach(open_button, 9, 10, 0, 1)
+        else:
+            hbox.pack_start(entry, expand=True, fill=True)
 
         info = HobInfoButton(tooltip, self)
         hbox.pack_start(info, expand=False, fill=False)
@@ -330,7 +333,8 @@ class AdvancedSettingDialog (CrumbsDialog):
 
     def __init__(self, title, configuration, all_image_types,
             all_package_formats, all_distros, all_sdk_machines,
-            max_threads, parent, flags, buttons):
+            max_threads, all_proxy, http_proxy, https_proxy, ftp_proxy,
+            enable_proxy, parent, flags, buttons):
         super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
 
         # class members from other objects
@@ -341,6 +345,11 @@ class AdvancedSettingDialog (CrumbsDialog):
         self.all_distros = all_distros
         self.all_sdk_machines = all_sdk_machines
         self.max_threads = max_threads
+        self.all_proxy = all_proxy
+        self.http_proxy = http_proxy
+        self.https_proxy = https_proxy
+        self.ftp_proxy = ftp_proxy
+        self.enable_proxy = enable_proxy
 
         # class members for internal use
         self.distro_combo = None
@@ -375,6 +384,7 @@ class AdvancedSettingDialog (CrumbsDialog):
         self.nb.append_page(self.create_image_types_page(), gtk.Label("Image types"))
         self.nb.append_page(self.create_output_page(), gtk.Label("Output"))
         self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment"))
+        self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies"))
         self.nb.append_page(self.create_others_page(), gtk.Label("Others"))
         self.nb.set_current_page(0)
         self.vbox.pack_start(self.nb, expand=True, fill=True)
@@ -515,6 +525,52 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         return advanced_vbox
 
+    def create_proxy_page(self):
+        advanced_vbox = gtk.VBox(False, 6)
+        advanced_vbox.set_border_width(6)
+
+        sub_vbox = gtk.VBox(False, 6)
+        advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
+        self.proxy_checkbox = gtk.CheckButton("Enable Proxy")
+        self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified")
+        self.proxy_checkbox.set_active(self.enable_proxy)
+        self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
+        sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False)
+
+        label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>")
+        tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified."
+        proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.split_model, self.all_proxy, self, tooltip, False)
+        self.all_proxy_text.set_editable(self.enable_proxy)
+        self.all_proxy_text.set_sensitive(self.enable_proxy)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
+
+        label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>")
+        tooltip = "Set the http proxy that will be used in do_fetch() source code"
+        proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.split_model, self.http_proxy, self, tooltip, False)
+        self.http_proxy_text.set_editable(self.enable_proxy)
+        self.http_proxy_text.set_sensitive(self.enable_proxy)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
+
+        label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>")
+        tooltip = "Set the https proxy that will be used in do_fetch() source code"
+        proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.split_model, self.https_proxy, self, tooltip, False)
+        self.https_proxy_text.set_editable(self.enable_proxy)
+        self.https_proxy_text.set_sensitive(self.enable_proxy)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
+
+        label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>")
+        tooltip = "Set the ftp proxy that will be used in do_fetch() source code"
+        proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.split_model, self.ftp_proxy, self, tooltip, False)
+        self.ftp_proxy_text.set_editable(self.enable_proxy)
+        self.ftp_proxy_text.set_sensitive(self.enable_proxy)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
+
+        return advanced_vbox
+
     def create_others_page(self):
         advanced_vbox = gtk.VBox(False, 6)
         advanced_vbox.set_border_width(6)
@@ -529,6 +585,17 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         return advanced_vbox
 
+    def proxy_checkbox_toggled_cb(self, button):
+        self.enable_proxy = self.proxy_checkbox.get_active()
+        self.all_proxy_text.set_editable(self.enable_proxy)
+        self.all_proxy_text.set_sensitive(self.enable_proxy)
+        self.http_proxy_text.set_editable(self.enable_proxy)
+        self.http_proxy_text.set_sensitive(self.enable_proxy)
+        self.https_proxy_text.set_editable(self.enable_proxy)
+        self.https_proxy_text.set_sensitive(self.enable_proxy)
+        self.ftp_proxy_text.set_editable(self.enable_proxy)
+        self.ftp_proxy_text.set_sensitive(self.enable_proxy)
+
     def response_cb(self, dialog, response_id):
         self.variables = {}
 
@@ -576,6 +643,11 @@ class AdvancedSettingDialog (CrumbsDialog):
             self.variables[key] = value
             it = self.setting_store.iter_next(it)
 
+        self.all_proxy = self.all_proxy_text.get_text()
+        self.http_proxy = self.http_proxy_text.get_text()
+        self.https_proxy = self.https_proxy_text.get_text()
+        self.ftp_proxy = self.ftp_proxy_text.get_text()
+
         md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest()
         self.settings_changed = (self.md5 != md5)
 
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] Hob: remember the settings between Hob sessions
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
                   ` (4 preceding siblings ...)
  2012-03-22 15:38 ` [PATCH 5/8] Hob: allow users to setup the proxies Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 7/8] Hob: reset the policy to forbid the horizontal scrolling for building log Shane Wang
  2012-03-22 15:38 ` [PATCH 8/8] Hob: add auto scroll to rows which be new appended in hob building log page Shane Wang
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

This patch is to add support to remember and restore the settings between different Hob sessions.
The settings include:
 - Layers
 - Settings including proxies

[Yocto #2113]

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py         |  125 ++++++++++++++++++++-------
 bitbake/lib/bb/ui/crumbs/hig.py             |    8 +-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    5 +-
 bitbake/lib/bb/ui/crumbs/template.py        |   55 ++++++++----
 4 files changed, 141 insertions(+), 52 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 12bfc59..9c6392a 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -87,8 +87,27 @@ class Configuration:
         else:
             os.environ[proxy_key] = proxy
 
+    def _setup_proxy(self):
+        if self.enable_proxy:
+            self.set_os_proxy("all_proxy", self.all_proxy)
+            self.set_os_proxy("http_proxy", self.http_proxy)
+            self.set_os_proxy("https_proxy", self.https_proxy)
+            self.set_os_proxy("ftp_proxy", self.ftp_proxy)
+
     def load(self, template):
+        self.load_machine(template)
+        self.load_configuration(template)
+        self.load_layers(template)
+        self.load_image(template)
+
+    def load_settings_only(self, template):
+        self.load_configuration(template)
+        self.load_layers(template)
+
+    def load_machine(self, template):
         self.curr_mach = template.getVar("MACHINE")
+
+    def load_configuration(self, template):
         self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip()
         self.curr_distro = template.getVar("DISTRO")
         self.dldir = template.getVar("DL_DIR")
@@ -98,7 +117,7 @@ class Configuration:
         self.bbthread = int(template.getVar("BB_NUMBER_THREAD"))
         self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
         self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
-        # image_overhead_factor is read-only.
+            # image_overhead_factor is read-only.
         self.incompat_license = template.getVar("INCOMPATIBLE_LICENSE")
         self.curr_sdk_machine = template.getVar("SDKMACHINE")
         self.conf_version = template.getVar("CONF_VERSION")
@@ -106,24 +125,43 @@ class Configuration:
         self.extra_setting = eval(template.getVar("EXTRA_SETTING"))
         self.toolchain_build = eval(template.getVar("TOOLCHAIN_BUILD"))
         self.image_fstypes = template.getVar("IMAGE_FSTYPES").split()
-        # bblayers.conf
-        self.layers = template.getVar("BBLAYERS").split()
-        # image/recipes/packages
-        self.selected_image = template.getVar("__SELECTED_IMAGE__")
-        self.selected_recipes = template.getVar("DEPENDS").split()
-        self.selected_packages = template.getVar("IMAGE_INSTALL").split()
         # proxy
         self.all_proxy = template.getVar("all_proxy")
         self.http_proxy = template.getVar("http_proxy")
         self.ftp_proxy = template.getVar("ftp_proxy")
         self.https_proxy = template.getVar("https_proxy")
         self.enable_proxy = (template.getVar("enable_proxy") == "True")
+        self._setup_proxy()
+
+    def load_layers(self, template):
+        # bblayers.conf
+        self.layers = template.getVar("BBLAYERS").split()
+
+    def load_image(self, template):
+        # image/recipes/packages
+        self.selected_image = template.getVar("__SELECTED_IMAGE__")
+        self.selected_recipes = template.getVar("DEPENDS").split()
+        self.selected_packages = template.getVar("IMAGE_INSTALL").split()
 
     def save(self, template, filename):
+        self.save_machine(template)
+        self.save_configuration(template)
+        self.save_layers(template)
+        self.save_image(template)
+
+    def save_settings_only(self, template):
+        self.save_configuration(template)
+        self.save_layers(template)
+
+    def save_layers(self, template):
         # bblayers.conf
         template.setVar("BBLAYERS", " ".join(self.layers))
+
+    def save_machine(self, template):
         # local.conf
         template.setVar("MACHINE", self.curr_mach)
+
+    def save_configuration(self, template):
         template.setVar("DISTRO", self.curr_distro)
         template.setVar("DL_DIR", self.dldir)
         template.setVar("SSTATE_DIR", self.sstatedir)
@@ -140,11 +178,6 @@ class Configuration:
         template.setVar("EXTRA_SETTING", self.extra_setting)
         template.setVar("TOOLCHAIN_BUILD", self.toolchain_build)
         template.setVar("IMAGE_FSTYPES", " ".join(self.image_fstypes).lstrip(" "))
-        # image/recipes/packages
-        self.selected_image = filename
-        template.setVar("__SELECTED_IMAGE__", self.selected_image)
-        template.setVar("DEPENDS", self.selected_recipes)
-        template.setVar("IMAGE_INSTALL", self.selected_packages)
         # proxy
         template.setVar("all_proxy", self.all_proxy)
         template.setVar("http_proxy", self.http_proxy)
@@ -152,6 +185,13 @@ class Configuration:
         template.setVar("https_proxy", self.https_proxy)
         template.setVar("enable_proxy", ("%s" % self.enable_proxy))
 
+    def save_image(self, template, filename):
+        # image/recipes/packages
+        self.selected_image = filename
+        template.setVar("__SELECTED_IMAGE__", self.selected_image)
+        template.setVar("DEPENDS", self.selected_recipes)
+        template.setVar("IMAGE_INSTALL", self.selected_packages)
+
 class Parameters:
     '''Represents other variables like available machines, etc.'''
 
@@ -256,6 +296,10 @@ class Builder(gtk.Window):
         self.handler.connect("command-succeeded",        self.handler_command_succeeded_cb)
         self.handler.connect("command-failed",           self.handler_command_failed_cb)
 
+        # restore the settings from the last Hob session
+        self.load_default_settings()
+        self.handler.parse_layers(self.configuration.layers)
+
         self.switch_page(self.MACHINE_SELECTION)
 
     def create_visual_elements(self):
@@ -292,21 +336,32 @@ class Builder(gtk.Window):
         self.show_all()
         self.nb.set_current_page(0)
 
-    def load_template(self, path):
+    def load_template(self, path, load_settings_only=False):
         self.template = TemplateMgr()
-        self.template.load(path)
-        self.configuration.load(self.template)
-
-        for layer in self.configuration.layers:
-            if not os.path.exists(layer+'/conf/layer.conf'):
-                return False
+        ret = True
+        if not self.template.exists(path):
+            ret = False
+        else:
+            self.template.load(path)
+            if not load_settings_only:
+                self.configuration.load(self.template)
+            else:
+                self.configuration.load_settings_only(self.template)
 
-        self.switch_page(self.LAYER_CHANGED)
+            for layer in self.configuration.layers:
+                if not os.path.exists(layer+'/conf/layer.conf'):
+                    ret = False
+            if ret:
+                self.switch_page(self.LAYER_CHANGED)
 
         self.template.destroy()
         self.template = None
+        return ret
 
-    def save_template(self, path):
+    def load_default_settings(self):
+        self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/"), load_settings_only=True)
+
+    def save_template(self, path, save_settings_only=False):
         if path.rfind("/") == -1:
             filename = "default"
             path = "."
@@ -314,14 +369,27 @@ class Builder(gtk.Window):
             filename = path[path.rfind("/") + 1:len(path)]
             path = path[0:path.rfind("/")]
 
-        self.template = TemplateMgr()
+        if not save_settings_only:
+            self.template = TemplateMgr()
+        else:
+            self.template = TemplateMgr(save_template_only=True)
+
         self.template.open(filename, path)
-        self.configuration.save(self.template, filename)
+
+        if not save_settings_only:
+            self.configuration.save(self.template, filename)
+        else:
+            self.configuration.save_settings_only(self.template)
 
         self.template.save()
         self.template.destroy()
         self.template = None
 
+    def save_default_settings(self):
+        if not os.path.exists(".hob/"):
+            os.mkdir(".hob/")
+        self.save_template(".hob/default", save_settings_only=True)
+
     def switch_page(self, next_step):
         # Main Workflow (Business Logic)
         self.nb.set_current_page(self.__step2page__[next_step])
@@ -645,6 +713,8 @@ class Builder(gtk.Window):
         response = dialog.run()
         dialog.destroy()
         if response == gtk.RESPONSE_YES:
+            # save the settings from the next Hob session
+            self.save_default_settings()
             gtk.main_quit()
             return False
         else:
@@ -764,13 +834,6 @@ class Builder(gtk.Window):
 
         dialog.destroy()
 
-    def _setup_proxy(self):
-        if self.configuration.enable_proxy:
-            self.configuration.set_os_proxy("all_proxy", self.configuration.all_proxy)
-            self.configuration.set_os_proxy("http_proxy", self.configuration.http_proxy)
-            self.configuration.set_os_proxy("https_proxy", self.configuration.https_proxy)
-            self.configuration.set_os_proxy("ftp_proxy", self.configuration.ftp_proxy)
-
     def show_adv_settings_dialog(self):
         dialog = AdvancedSettingDialog(title = "Settings",
             configuration = copy.deepcopy(self.configuration),
@@ -800,7 +863,7 @@ class Builder(gtk.Window):
                 self.configuration.http_proxy = dialog.http_proxy
                 self.configuration.https_proxy = dialog.https_proxy
                 self.configuration.ftp_proxy = dialog.ftp_proxy
-                self._setup_proxy()
+                self.configuration._setup_proxy()
             # DO reparse recipes
             if dialog.settings_changed:
                 if self.configuration.curr_mach == "":
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index b555196..4cc3019 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -539,7 +539,7 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>")
         tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified."
-        proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.split_model, self.all_proxy, self, tooltip, False)
+        proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.all_proxy, self, tooltip, False)
         self.all_proxy_text.set_editable(self.enable_proxy)
         self.all_proxy_text.set_sensitive(self.enable_proxy)
         sub_vbox.pack_start(label, expand=False, fill=False)
@@ -547,7 +547,7 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>")
         tooltip = "Set the http proxy that will be used in do_fetch() source code"
-        proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.split_model, self.http_proxy, self, tooltip, False)
+        proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.http_proxy, self, tooltip, False)
         self.http_proxy_text.set_editable(self.enable_proxy)
         self.http_proxy_text.set_sensitive(self.enable_proxy)
         sub_vbox.pack_start(label, expand=False, fill=False)
@@ -555,7 +555,7 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>")
         tooltip = "Set the https proxy that will be used in do_fetch() source code"
-        proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.split_model, self.https_proxy, self, tooltip, False)
+        proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.https_proxy, self, tooltip, False)
         self.https_proxy_text.set_editable(self.enable_proxy)
         self.https_proxy_text.set_sensitive(self.enable_proxy)
         sub_vbox.pack_start(label, expand=False, fill=False)
@@ -563,7 +563,7 @@ class AdvancedSettingDialog (CrumbsDialog):
 
         label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>")
         tooltip = "Set the ftp proxy that will be used in do_fetch() source code"
-        proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.split_model, self.ftp_proxy, self, tooltip, False)
+        proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.ftp_proxy, self, tooltip, False)
         self.ftp_proxy_text.set_editable(self.enable_proxy)
         self.ftp_proxy_text.set_sensitive(self.enable_proxy)
         sub_vbox.pack_start(label, expand=False, fill=False)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index fe7b5d5..f56b6f9 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -266,10 +266,13 @@ class HobHandler(gobject.GObject):
     def parse_config(self):
         self.server.runCommand(["parseConfigurationFiles", "", ""])
 
-    def refresh_layers(self, bblayers):
+    def parse_layers(self, bblayers):
         self.server.runCommand(["initCooker"])
         self.server.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)])
         self.parse_config()
+
+    def refresh_layers(self, bblayers):
+        self.parse_layers(bblayers)
         self.commands_async.append(self.CFG_FILES_DISTRO)
         self.commands_async.append(self.CFG_FILES_MACH)
         self.commands_async.append(self.CFG_FILES_SDKMACH)
diff --git a/bitbake/lib/bb/ui/crumbs/template.py b/bitbake/lib/bb/ui/crumbs/template.py
index a03063c..2e9d2d1 100644
--- a/bitbake/lib/bb/ui/crumbs/template.py
+++ b/bitbake/lib/bb/ui/crumbs/template.py
@@ -129,37 +129,60 @@ class TemplateMgr(gobject.GObject):
     __gBBLayersVars__ = ["BBLAYERS", "LCONF_VERSION"]
     __gRecipeVars__ = ["DEPENDS", "IMAGE_INSTALL"]
 
-    def __init__(self):
+    def __init__(self, save_template_only = False):
         gobject.GObject.__init__(self)
         self.template_hob = None
         self.bblayers_conf = None
         self.local_conf = None
         self.image_bb = None
+        self.save_template_only = save_template_only
+
+    @classmethod
+    def convert_to_template_pathfilename(cls, filename, path):
+        return "%s/%s%s%s" % (path, "template-", filename, ".hob")
+
+    @classmethod
+    def convert_to_bblayers_pathfilename(cls, filename, path):
+        return "%s/%s%s%s" % (path, "bblayers-", filename, ".conf")
+
+    @classmethod
+    def convert_to_local_pathfilename(cls, filename, path):
+        return "%s/%s%s%s" % (path, "local-", filename, ".conf")
+
+    @classmethod
+    def convert_to_image_pathfilename(cls, filename, path):
+        return "%s/%s%s%s" % (path, "hob-image-", filename, ".bb")
 
     def open(self, filename, path):
-        self.template_hob = HobTemplateFile("%s/%s%s%s" % (path, "template-", filename, ".hob"))
-        self.bblayers_conf = ConfigFile("%s/%s%s%s" % (path, "bblayers-", filename, ".conf"))
-        self.local_conf = ConfigFile("%s/%s%s%s" % (path, "local-", filename, ".conf"))
-        self.image_bb = RecipeFile("%s/%s%s%s" % (path, "hob-image-", filename, ".bb"))
+        self.template_hob = HobTemplateFile(TemplateMgr.convert_to_template_pathfilename(filename, path))
+        if not self.save_template_only:
+            self.bblayers_conf = ConfigFile(TemplateMgr.convert_to_bblayers_pathfilename(filename, path))
+            self.local_conf = ConfigFile(TemplateMgr.convert_to_local_pathfilename(filename, path))
+            self.image_bb = RecipeFile(TemplateMgr.convert_to_image_pathfilename(filename, path))
 
     def setVar(self, var, val):
-        if var in TemplateMgr.__gLocalVars__:
-            self.local_conf.setVar(var, val)
-        if var in TemplateMgr.__gBBLayersVars__:
-            self.bblayers_conf.setVar(var, val)
-        if var in TemplateMgr.__gRecipeVars__:
-            self.image_bb.setVar(var, val)
+        if not self.save_template_only:
+            if var in TemplateMgr.__gLocalVars__:
+                self.local_conf.setVar(var, val)
+            if var in TemplateMgr.__gBBLayersVars__:
+                self.bblayers_conf.setVar(var, val)
+            if var in TemplateMgr.__gRecipeVars__:
+                self.image_bb.setVar(var, val)
 
         self.template_hob.setVar(var, val)
 
     def save(self):
-        self.local_conf.save()
-        self.bblayers_conf.save()
-        self.image_bb.save()
+        if not self.save_template_only:
+            self.local_conf.save()
+            self.bblayers_conf.save()
+            self.image_bb.save()
         self.template_hob.save()
 
-    def load(self, path):
-        self.template_hob = HobTemplateFile(path)
+    def exists(self, pathfilename):
+        return os.path.isfile(pathfilename)
+
+    def load(self, pathfilename):
+        self.template_hob = HobTemplateFile(pathfilename)
         self.dictionary = self.template_hob.load()
 
     def getVar(self, var):
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] Hob: reset the policy to forbid the horizontal scrolling for building log
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
                   ` (5 preceding siblings ...)
  2012-03-22 15:38 ` [PATCH 6/8] Hob: remember the settings between Hob sessions Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  2012-03-22 15:38 ` [PATCH 8/8] Hob: add auto scroll to rows which be new appended in hob building log page Shane Wang
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Liming An <limingx.l.an@intel.com>

This patch is not to show the horizontal scroll bar for building log, and add CellRendererText class to wrap the text.

[Yocto #2091]

Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |    6 +++---
 bitbake/lib/bb/ui/crumbs/hobwidget.py        |   24 ++++++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py     |    7 ++++---
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 3605ee1..92ca176 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -58,7 +58,7 @@ class BuildDetailsPage (HobPage):
         self.config_model = self.builder.handler.build.model.config_model()
         self.config_tv.set_model(self.config_model)
         self.scrolled_view_config = gtk.ScrolledWindow ()
-        self.scrolled_view_config.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
         self.scrolled_view_config.add(self.config_tv)
         self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration"))
 
@@ -66,14 +66,14 @@ class BuildDetailsPage (HobPage):
         self.failure_model = self.builder.handler.build.model.failure_model()
         self.failure_tv.set_model(self.failure_model)
         self.scrolled_view_failure = gtk.ScrolledWindow ()
-        self.scrolled_view_failure.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
         self.scrolled_view_failure.add(self.failure_tv)
         self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
 
         self.build_tv = RunningBuildTreeView(readonly=True)
         self.build_tv.set_model(self.builder.handler.build.model)
         self.scrolled_view_build = gtk.ScrolledWindow ()
-        self.scrolled_view_build.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
         self.scrolled_view_build.add(self.build_tv)
         self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
 
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 9d00023..c07db6c 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -706,3 +706,27 @@ class HobNotebook(gtk.VBox):
     def set_search_entry_clear_cb(self, search, icon_pos, event):
         self.reset_entry(search)
 
+class HobWarpCellRendererText(gtk.CellRendererText):
+    def __init__(self, col_number):
+        gtk.CellRendererText.__init__(self)
+        self.set_property("wrap-mode", pango.WRAP_WORD_CHAR)
+        self.set_property("wrap-width", 300) # default value wrap width is 300
+        self.col_n = col_number
+
+    def do_render(self, window, widget, background_area, cell_area, expose_area, flags):
+        if widget:
+            self.props.wrap_width = self.get_resized_wrap_width(widget, widget.get_column(self.col_n))
+        return gtk.CellRendererText.do_render(self, window, widget, background_area, cell_area, expose_area, flags)
+
+    def get_resized_wrap_width(self, treeview, column):
+        otherCols = []
+        for col in treeview.get_columns():
+            if col != column:
+                otherCols.append(col)
+        adjwidth = treeview.allocation.width - sum(c.get_width() for c in otherCols)
+        adjwidth -= treeview.style_get_property("horizontal-separator") * 4
+        if self.props.wrap_width == adjwidth or adjwidth <= 0:
+                adjwidth = self.props.wrap_width
+        return adjwidth
+
+gobject.type_register(HobWarpCellRendererText)
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
index 4c3fe2c..f202a90 100644
--- a/bitbake/lib/bb/ui/crumbs/runningbuild.py
+++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py
@@ -27,6 +27,7 @@ import urllib
 import urllib2
 import pango
 from bb.ui.crumbs.hobcolor import HobColors
+from bb.ui.crumbs.hobwidget import HobWarpCellRendererText
 
 class RunningBuildModel (gtk.TreeStore):
     (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7)
@@ -350,7 +351,7 @@ class RunningBuildTreeView (gtk.TreeView):
         self.append_column (col)
 
         # The message of the build.
-        self.message_renderer = gtk.CellRendererText ()
+        self.message_renderer = HobWarpCellRendererText (col_number=1)
         self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=3)
         self.message_column.add_attribute(self.message_renderer, 'background', 5)
         self.message_renderer.set_property('editable', (not self.readonly))
@@ -419,7 +420,7 @@ class BuildConfigurationTreeView(gtk.TreeView):
         self.get_selection().set_mode(gtk.SELECTION_SINGLE)
 
         # The message of the build.
-        self.message_renderer = gtk.CellRendererText ()
+        self.message_renderer = HobWarpCellRendererText (col_number=0)
         self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR)
         font = self.get_style().font_desc
         font.set_size(pango.SCALE * 13)
@@ -442,6 +443,6 @@ class BuildFailureTreeView(gtk.TreeView):
         self.append_column (col)
 
         # The message of the build.
-        self.message_renderer = gtk.CellRendererText ()
+        self.message_renderer = HobWarpCellRendererText (col_number=1)
         self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR)
         self.append_column (self.message_column)
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] Hob: add auto scroll to rows which be new appended in hob building log page
  2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
                   ` (6 preceding siblings ...)
  2012-03-22 15:38 ` [PATCH 7/8] Hob: reset the policy to forbid the horizontal scrolling for building log Shane Wang
@ 2012-03-22 15:38 ` Shane Wang
  7 siblings, 0 replies; 9+ messages in thread
From: Shane Wang @ 2012-03-22 15:38 UTC (permalink / raw)
  To: bitbake-devel

From: Liming An <limingx.l.an@intel.com>

For make the building screen to provide clear information about task in progress by request, so add this function.

At the beginning of building, the vertical scroll bar will go to the active area automatically.
Once the user moves the scroll bar in the middle, the automatic move of the bar is disabled.
However, once the user moves it to the bottom again, it will be kept to the bottom even though more logs come.

[Yocto #2098]

Signed-off-by: Liming An <limingx.l.an@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 92ca176..5f1524f 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -38,7 +38,7 @@ class BuildDetailsPage (HobPage):
         super(BuildDetailsPage, self).__init__(builder, "Building ...")
 
         self.num_of_issues = 0
-
+        self.endpath = (0,)
         # create visual elements
         self.create_visual_elements()
 
@@ -77,6 +77,8 @@ class BuildDetailsPage (HobPage):
         self.scrolled_view_build.add(self.build_tv)
         self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
 
+        self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)
+
         self.button_box = gtk.HBox(False, 6)
         self.back_button = HobAltButton("Back to image configuration")
         self.back_button.connect("clicked", self.back_button_clicked_cb)
@@ -138,3 +140,10 @@ class BuildDetailsPage (HobPage):
 
     def hide_stop_button(self):
         self.stop_button.hide()
+
+    def scroll_to_present_row(self, model, path, iter, v_adj, treeview):
+        if treeview and v_adj:
+            if path[0] > self.endpath[0]: # check the event is a new row append or not
+                self.endpath = path
+                if v_adj.value == (v_adj.upper - v_adj.page_size): # check the gtk.adjustment position is at end boundary or not
+                    treeview.scroll_to_cell(path)
-- 
1.7.6




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-22 15:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 15:37 [PATCH 0/8] More fixes for Hob Shane Wang
2012-03-22 15:38 ` [PATCH 1/8] command.py: Change parseConfigurationFiles API from async to sync Shane Wang
2012-03-22 15:38 ` [PATCH 2/8] process.py: Increase the timeout value for polling commands Shane Wang
2012-03-22 15:38 ` [PATCH 3/8] Hob: Change parseConfigurationFiles API usage Shane Wang
2012-03-22 15:38 ` [PATCH 4/8] Hob: Fix the workaround to get image types Shane Wang
2012-03-22 15:38 ` [PATCH 5/8] Hob: allow users to setup the proxies Shane Wang
2012-03-22 15:38 ` [PATCH 6/8] Hob: remember the settings between Hob sessions Shane Wang
2012-03-22 15:38 ` [PATCH 7/8] Hob: reset the policy to forbid the horizontal scrolling for building log Shane Wang
2012-03-22 15:38 ` [PATCH 8/8] Hob: add auto scroll to rows which be new appended in hob building log page Shane Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.