360度panorama实验1

装备:

  • nodal ninja 3 mark II
  • canon 500d

APS-C sensor @ 1.8″ the width and height are 22.3mm x 14.9mm ( 0.878  x 0.587 ), focal length multiplier = 1.6

 

  • galaxy s3 安卓屌丝机
  • dslr controller app
  • usb otg cable
  • autodesk stitcher 2009 或 ptgui 9
  • photomatix 4.2

实验1

02/21/2013  living room 地面三脚架擦除失败

 

实验2

02/24/2013  后门的小山坡

待续….

QComboBox加自动完成(不是默认的从字符串首开始match)的疑问?

小弟我有一个QComboBox想要自动完成,所以加了个QCompleter,但是发现只能从字符串开头开始match,比如 chicken rice, steam rice, rice cooker, 如果我输rice进去 只会有第三项出现,遂从stackoverflow搜了个方法 ,但是不知道为什么只在第一次弹出 下拉备选列表时有效,第二次下拉列表就看不到了(还是有效,只是下拉菜单好像出现在了后面,按上下键还是可以选的),直到我加上了

        cr=QRect(QPoint(1, 1), QSize(1, 1))
        self.complete(cr)

完全不知道是为什么 瞎猫撞到死耗子试出来了,求解为啥非要加这个.

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from PyQt4 import QtGui,QtCore

import sys

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)


class MyGui(QDialog): 
    
    def __init__(self, parent=None): 
        
        super(MyGui,self).__init__(parent)

        model = QtGui.QStringListModel()
        wordList = ['Jony_walk_cycleData','Jane_walk','Albert_walkSlowly', 'Alfred_running','Jane_running','Jane_jogging','Albert_lookingAround']
        model.setStringList(wordList)
    
        layout = QtGui.QVBoxLayout(self)
        self.line = QtGui.QLineEdit(self)
        layout.addWidget(self.line)
    
        self.combobox = QComboBox(parent)
        layout.addWidget(self.combobox)
        self.combobox.addItems(wordList)
        self.combobox.setEditable(True)
        
        self.setLayout(layout)
        
        completer = CustomQCompleter2(self)
        completer.setModel(model)
        completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
        # complete.setCompletionMode(QCompleter.PopupCompletion)
        completer.setWrapAround(False)
    
        self.line.setCompleter(completer)
        self.combobox.setCompleter(completer)
        self.combobox.setEditText('')
      
        self.setGeometry(200, 100, 400, 300)

        self.connect(self.combobox,SIGNAL("activated(int)"),self.selectFromCombobox)
        self.connect(completer.popup(), SIGNAL("clicked(QModelIndex)"),lambda i:self.selectFromCompleter(self.combobox,i))


    
    def selectFromCombobox(self,index):
        print 'set cycleName from combobox activated...'
        combobox = self.sender()
        print index
        combobox.setCurrentIndex(index)
#        combobox.setEditable(False)        

    def selectFromCompleter(self,combobox,index):
        print "set cycleName from completer clicked"
        listView = self.sender()
        print 'new cycle name :',index.model().data(index).toString()
        newIndex = combobox.findText(index.model().data(index).toString())
        combobox.setCurrentIndex(newIndex)
#        combobox.setEditable(False)



class CustomQCompleter2(QCompleter):
    def __init__(self, parent=None):
        super(CustomQCompleter2, self).__init__(parent)
        self.local_completion_prefix = ""
        self.source_model = None

    def setModel(self, model):
        self.source_model = model
        super(CustomQCompleter2, self).setModel(self.source_model)

    def updateModel(self):
        local_completion_prefix = self.local_completion_prefix
        class InnerProxyModel(QSortFilterProxyModel):
            def filterAcceptsRow(self, sourceRow, sourceParent):
                index0 = self.sourceModel().index(sourceRow, 0, sourceParent)
                searchStr = local_completion_prefix.lower()
                modelStr = self.sourceModel().data(index0,Qt.DisplayRole).toString().toLower()
                print searchStr,' in ',modelStr, searchStr in modelStr
                return searchStr in modelStr
                
        
        proxy_model = InnerProxyModel()
        
        proxy_model.setSourceModel(self.source_model)
        
        super(CustomQCompleter2, self).setModel(proxy_model)
        print 'match :',proxy_model.rowCount()
        
        # cr = QRect( QPoint(100, 200), QSize(11, 16)) ;
        # cr.setWidth(self.popup().sizeHintForColumn(0)
        # + self.popup().verticalScrollBar().sizeHint().width())

        cr=QRect(QPoint(1, 1), QSize(1, 1))
        self.complete(cr)
        # self.popup().show()
        # self.popup().raise_()
        
    def splitPath(self, path):
        self.local_completion_prefix = str(path)
        self.updateModel()
        return ""

if __name__ == '__main__':

    app = QtGui.QApplication(sys.argv)
    gui = MyGui()
    gui.show()
    sys.exit(app.exec_())

如何在公司防火墙后用git和bitbucket同步(默认的port 22被封了)

通常remote  configuration看起来是这样的

$ git remote show origin
* remote origin
Fetch URL: git@bitbucket.org:user_name/repo_name.git
Push URL: git@bitbucket.org:user_name/repo_name.git

为了达到翻墙的目的,我们需要一个ssh服务器(可以是家里的台式机或者nas或者路由器),我用的是刷了tomato的某路由器,

$ ssh -f user@my_personal_server.com -p   -L :bitbucket.org:22 -N

以上的user@my_personal_server.com ssh-server-port local-port 显然要换成自己选择的地址和端口
比如

$ ssh -f user@my_personal_server.com -p 443 -L 9005:bitbucket.org:22 -N

-f是后台运行 但是还可以输密码,当然你也可以用自动登录(用ssh-keygen来生成rsa或dsa key)
-N是不进入命令行模式 只是建个tunnel
建好之后再运行

$ git remote add tunnel_origin ssh://git@localhost:9005/user_name/repo_name.git

之后就可以正常使用git了
比如

$ git pull tunnel_origin master
From ssh://localhost:9005/user_name/repo_name
* branch master -> FETCH_HEAD
...
...
7 files changed, 202 insertions(+), 50 deletions(-)

参考:

Working with git through a SSH tunnel