We’re rewarding the question askers & reputations are being recalculated! Read more.
6

As mentioned in the documentation, you can refer to other 'types' by using the appropriate ID. This is what you set in the wizard when creating the combo-box, button, etc. and you can change it by editing the config.xml file in the root directory of your addin source. A really simple example that clears a combo-box list when the user presses a button: ...


5

There is no property that defines the number of items that can be shown in the ComboBox. Instead, use the onFocus method to append the layers in the TOC to the drop-down list. def onFocus(self, focused): # When focused, update the combo box with the list of layer names. if focused: self.mxd = arcpy.mapping.MapDocument('current') ...


5

Your problem is with self.ShapeLayerList = QWidgetAction(self.projCombo) That is creating a QWidgetAction with the combo box as its parent widget, not its child widget. Try: self.ShapeLayerList=QWidgetAction(None) self.ShapeLayerList.setDefaultWidget(self.projCombo)


5

This is just conjecture, but there is probably some variable-width text measurement logic going on behind the scenes, and the character W was probably chosen because it is one of the widest characters available in variable-width fonts. I agree that it is a bit nonsensical to do it this way.


4

As documented in the help, use the .refresh() method: combobox.value = val combobox.refresh()


4

I found a workaround. I deleted all the data from the combobox in QT Designer and I defined the edit widget in Layer Properties -> Fields as Value Map. There, I put the data which I want displayed and voila!


4

Sorry for the concise comment, I can elaborate here. Say foo and bar are your combo box dijits: dijit.byId('foo').on('change', function (new_value) { if (new_value == 'multi_family_refuse') { dijit.byId('bar').set('value', 'bar value 1'); } else if (new_value == '...') { dijit.byId('bar').set('value', 'bar value 2'); } else { ... } }); ...


4

So, just to follow up on what Luke said, I created (see below) a very simple example that makes a pull-down of current map layers, which can be easily modified to list something else and act on the selection. The workaround mentioned executes with onEnter so that the last selected val is reset in the combobox. Some comments and print statements left in for ...


3

Although you're asking for an answer related to value map combo-boxes, I thought to provide an alternative where you could use the following code to read the values in the first row for each column and copy it for each of the attributes. Select the layer in QGIS and copy/paste the code into the Python Console (Plugins -> Python Console or Ctrl + Alt + P):...


3

You are calling refresh() but according to the documentation, the method is Refresh() (python is case sensitive). However, I couldn't get this working in 10.1 and ended up leaving the combobox editable, storing a class variable self.selection to track the selection in the onSelChange method and then resetting the value to the previous selection if a non ...


3

You could achieve this based on the QGIS Combo Manager Just create your own filter for the fields in a subclass of FieldCombo. The following code is untested (literally), so please bear with me if there's a typo or other minor problems, and think of it as a reference. from qgiscombomanager import * class MyFieldCombo( FieldCombo ): def __init__(self, ...


3

It's hard to tell from your code sample what you're up to. What you're searching for is the enum esriFieldType which can be tested against each field to determine its type: MyComboBox.items.clear(); // empty first IFeatureLayer pFtLayer = (IFeatureLayer)gMap.get_Layer(0); IFeatureClass pFtClass = pFtLayer.FeatureClass; for (int Cnt = 0; Cnt < pFtClass....


3

Looking at your code I assume you tried pushing in the 'All' Item to the array before the result items? This should work, the order of the array controls the order they appear. Just tidied up the code and added both a label and an identifier (I don't think this is required to be different or controls the order). Update: Here is a JS fiddle running in 2.8 ...


3

It's not a big deal, you just have to create a function for the zoom & highlight action and connect it to your comboBox. The following code should works: def zoomTo(): cityName = cb.currentText() c = lyr.getFeatures(QgsFeatureRequest().setFilterExpression(u' "name" ILIKE \'%s\' ' %cityName)) lyr.setSelectedFeatures([s.id() for s in c]) ...


3

Use a "Value List" param.filter.type = "ValueList" param.filter.list = [a, list, of, states] E.g. import arcpy class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "states" self.alias = "states" # List of tool classes ...


3

I've not had much call in developing Python AddIns but what you were asking is something I would have approached in VB .net using an extension with an event firing on something specific. If you look at the help file you can create a Python add-in application extension. This can hook into various events, an obvious one is on openDocument() or possibly ...


2

That string represent the maximum length of string that you can show on that combo-box.That mean if it shows "WWW" you can add items of maximum 3 character.If you entered otherwise the arc-map split that string by the maximum length and balance will shown as next item.This also mentioned in Add-in _wizard. See image below


2

Thanks to ndawson for his advice; direction in the right direction: Had to implement a test QObject to fufill the parent-child relations... # CSV attribute editor toolbox layer population(s) self.projCombo = QComboBox(self.iface.mainWindow()) self.projCombo.addItem('example slot') self.projCombo.addItem('another example slot') self....


2

I tried this and it worked : in your function run : Put the line layer = self.wcb.currentLayer() after if result: It did what I think you wanted it to do. On a side note : you know you can make your app calculate the average without clicking on ok? If you play with the signals, you can make a text appear in your main window each time you change ...


2

It's because you have to define which attribute of your combo box you want to use when editing. the "strange" () characters equals to an empty box with no attribute defined.


2

It seems to me, that there is no way to correctly bind a QComboBox. Looks like a bug to me. I solved the problem by creating a QLineEdit, that is bound to the attribute (set edit widget to "Text Edit"), and hiding this LineEdit behind a ComcoBox. Every change of the value in the ComboBox triggers a function, that sets the text of the LineEdit to the current ...


2

You probably are going to want to form a where clause out of the comboboxes. You can get at the value of the combobox by looking at the docstring of your class to get the actual combobox object's value by the name you see there. So in this example: class RangeComboBoxClass38(object): """Implementation for SEC_TWN_RNG_2_addin.combobox_3 (ComboBox)""" ...


2

Not using field-calculator, you can use UpdateCursor and setNull. (Arcgis for 10.1) a quick example: rows = arcpy.UpdateCursor(fc, sql, etc...) for row in rows: row.SetNull("FIELD") rows.updateRow(row) del rows


2

Basically, you have to use signals to detect the "change layer" event and update your field combobox accordingly. Here is a simplified example (assuming you already have the run and initGui methods defined): In run(self): layers = QgsMapLayerRegistry.instance().mapLayers().values() # Create list with all layers # layers = self.iface.legendInterface()....


2

from within DMS2Point_dialog_base.py add from qgis.gui import QgsMapLayerComboBox


2

I doubt you can use timer in addin seamlessly. If possible, I want to learn, too. However, you can use onFocus() function of combobox. This is not a perfect solution, but it might be helpful. class gc_cmb(object): def __init__(self): self.editable = True self.enabled = True self.dropdownWidth = '...


2

The code that I used to solve this was: import arcpy import pythonaddins class ComboBoxClass1(object): """Implementation for ComboBox_addin.combobox1 (ComboBox)""" def __init__(self): arcpy.env.workspace = r"C:\polygeo\QGIS" self.items = arcpy.ListFeatureClasses() self.editable = True self.enabled = True self....


2

You could use a Rule-based style, one for each 'slices'/expression. You will then be able to choose in the layer panel what to see and what to hide. In QGIS 3.4 you can configure your gradient style (choose attribute and Classify), then choose "category style", Qgis will create a rule for each value in your heat map.


1

One problem I see (which could just be how the code was copied into the question) is the const pPath quoted string is not properly formed (needs quotes front and back.) Likely that was just a typo, and not the real source of the problem... However, the loadComboBoxOn() appears to build an image array out of a list of layer names...but I don't see where ...


Only top voted, non community-wiki answers of a minimum length are eligible