Skip to content

Commit

Permalink
Merge pull request #20 from pedohorse/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pedohorse authored Apr 9, 2020
2 parents bbb00de + 584825f commit e831b13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python2.7libs/hpaste/hcollections/collectionwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,24 +449,24 @@ def __removeItem(self,index): # TODO: why did i make it private with protected
def _itemContextMenu(self, index, sidemenu):
item = index.internalPointer()
newaction = sidemenu.addAction('info')
newaction.triggered.connect(lambda x=index: self._itemInfo(x))
newaction.triggered.connect(lambda checked=False, x=index: self._itemInfo(x))
if (not item.readonly()):
sidemenu.addSeparator()
newaction = sidemenu.addAction('rename')
newaction.triggered.connect(lambda x=index: self._renameItem(x))
newaction.triggered.connect(lambda checked=False, x=index: self._renameItem(x))
newaction = sidemenu.addAction('change access')
newaction.triggered.connect(lambda x=index: self._changeAccess(x))
newaction.triggered.connect(lambda checked=False, x=index: self._changeAccess(x))
newaction = sidemenu.addAction('replace content')
newaction.triggered.connect(lambda x=index: self._replaceContent(x))
newaction.triggered.connect(lambda checked=False, x=index: self._replaceContent(x))
newaction = sidemenu.addAction('upload icon')
newaction.triggered.connect(lambda x=index: self._uploadIcon(x))
newaction.triggered.connect(lambda checked=False, x=index: self._uploadIcon(x))
newaction = sidemenu.addAction('remove icon')
newaction.triggered.connect(lambda obj=self, x=index: obj._removeIcon(x))
newaction.triggered.connect(lambda checked=False, obj=self, x=index: obj._removeIcon(x))
# newaction.setEnabled(False)
# TODO: automatically enable stuff if subclass overrides item methods!
sidemenu.addSeparator()
newaction = sidemenu.addAction('remove item')
newaction.triggered.connect(lambda x=index: self.__removeItem(x))
newaction.triggered.connect(lambda checked=False, x=index: self.__removeItem(x))

####Slots
@Slot(QPoint)
Expand All @@ -484,7 +484,7 @@ def showContextMenu(self,pos):
else:
newaction=colmenu.addAction('add selected nodes')
newaction.setData((col))
newaction.triggered.connect(lambda x=col: self._addItem(x))
newaction.triggered.connect(lambda checked=False, x=col: self._addItem(x))
menu.addSeparator()

if(self.ui.mainView.currentIndex().isValid()):
Expand Down
3 changes: 3 additions & 0 deletions python2.7libs/hpaste/hcollections/githubcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def updateItemIfNeeded(self, item):
item._name = newname
item._meta['raw_url'] = gist['files'][newfilename]['raw_url']
item._meta['nettype'] = nettype
item._meta['ver'] = list(currentVersion)
item._id = '%s@%s' % (gist['id'], newfilename)
item._access = CollectionItem.AccessType.public if gist['public'] else CollectionItem.AccessType.private
item._readonly = False
Expand Down Expand Up @@ -503,6 +504,8 @@ def addItem(self,desiredName,description,content, access=CollectionItem.AccessTy
newname = newfilename.split(':',1)[1]

if metadata is None: metadata={}
if 'ver' not in metadata:
metadata['ver'] = list(currentVersion)
metadata['raw_url'] = gist['files'][newfilename]['raw_url']
desc = gist['description']
nettype = ''
Expand Down
2 changes: 2 additions & 0 deletions python2.7libs/hpaste/nethelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def read(self):


def urlopen_nt(req, fallback_cert=0):
# type: (urllib2.Request, int) -> None
"""
wrapper around urllib2.urlopen that does not throw HTTPError
and does some additional things like falling back on SSL certs
Expand All @@ -26,6 +27,7 @@ def urlopen_nt(req, fallback_cert=0):
"""
code = -1
rep = None
# print req.get_full_url(), req.get_data(), fallback_cert
try:
if fallback_cert == 0:
rep = urllib2.urlopen(req)
Expand Down

0 comments on commit e831b13

Please sign in to comment.